From 73bd77ef84e40b43f2ff47d7adb569249e14954f Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:36:05 +0100 Subject: opttest.pl Fix Perl complaints --- opttest.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'opttest.pl') diff --git a/opttest.pl b/opttest.pl index 85e3b494..96c4fb0a 100755 --- a/opttest.pl +++ b/opttest.pl @@ -1,5 +1,6 @@ #!/usr/bin/perl -w use strict; +use warnings; use Test; use vars qw($dir $file $prog $idx $state $output %progs @dirs); @@ -8,7 +9,7 @@ my $tests = 0; @dirs = qw(plugins plugins-scripts); -foreach $dir (@dirs) { +foreach my $dir (@dirs) { opendir(DIR, $dir) || die "can't opendir $dir: $!"; while ($file = readdir(DIR)) { if (-x "$dir/$file" && -f "$dir/$file") { @@ -21,7 +22,7 @@ foreach $dir (@dirs) { plan tests => $tests; -for $prog (keys %progs) { +for my $prog (keys %progs) { $state = 0; $file = `basename $prog`; -- cgit v1.2.3-74-g34f1 From cb5abf1981629234f4ee0e1b2ecda2b32ef1cb00 Mon Sep 17 00:00:00 2001 From: Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> Date: Wed, 19 Feb 2025 14:36:37 +0100 Subject: opttest.pl: Move to tools --- opttest.pl | 51 --------------------------------------------------- tools/opttest.pl | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 51 deletions(-) delete mode 100755 opttest.pl create mode 100755 tools/opttest.pl (limited to 'opttest.pl') diff --git a/opttest.pl b/opttest.pl deleted file mode 100755 index 96c4fb0a..00000000 --- a/opttest.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use warnings; -use Test; - -use vars qw($dir $file $prog $idx $state $output %progs @dirs); - -my $tests = 0; - -@dirs = qw(plugins plugins-scripts); - -foreach my $dir (@dirs) { - opendir(DIR, $dir) || die "can't opendir $dir: $!"; - while ($file = readdir(DIR)) { - if (-x "$dir/$file" && -f "$dir/$file") { - $tests++; - $progs{"$dir/$file"} = $file; - } - } - closedir DIR; -} - -plan tests => $tests; - -for my $prog (keys %progs) { - $state = 0; - $file = `basename $prog`; - - $idx = 1; - $output = `$prog -h 2>&1`; - if($?) {$state++;print "$prog failed test $idx\n";} - unless ($output =~ m/$progs{$prog}/ms) { - $idx++; $state++;print "$output\n$prog failed test $idx\n"; - } - - $idx++; - `$prog --help 2>&1 > /dev/null`; - if($?) {$state++;print "$prog failed test $idx\n";} - - $idx++; - `$prog -V 2>&1 > /dev/null`; - if($?) {$state++;print "$prog failed test $idx\n";} - - $idx++; - `$prog --version 2>&1 > /dev/null`; - if($?) {$state++;print "$prog failed test $idx\n";} - - print "$prog ($idx tests) "; - ok $state,0; -} - diff --git a/tools/opttest.pl b/tools/opttest.pl new file mode 100755 index 00000000..96c4fb0a --- /dev/null +++ b/tools/opttest.pl @@ -0,0 +1,51 @@ +#!/usr/bin/perl -w +use strict; +use warnings; +use Test; + +use vars qw($dir $file $prog $idx $state $output %progs @dirs); + +my $tests = 0; + +@dirs = qw(plugins plugins-scripts); + +foreach my $dir (@dirs) { + opendir(DIR, $dir) || die "can't opendir $dir: $!"; + while ($file = readdir(DIR)) { + if (-x "$dir/$file" && -f "$dir/$file") { + $tests++; + $progs{"$dir/$file"} = $file; + } + } + closedir DIR; +} + +plan tests => $tests; + +for my $prog (keys %progs) { + $state = 0; + $file = `basename $prog`; + + $idx = 1; + $output = `$prog -h 2>&1`; + if($?) {$state++;print "$prog failed test $idx\n";} + unless ($output =~ m/$progs{$prog}/ms) { + $idx++; $state++;print "$output\n$prog failed test $idx\n"; + } + + $idx++; + `$prog --help 2>&1 > /dev/null`; + if($?) {$state++;print "$prog failed test $idx\n";} + + $idx++; + `$prog -V 2>&1 > /dev/null`; + if($?) {$state++;print "$prog failed test $idx\n";} + + $idx++; + `$prog --version 2>&1 > /dev/null`; + if($?) {$state++;print "$prog failed test $idx\n";} + + print "$prog ($idx tests) "; + ok $state,0; +} + -- cgit v1.2.3-74-g34f1