The -t argument accepts the path to a test file or a test directory. It
would be useful if shell wildcards could be used to specify test files,
but this doesn't work when using optional arguments.
By changing the test path(s) to be positional arguments we can easily
allow for shell wildcards.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
bin/libvirt-tck | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/bin/libvirt-tck b/bin/libvirt-tck
index d5519dd..bd332a4 100644
--- a/bin/libvirt-tck
+++ b/bin/libvirt-tck
@@ -8,7 +8,7 @@ libvirt-tck - libvirt Technology Compatability Kit
=head1 SYNOPSIS
- # libvirt-tck [OPTIONS]
+ # libvirt-tck [OPTIONS] [TESTS..]
Run with default config, probing for URI to use
@@ -62,8 +62,15 @@ the default configuration file from
C</etc/libvirt-tck/default.cfg>
and will allow libvirt to probe for the hypervisor driver to
run. If a reliably repeatable test result set is desired, it is
recommended to always give an explicit libvirt connection URI
-to choose the driver. The following options are available when
-running the C<libvirt-tck> command
+to choose the driver.
+
+Any command line arguments that are not parsed as options will
+be considered paths to test scripts to invoke. If no paths are
+given, all tests under C</usr/share/libvirt-tck/tests> will be
+executed.
+
+The following options are available when running the C<libvirt-tck>
+command
=over 4
@@ -98,11 +105,6 @@ networks, storage pools, etc which have a "tck" name
prefix.
User created objects whose name does not start with "tck" will be
left untouched.
-=item -t, --testdir PATH
-
-Specify an alternate directory path in which to find the test
-scripts to be run. If omitted, defaults to C</usr/share/libvirt-tck/tests>
-
=item -a, --archive FILE
Generate an archive containing all the raw test results. The
@@ -144,7 +146,6 @@ my $timer = 0;
my $archive;
my $config = catfile($confdir, "default.cfg");
my $format = "text";
-my $testdir = catdir($datadir, "tests");
if (!GetOptions("verbose" => \$verbose,
"debug" => \$debug,
@@ -154,7 +155,6 @@ if (!GetOptions("verbose" => \$verbose,
"config=s" => \$config,
"force" => \$force,
"format=s" => \$format,
- "testdir=s" => \$testdir,
"timer" => \$timer) || $help) {
pod2usage(-verbose => $help,
-output => $help ? \*STDOUT : \*STDERR,
@@ -181,12 +181,19 @@ if ($verbose && $quiet) {
-output => \*STDERR);
}
-unless (-e $testdir) {
- print STDERR "$0: test directory '$testdir' does not exist\n";
- exit 2;
+my @testdirs = @ARGV;
+unless (@testdirs) {
+ push @testdirs, catdir($datadir, "tests");
+}
+
+foreach (@testdirs) {
+ unless (-e $_) {
+ print STDERR "$0: test path '$_' does not exist\n";
+ exit 2;
+ }
}
-my @newargv = ("-r", "--norc", "--merge", $testdir);
+my @newargv = ("-r", "--norc", "--merge", @testdirs);
if ($archive) {
push @newargv, "-a", $archive;
--
2.19.1