summaryrefslogtreecommitdiffstats
path: root/t/buildsystems/02-make-jobserver-makeflags.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 21:06:40 +0000
commitd827c6cf1631209f5042a9d1d8a7ecc24223c8a0 (patch)
tree91a431d301efd0e524bdfb0c46e97d591a9d7b03 /t/buildsystems/02-make-jobserver-makeflags.t
parentInitial commit. (diff)
downloaddebhelper-d827c6cf1631209f5042a9d1d8a7ecc24223c8a0.tar.xz
debhelper-d827c6cf1631209f5042a9d1d8a7ecc24223c8a0.zip
Adding upstream version 13.11.4.upstream/13.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xt/buildsystems/02-make-jobserver-makeflags.t57
1 files changed, 57 insertions, 0 deletions
diff --git a/t/buildsystems/02-make-jobserver-makeflags.t b/t/buildsystems/02-make-jobserver-makeflags.t
new file mode 100755
index 0000000..9469759
--- /dev/null
+++ b/t/buildsystems/02-make-jobserver-makeflags.t
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 9;
+
+use File::Basename qw(dirname);
+use lib dirname(dirname(__FILE__));
+use Test::DH;
+use Debian::Debhelper::Dh_Lib qw(!dirname);
+
+# Test clean_jobserver_makeflags.
+
+test_clean_jobserver_makeflags('--jobserver-fds=103,104 -j',
+ undef,
+ 'unset makeflags');
+
+test_clean_jobserver_makeflags('-a --jobserver-fds=103,104 -j -b',
+ '-a -b',
+ 'clean makeflags');
+
+test_clean_jobserver_makeflags(' --jobserver-fds=1,2 -j ',
+ undef,
+ 'unset makeflags');
+
+test_clean_jobserver_makeflags('-a -j -b',
+ '-a -j -b',
+ 'clean makeflags does not remove -j');
+
+test_clean_jobserver_makeflags('-a --jobs -b',
+ '-a --jobs -b',
+ 'clean makeflags does not remove --jobs');
+
+test_clean_jobserver_makeflags('-j6',
+ '-j6',
+ 'clean makeflags does not remove -j6');
+
+test_clean_jobserver_makeflags('-a -j6 --jobs=7',
+ '-a -j6 --jobs=7',
+ 'clean makeflags does not remove -j or --jobs');
+
+test_clean_jobserver_makeflags('-j6 --jobserver-fds=103,104 --jobs=8',
+ '-j6 --jobs=8',
+ 'jobserver options removed');
+
+test_clean_jobserver_makeflags('-j6 --jobserver-auth=103,104 --jobs=8',
+ '-j6 --jobs=8',
+ 'jobserver options removed');
+
+sub test_clean_jobserver_makeflags {
+ my ($orig, $expected, $test) = @_;
+
+ local $ENV{MAKEFLAGS} = $orig;
+ clean_jobserver_makeflags();
+ is($ENV{MAKEFLAGS}, $expected, $test);
+}
+