diff options
author | Aurélien Aptel <aurelien.aptel@gmail.com> | 2013-07-16 14:46:02 +0200 |
---|---|---|
committer | Jim McDonough <jmcd@samba.org> | 2013-11-05 08:42:42 -0500 |
commit | 363601e277b71131bbd4fa0169d6fc7424c5ce04 (patch) | |
tree | bd94682e746a0c8137bd14ae4615ce9f959e7f31 | |
parent | 45bee9901b94e68b86ff50f0e0629522d5b5800a (diff) | |
download | samba-363601e277b71131bbd4fa0169d6fc7424c5ce04.tar.gz samba-363601e277b71131bbd4fa0169d6fc7424c5ce04.tar.xz samba-363601e277b71131bbd4fa0169d6fc7424c5ce04.zip |
test_smbclient_tarmode.pl: let --test run multiple tests
Signed-off-by: Aurélien Aptel <aurelien.aptel@gmail.com>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
-rwxr-xr-x | source3/script/tests/test_smbclient_tarmode.pl | 52 |
1 files changed, 45 insertions, 7 deletions
diff --git a/source3/script/tests/test_smbclient_tarmode.pl b/source3/script/tests/test_smbclient_tarmode.pl index 0fed72b790..86edb525aa 100755 --- a/source3/script/tests/test_smbclient_tarmode.pl +++ b/source3/script/tests/test_smbclient_tarmode.pl @@ -70,7 +70,7 @@ our $LOCALPATH = '/media/data/smb-test'; our $TMP = File::Temp->newdir(); our $BIN = 'smbclient'; -my $SINGLE_TEST = -1; +my $SELECTED_TEST = ''; my $LIST_TEST = 0; my @SMBARGS = (); @@ -129,7 +129,10 @@ my @TESTS = ( list tests --test N - only run test number N + --test A-B + --test A,B,D-F + + only run certain tests (accept list and intervals of numbers) =cut @@ -142,7 +145,7 @@ GetOptions('u|user=s' => \$USER, 'l|local-path=s' => \$LOCALPATH, 'b|bin=s' => \$BIN, - 'test=i' => \$SINGLE_TEST, + 'test=s' => \$SELECTED_TEST, 'list' => \$LIST_TEST, 'clean' => \$CLEAN, @@ -197,12 +200,14 @@ if ($CLEAN) { # RUN TESTS -if ($SINGLE_TEST == -1) { +my @selection = parse_test_string($SELECTED_TEST); + +if ($SELECTED_TEST eq '') { run_test(@TESTS); -} elsif (0 <= $SINGLE_TEST && $SINGLE_TEST < @TESTS) { - run_test($TESTS[$SINGLE_TEST]); +} elsif (@selection > 0) { + run_test(@selection); } else { - die "Test number is invalid\n"; + die "Test selection '$SELECTED_TEST' is invalid\n"; } ################################# @@ -637,6 +642,39 @@ sub run_test { reset_env(); } +sub parse_test_string { + my $s = shift; + my @tests = (); + + if (!length($s)) { + return (); + } + + for (split /,/, $s) { + when (/^\d+$/) { + if ($_ >= @TESTS) { + return (); + } + push @tests, $TESTS[$_]; + } + when (/^(\d+)-(\d+)$/) { + my ($min, $max) = sort ($1, $2); + if ($max >= @TESTS) { + return (); + } + + for ($min..$max) { + push @tests, $TESTS[$_]; + } + } + default { + return (); + } + } + + return @tests; +} + sub print_res { my $err = shift; if ($err) { |