diff options
author | Niels Thykier <niels@thykier.net> | 2016-07-02 08:19:06 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2016-07-02 08:41:38 +0000 |
commit | 0663b19f878dd69487d99065ce6ad28a2c866551 (patch) | |
tree | 8472bb690c662e6310e77412a1500c4b6d0832eb /t | |
parent | 94af03240ad3b70926234422161ff7cc60ae72ee (diff) | |
download | debhelper-0663b19f878dd69487d99065ce6ad28a2c866551.tar.gz |
Handle renamed/changed make parallel options
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't')
-rwxr-xr-x | t/buildsystems/buildsystem_tests.t | 62 |
1 files changed, 37 insertions, 25 deletions
diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t index 6493caea..b6e2c91b 100755 --- a/t/buildsystems/buildsystem_tests.t +++ b/t/buildsystems/buildsystem_tests.t @@ -1,6 +1,6 @@ #!/usr/bin/perl -use Test::More tests => 299; +use Test::More tests => 300; use strict; use warnings; @@ -509,37 +509,41 @@ ok ( ! -e 'bld', "bld got deleted too" ); # Test clean_jobserver_makeflags. -$ENV{MAKEFLAGS} = "--jobserver-fds=103,104 -j"; -clean_jobserver_makeflags(); -ok(! exists $ENV{MAKEFLAGS}, "unset makeflags"); +test_clean_jobserver_makeflags('--jobserver-fds=103,104 -j', + undef, + 'unset makeflags'); -$ENV{MAKEFLAGS} = "-a --jobserver-fds=103,104 -j -b"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-a -b", "clean makeflags"); +test_clean_jobserver_makeflags('-a --jobserver-fds=103,104 -j -b', + '-a -b', + 'clean makeflags'); -$ENV{MAKEFLAGS} = " --jobserver-fds=1,2 -j "; -clean_jobserver_makeflags(); -ok(! exists $ENV{MAKEFLAGS}, "unset makeflags"); +test_clean_jobserver_makeflags(' --jobserver-fds=1,2 -j ', + undef, + 'unset makeflags'); -$ENV{MAKEFLAGS} = "-a -j -b"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-a -j -b", "clean makeflags does not remove -j"); +test_clean_jobserver_makeflags('-a -j -b', + '-a -j -b', + 'clean makeflags does not remove -j'); -$ENV{MAKEFLAGS} = "-a --jobs -b"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-a --jobs -b", "clean makeflags does not remove --jobs"); +test_clean_jobserver_makeflags('-a --jobs -b', + '-a --jobs -b', + 'clean makeflags does not remove --jobs'); -$ENV{MAKEFLAGS} = "-j6"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-j6", "clean makeflags does not remove -j6"); +test_clean_jobserver_makeflags('-j6', + '-j6', + 'clean makeflags does not remove -j6'); -$ENV{MAKEFLAGS} = "-a -j6 --jobs=7"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-a -j6 --jobs=7", "clean makeflags does not remove -j or --jobs"); +test_clean_jobserver_makeflags('-a -j6 --jobs=7', + '-a -j6 --jobs=7', + 'clean makeflags does not remove -j or --jobs'); -$ENV{MAKEFLAGS} = "-j6 --jobserver-fds=103,104 --jobs=8"; -clean_jobserver_makeflags(); -is($ENV{MAKEFLAGS}, "-j6 --jobs=8", "jobserver options removed"); +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'); # Test parallel building with makefile build system. $ENV{MAKEFLAGS} = ""; @@ -570,6 +574,14 @@ sub test_is_parallel { is( $?, 0, "(exit status=0) $desc"); } +sub test_clean_jobserver_makeflags { + my ($orig, $expected, $test) = @_; + + local $ENV{MAKEFLAGS} = $orig; + clean_jobserver_makeflags(); + is($ENV{MAKEFLAGS}, $expected, $test); +} + test_isnt_parallel( do_parallel_mk(), "No parallel by default" ); test_isnt_parallel( do_parallel_mk("parallel"), |