live-image: overwrite pre-defined tests by oem-tests.lst
diff mbox series

Message ID 20191021051833.15743-1-alex.hung@canonical.com
State Accepted
Headers show
Series
  • live-image: overwrite pre-defined tests by oem-tests.lst
Related show

Commit Message

Alex Hung Oct. 21, 2019, 5:18 a.m. UTC
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@canonical.com>
---
 live-image/fwts-frontend-text | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

ivanhu Oct. 29, 2019, 7:50 a.m. UTC | #1
On 10/21/19 1:18 PM, Alex Hung wrote:
> 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@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 \


Acked-by: Ivan Hu <ivan.hu@canonical.com>
Colin King Nov. 6, 2019, 10:48 a.m. UTC | #2
On 21/10/2019 06:18, Alex Hung wrote:
> 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@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 \
> 

Nice.

Acked-by: Colin Ian King <colin.king@canonical.com>

Patch
diff mbox series

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 \