summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quilt.changes1
-rwxr-xr-xtest/run13
2 files changed, 7 insertions, 7 deletions
diff --git a/quilt.changes b/quilt.changes
index 3cf5f20..def8929 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -8,6 +8,7 @@ Wed Feb 12 20:57:35 CET 2014 - jdelvare@suse.de
- test/run: Reorder functions.
- test/run: Declare global variables as such.
- test/run: Fix the condition for using /bin/sh.
+- test/run: Minor performance optimizations.
-------------------------------------------------------------------
Mon Feb 10 13:07:14 CET 2014 - jdelvare@suse.de
diff --git a/test/run b/test/run
index fd1fcc2..fb8b10b 100755
--- a/test/run
+++ b/test/run
@@ -119,7 +119,7 @@ sub exec_test($$) {
my ($raw_prog, $in) = @_;
local (*IN, *IN_DUP, *IN2, *OUT_DUP, *OUT, *OUT2);
my $prog = [ shellwords($raw_prog) ];
- my $needs_shell = ($raw_prog =~ /[][|&<>;`\$*?]/);
+ my $needs_shell;
if ($prog->[0] eq "umask") {
umask oct $prog->[1];
@@ -139,6 +139,8 @@ sub exec_test($$) {
return 0, [];
}
+ $needs_shell = ($raw_prog =~ /[][|&<>;`\$*?]/);
+
pipe *IN2, *OUT
or die "Can't create pipe for reading: $!";
open *IN_DUP, "<&STDIN"
@@ -219,23 +221,20 @@ sub process_test($$$$) {
print_body "[$prog_line] \$ $prog -- ";
my ($exec_status, $result) = exec_test($prog, $in);
my @good = ();
+ my $good = 1;
my $nmax = (@$out > @$result) ? @$out : @$result;
for (my $n = 0; $n < $nmax; $n++) {
- my $use_re;
- if (defined $out->[$n] && $out->[$n] =~ /^~ /) {
- $use_re = 1;
- $out->[$n] =~ s/^~ //g;
- }
+ my $use_re = defined($out->[$n]) && ($out->[$n] =~ s/^~ //);
if (!defined($out->[$n]) || !defined($result->[$n]) ||
(!$use_re && $result->[$n] ne $out->[$n]) ||
( $use_re && $result->[$n] !~ /^$out->[$n]/)) {
push @good, ($use_re ? '!~' : '!=');
+ $good = 0;
} else {
push @good, ($use_re ? '=~' : '==');
}
}
- my $good = !grep(/!/, @good);
$tests++;
$failed++ unless $good;
print_body(($good ? $OK : $FAILED)."\n");