From fb69cae6cf0e3cae514b1d4f98ef64463a22773e Mon Sep 17 00:00:00 2001
From: Leif Walsh <leif@tokutek.com>
Date: Wed, 17 Apr 2013 00:01:29 -0400
Subject: [PATCH] refs #5949 suppress valgrind on the first (crashing)
 execution of recovery_fileops_unit.tdb, for some reason raise(SIGKILL) hangs
 valgrind in that test

git-svn-id: file:///svn/toku/tokudb@52783 c7de825b-a66e-492c-adef-691d508d4ae1
---
 src/tests/recovery_fileops_unit.cc     | 9 ++++++++-
 src/tests/run_recovery_fileops_unit.sh | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/tests/recovery_fileops_unit.cc b/src/tests/recovery_fileops_unit.cc
index e6a8d39882..aa401f868c 100644
--- a/src/tests/recovery_fileops_unit.cc
+++ b/src/tests/recovery_fileops_unit.cc
@@ -124,7 +124,7 @@ do_args(int argc, char * const argv[]) {
     }
 
     char c;
-    while ((c = getopt(argc, argv, "vqhcrO:A:B:C:D:E:F:G:H:I:")) != -1) {
+    while ((c = getopt(argc, argv, "vqhcrO:A:B:C:D:E:F:G:H:I:X:")) != -1) {
 	switch(c) {
         case 'v':
 	    verbose++;
@@ -174,6 +174,13 @@ do_args(int argc, char * const argv[]) {
                 usage();
             choices[c - 'A'] = num;
             break;
+        case 'X':
+            if (strcmp(optarg, "novalgrind") == 0) {
+                // provide a way for the shell script runner to pass an
+                // arg that suppresses valgrind on this child process
+                break;
+            }
+            // otherwise, fall through to an error
 	default:
             usage();
             break;
diff --git a/src/tests/run_recovery_fileops_unit.sh b/src/tests/run_recovery_fileops_unit.sh
index b57357c4f2..b2f2d8d6bd 100755
--- a/src/tests/run_recovery_fileops_unit.sh
+++ b/src/tests/run_recovery_fileops_unit.sh
@@ -8,7 +8,7 @@ errorfile=$1; shift
 abortcode=$1; shift
 
 set +e
-$bin -c $@ 2> $errorfile
+$bin -X novalgrind -c $@ 2> $errorfile
 test $? -eq $abortcode || { cat $errorfile; echo Error: no crash in $errorfile; exit 1; }
 set -e
 grep -q 'HAPPY CRASH' $errorfile || { cat $errorfile; echo Error: incorrect crash in $errorfile; exit 1; }
-- 
2.30.9