]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Support
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 26 Aug 2015 20:24:47 +0000 (20:24 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 26 Aug 2015 20:24:47 +0000 (20:24 +0000)
  envB: var=value
in the .vgtest file. This is similar to "env:" except the environment
variable is set prior to invoking progB.
Adapt gdbserver_tests/nlgone_exit.vgtest to fix a problem reported
by Matthias Schwarzott <zzam@gentoo.org>

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15592

gdbserver_tests/nlgone_exit.vgtest
tests/vg_regtest.in

index 02a20a7afa3bd01053556f4c9f11907a1309cbe0..521c19df900aa566b70cc15409eb8c4b0ba286cd 100644 (file)
@@ -7,6 +7,7 @@ vgopts: --tool=none --vgdb=yes --vgdb-stop-at=startup,exit --vgdb-prefix=./vgdb-
 stderr_filter: filter_stderr
 prereq: test -e gdb
 progB: gdb
+envB: LC_ALL=C
 argsB: --quiet -l 60 --nx ./gone
 stdinB: nlgone_exit.stdinB.gdb
 stdoutB_filter: filter_gdb
index 16f49862b5e3b878ce1dbf9c75a82d7d7af60307..bfb269f9600cc905ec16ddfde31f0ad8646907f9 100755 (executable)
@@ -71,6 +71,7 @@
 #   - stderr_filter_args: <args for stderr_filter>  (default: basename of .vgtest file)
 #
 #   - progB:  <prog to run in parallel with prog>   (default: none)
+#   - envB: <environment variable for progB>        (default: none)
 #   - argsB:  <args for progB>                      (default: none)
 #   - stdinB: <input file for progB>                (default: none)
 #   - stdoutB_filter: <filter progB stdout through> (default: none)
@@ -91,6 +92,7 @@
 #
 # There can be more than one env: declaration. Here is an example:
 #   env: PATH=/opt/bin:$PATH
+# Likewise for envB.
 #
 # Expected stdout (filtered) is kept in <test>.stdout.exp* (can be more
 # than one expected output).  It can be missing if it would be empty.  Expected
@@ -162,6 +164,7 @@ my $prereq;             # prerequisite test to satisfy before running test
 my $post;               # check command after running test
 my $cleanup;            # cleanup command to run
 my @env = ();           # environment variable to set prior calling $prog
+my @envB = ();          # environment variable to set prior calling $progB
 
 my @failures;           # List of failed tests
 
@@ -344,6 +347,8 @@ sub read_vgtest_file($)
             $cleanup = $1;
         } elsif ($line =~ /^\s*env:\s*(.*)$/) {
             push @env,$1;
+        } elsif ($line =~ /^\s*envB:\s*(.*)$/) {
+            push @envB,$1;
         } else {
             die "Bad line in $f: $line\n";
         }
@@ -460,6 +465,11 @@ sub do_one_test($$)
 
 
     if (defined $progB) {
+        # Collect environment variables, if any.
+        my $envBvars = "";
+        foreach my $e (@envB) {
+           $envBvars = "$envBvars $e";
+        }
         # If there is a progB, let's start it in background:
         printf("%-16s valgrind $extraopts $vgopts $prog $args (progB: $progB $argsB)\n",
                "$name:");
@@ -468,11 +478,13 @@ sub do_one_test($$)
         # to e.g. redirect stdoutB to stderrB
         if (defined $stdinB) {
             mysystem("(rm -f progB.done;"
-                     . " < $stdinB > $name.stdoutB.out 2> $name.stderrB.out $progB $argsB;"
+                     . " < $stdinB > $name.stdoutB.out 2> $name.stderrB.out"
+                     . " $envBvars $progB $argsB;"
                      . "touch progB.done) &");
         } else {
             mysystem("(rm -f progB.done;"
-                     . " > $name.stdoutB.out 2> $name.stderrB.out $progB $argsB;"
+                     . " > $name.stdoutB.out 2> $name.stderrB.out"
+                     . "$envBvars $progB $argsB;"
                      . "touch progB.done)  &");
         }
     } else {