ACK: [PATCH 2/2] live-image: add an option for creating oem-tests.lst

Colin Ian King colin.king at canonical.com
Tue Feb 25 08:28:03 UTC 2020


On 05/02/2020 21:34, Alex Hung wrote:
> This allows users to create oem-tests.lst for automating
> tests in fwts-live, and thus removes needs users to modify fwts-live
> images or partitions manually.
> 
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
>  live-image/fwts-frontend-text | 74 +++++++++++++++++++++++++++++++++++
>  1 file changed, 74 insertions(+)
> 
> diff --git a/live-image/fwts-frontend-text b/live-image/fwts-frontend-text
> index 7b16b981..7fe4533f 100755
> --- a/live-image/fwts-frontend-text
> +++ b/live-image/fwts-frontend-text
> @@ -154,6 +154,76 @@ select_tests()
>  	done
>  }
>  
> +#
> +#  Get user choices to create oem-tests.lst
> +#
> +select_oem_automation()
> +{
> +	while true
> +	do
> +		declare -a tests
> +		x=0
> +		#
> +		#  Discover available tests
> +		#
> +		fwts --batch --batch-experimental --uefitests --unsafe --show-tests | grep "^ "| sort | uniq > $OPTIONS
> +		while read test text
> +		do
> +			((x++))
> +			tests[$x]=$test
> +			txt="${txt} ${x} \"${text}\" off"
> +		done < $OPTIONS
> +		rm $OPTIONS
> +
> +		#
> +		# Construct and run dialog
> +		#
> +		echo dialog --backtitle '"$FWTS"' --title '"Select Tests for Automation"' --help-button  --checklist '"Select from the list below the test(s) for oem-tests.lst. Use up/down cursor keys, space to select and enter to start:"' 20 70 $x $txt > $DIALOG_CMD
> +		. $DIALOG_CMD 2> $OPTIONS
> +		ret=$?
> +		rm $DIALOG_CMD
> +
> +		#
> +		# Scan return selections and build fwts test scenarios
> +		#
> +		x=0
> +		for i in `cat $OPTIONS`
> +		do
> +			((x++))
> +			i=${i#\"}
> +			i=${i%\"}
> +			run_tests="$run_tests ${tests[$i]}"
> +		done
> +
> +		#
> +		# Handle dialog exit states:
> +		#
> +		case $ret in
> +		0)
> +			if [ $x -eq 0 ]; then
> +				dialog --backtitle "$FWTS" --title "No Tests Selected!" --msgbox \
> +			"   You did not select any tests to be run." 5 50
> +			else
> +				# remove leading space and output to oem-tests.lst
> +				echo "TESTS=$(echo $run_tests)" > $OEM_TESTS_FILE
> +				echo "POST=poweroff" >> $OEM_TESTS_FILE
> +				dialog --backtitle "$FWTS" --title "Auto-tests Saved!" --msgbox \
> +					" Auto-tests are saved to $OEM_TESTS_FILE" 5 50
> +				finish
> +			fi
> +			;;
> +		1)
> +			return
> +			;;
> +		2)
> +			do_help
> +			;;
> +		255)
> +			no_tests_finish
> +			;;
> +		esac
> +	done
> +}
>  #
>  #  View the results log
>  #
> @@ -314,6 +384,7 @@ do
>  			"Recommended" "Recommended Tests" off \
>  			"Recommended for IFV" "Recommended Tests for F/W Vendors" off \
>  			"Selected" "Select Individual Tests" off \
> +			"Automated" "Create Auto-Tests" off \
>  			"Abort" "Abort Testing" off \
>  			2> $OPTIONS
>  			;;
> @@ -369,6 +440,9 @@ do
>  		'Selected')
>  			select_tests
>  			;;
> +		'Automated')
> +			select_oem_automation
> +			;;
>  		'Abort')
>  			no_tests_finish
>  			;;
> 
Acked-by: Colin Ian King <colin.king at canonical.com>



More information about the fwts-devel mailing list