diff options
author | Niels Thykier <niels@thykier.net> | 2017-07-02 16:27:46 +0000 |
---|---|---|
committer | Niels Thykier <niels@thykier.net> | 2017-07-03 14:34:26 +0000 |
commit | 943baac7b90170fe13dbb441f591845e8205dcc0 (patch) | |
tree | c4f0b615984acf14e2988b2d5465c5ca2f600574 /t | |
parent | 664c63ae2b2c477d8be91eeb0fd38e49af098ae1 (diff) | |
download | debhelper-943baac7b90170fe13dbb441f591845e8205dcc0.tar.gz |
t: Split out a separate test for make jobserver flags
Signed-off-by: Niels Thykier <niels@thykier.net>
Diffstat (limited to 't')
-rwxr-xr-x | t/buildsystems/02-make-jobserver-makeflags.t | 63 | ||||
-rwxr-xr-x | t/buildsystems/buildsystem_tests.t | 46 |
2 files changed, 64 insertions, 45 deletions
diff --git a/t/buildsystems/02-make-jobserver-makeflags.t b/t/buildsystems/02-make-jobserver-makeflags.t new file mode 100755 index 00000000..9830bf58 --- /dev/null +++ b/t/buildsystems/02-make-jobserver-makeflags.t @@ -0,0 +1,63 @@ +#!/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; + +# 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); +} + + +# Local Variables: +# indent-tabs-mode: t +# tab-width: 4 +# cperl-indent-level: 4 +# End: diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t index 468e921a..111839d2 100755 --- a/t/buildsystems/buildsystem_tests.t +++ b/t/buildsystems/buildsystem_tests.t @@ -1,6 +1,6 @@ #!/usr/bin/perl -use Test::More tests => 325; +use Test::More tests => 316; use strict; use warnings; @@ -516,43 +516,6 @@ ok ( ! -e 'bld', "bld got deleted too" ); #### Test parallel building and related options / routines @tmp = ( $ENV{MAKEFLAGS}, $ENV{DEB_BUILD_OPTIONS} ); -# 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'); # Test parallel building with makefile build system. $ENV{MAKEFLAGS} = ""; @@ -583,13 +546,6 @@ 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" ); |