[PATCH] live-image: overwrite pre-defined tests by oem-tests.lst

Alex Hung alex.hung at canonical.com
Mon Oct 21 05:18:33 UTC 2019


This adds a feature to check /fwts/oem-tests.lst and uses its contents as
tests to be run. The oem-tests.lst is to be put to "fwts-result"
partition of the fwts-live USB disk. This allows fwts-live users to
customise fwts-live for their needs without creating special fwts-live
images.

The oem-tests.lst has the following format:

TESTS=list of tests to be executed
POST=poweroff|reboot

For example:
TESTS=mcfg aspm
POST=poweroff

Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 live-image/fwts-frontend-text | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text
index 77cf7fc3..7cada22b 100755
--- a/live-image/fwts-frontend-text
+++ b/live-image/fwts-frontend-text
@@ -249,6 +249,31 @@ the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\nPress Enter to continu
 	finish
 }
 
+#
+#  Check & run OEM customised tests in /fwts/oem-tests.lst
+#
+check_run_oem_tests()
+{
+	if [ -f /fwts/oem-tests.lst ]; then
+		cd $WORK_DIR >& /dev/null
+		OEM_TESTS=$(echo $(grep TESTS /fwts/oem-tests.lst) | cut -d '=' -f 2)
+		do_test "${OEM_TESTS}" 'Running OEM Specified Tests'
+		fwts --dump > /dev/null
+		POST_ACTION=$(echo $(grep POST /fwts/oem-tests.lst) | cut -d '=' -f 2)
+		if [ $POST_ACTION == "poweroff" ]; then
+			dialog --backtitle "$FWTS" --infobox "Shutting down and powering off..." 5 80
+		elif [ $POST_ACTION == "reboot" ]; then
+			dialog --backtitle "$FWTS" --infobox "Restarting system..." 5 80
+		else
+			dialog --backtitle "$FWTS" --infobox "Exiting to terminal..." 5 80
+			POST_ACTION=""
+		fi
+		sleep 2
+		$POST_ACTION
+		exit 0
+	fi
+}
+
 #
 #  Here we go..
 #
@@ -264,6 +289,8 @@ UNAME_PLATFORM=`(uname -m) 2>/dev/null` || UNAME_PLATFORM=unknown
 while true
 do
 
+	check_run_oem_tests
+
 	case "${UNAME_PLATFORM}" in
 		ppc*)
 			dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \
-- 
2.17.1




More information about the fwts-devel mailing list