Add flexibility to nexus test logs

* Print UART logs even when the timeout is hit
* Configurable timeout value
* Configurable polling interval for the "PASS!" check

Change-Id: I2a405f2c3f09f0b76823f25e2501e2b52add770d
diff --git a/nexus-non-interactive-test.sh b/nexus-non-interactive-test.sh
index 3252393..f704b2e 100755
--- a/nexus-non-interactive-test.sh
+++ b/nexus-non-interactive-test.sh
@@ -22,6 +22,8 @@
 NEXUS_ID="${NEXUS_ID:-$3}"
 DEFAULT_NEXUS_FLASH_PATH="${ROOTDIR}/internal/nexus_usage/nexus_flash.sh"
 NEXUS_FLASH_PATH="${NEXUS_FLASH_PATH:-$DEFAULT_NEXUS_FLASH_PATH}"
+export LOG_TIMEOUT="${LOG_TIMEOUT:-900}"
+export LOG_CHECK_INTERVAL="${LOG_CHECK_INTERVAL:-30}"
 
 if [ $# -lt 2 ] || [ $# -gt 3 ] ; then
 cat << EOF
@@ -93,10 +95,11 @@
     "${NEXUS_FLASH_PATH}" "${BINARY_PATH}"
 fi
 
-timeout 300 bash -c 'until grep -q PASS! uart.sc.log ; do
-                        echo "Expected log is missing. Wait up to 300s."
-                        sleep 10
-                    done'
+timeout "${LOG_TIMEOUT}" bash -c '
+    until grep -q PASS! uart.sc.log ; do
+        echo "Expected log is missing. Wait up to ${LOG_TIMEOUT}s."
+        sleep "${LOG_CHECK_INTERVAL}"
+    done' || echo "Time out waiting for PASS! log"
 
 cat -n uart.sc.log
 cat -n uart.smc.log