From 2b1b7632fc1bc4cc146ad7d750b74bd690faa910 Mon Sep 17 00:00:00 2001
From: toddouska <todd@wolfssl.com>
Date: Thu, 16 Mar 2017 11:10:12 -0700
Subject: [PATCH] add keep option to fips-check.sh to keep FIPS temp folder
 around

---
 fips-check.sh | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/fips-check.sh b/fips-check.sh
index a9c1ddb8e..d6d88375c 100755
--- a/fips-check.sh
+++ b/fips-check.sh
@@ -9,14 +9,17 @@
 # This should check out all the approved versions. The command line
 # option selects the version.
 #
-#     $ ./fips-check [version]
+#     $ ./fips-check [version] [keep]
 #
 #     - version: linux (default), ios, android, windows, freertos, linux-ecc
 #
+#     - keep: (default off) XXX-fips-test temp dir around for inspection
+#
 
 function Usage() {
-    echo "Usage: $0 [platform]"
+    echo "Usage: $0 [platform] [keep]"
     echo "Where \"platform\" is one of linux (default), ios, android, windows, freertos, openrtos-3.9.2, linux-ecc"
+    echo "Where \"keep\" means keep (default off) XXX-fips-test temp dir around for inspection"
 }
 
 LINUX_FIPS_VERSION=v3.2.6
@@ -62,6 +65,8 @@ WC_SRC_PATH=ctaocrypt/src
 
 if [ "x$1" == "x" ]; then PLATFORM="linux"; else PLATFORM=$1; fi
 
+if [ "x$2" == "xkeep" ]; then KEEP="yes"; else KEEP="no"; fi
+
 case $PLATFORM in
 ios)
   FIPS_VERSION=$IOS_FIPS_VERSION
@@ -172,5 +177,7 @@ fi
 
 # Clean up
 popd
-rm -rf $TEST_DIR
-
+if [ "x$KEEP" == "xno" ];
+then
+    rm -rf $TEST_DIR
+fi