diff mbox

[1/2] boot-test: Add -k and -K options to keep logs on fail or always

Message ID 1470712821-24994-1-git-send-email-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Aug. 9, 2016, 3:20 a.m. UTC
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 external/boot-tests/boot_test.sh | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Comments

Stewart Smith Aug. 9, 2016, 7:34 a.m. UTC | #1
Stewart Smith <stewart@linux.vnet.ibm.com> writes:
> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
> ---
>  external/boot-tests/boot_test.sh | 23 ++++++++++++++++++++---
>  1 file changed, 20 insertions(+), 3 deletions(-)

Series merged to master as of 3abf093bb02ac8f580cb555e1f0867f190bfa54a
diff mbox

Patch

diff --git a/external/boot-tests/boot_test.sh b/external/boot-tests/boot_test.sh
index 40fc954..ed42007 100755
--- a/external/boot-tests/boot_test.sh
+++ b/external/boot-tests/boot_test.sh
@@ -70,10 +70,14 @@  EOF
 	        msg "Waiting for linux has timed out"
 		msg "Boot log follows:"
 		cat $LINUXBOOT_LOG
-		rm -f $LINUXBOOT_LOG
+		if [ $keep_log_failure -eq 0 ]; then
+		    rm -f $LINUXBOOT_LOG
+		fi
 		return 1
 	else
-	        rm -f $LINUXBOOT_LOG
+	        if [ $keep_log_success -eq 0 ]; then
+	            rm -f $LINUXBOOT_LOG
+	        fi
 	        return 0
 	fi
 }
@@ -156,6 +160,10 @@  Common Options:
      successful booting into Petitboot will not be detected with this option.
 
   -b BMC type (bmc or fsp).
+
+  -k keep logs on failure.
+
+  -K keep logs on success or failure.
 EOF
     exit 1;
 }
@@ -180,7 +188,9 @@  PNOR=""
 LID[0]=""
 LID[1]=""
 LID[2]=""
-while getopts "hvdpB1:2:3:P:t:b:" OPT; do
+keep_log_success=0
+keep_log_failure=0
+while getopts "kKhvdpB1:2:3:P:t:b:" OPT; do
     case "$OPT" in
 	v)
 	    V=1;
@@ -191,6 +201,13 @@  while getopts "hvdpB1:2:3:P:t:b:" OPT; do
 	d)
 	    set -vx;
 	    ;;
+	k)
+	    keep_log_failure=1;
+	    ;;
+	K)
+	    keep_log_failure=1;
+	    keep_log_success=1;
+	    ;;
 	B)
 	    bootonly=1;
 	    if [ $firmware_supplied -eq 1 ]; then