This file is indexed.

/usr/bin/fwts-frontend-text is in fwts-frontend 16.03.00-0ubuntu1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
#!/bin/bash
#
# Copyright (C) 2010-2016 Canonical
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
FWTS="Firmware Test Suite"
OPTIONS="/tmp/options.$$"
DIALOG_CMD="/tmp/fwts.cmd.$$"
export DIALOGRC="/usr/share/fwts/fwts-live-dialogrc"

FWTS_DATE=`date +%d%m%Y`
FWTS_TIME=`date +%H%M`

#
# Check if executed as root or with sudo
#
if [ $EUID -ne 0 ]; then
	echo "`basename $0`: must be executed with sudo"
	exit 1
fi

#
# for debugging, use:
# -  WORK_DIR=./fwts/$FWTS_DATE/$FWTS_TIME
# if booting in fwts-live
# - change FWTS_AUTO_SHUTDOWN= to alter default shutdown after testing completion
#
WORK_DIR=/fwts/$FWTS_DATE/$FWTS_TIME
FWTS_AUTO_SHUTDOWN="$1"
SHUTDOWN_AT_END=1

#
# set WORK_DIR to /cdrom/fwts if booting via casper 
#
if [ `grep -qs boot=casper /proc/cmdline; echo $?` -eq 0 ]; then
	CASPER_DETECTED=1
	WORK_DIR=/cdrom/fwts/$FWTS_DATE/$FWTS_TIME
fi

#
# check /proc/cmdline and argv[1] for FWTS_AUTO_SHUTDOWN to toggle auto shutdown
#
if [ `grep -qs FWTS_AUTO_SHUTDOWN=1 /proc/cmdline; echo $?` -ne 0 ]; then
	if [ -n "${CASPER_DETECTED:+x}" ]; then
		SHUTDOWN_AT_END=0
	elif [ -n "${FWTS_AUTO_SHUTDOWN:+x}" ]; then
		SHUTDOWN_AT_END=0
	fi
fi

do_help()
{
	dialog  --backtitle "$FWTS" --title "Help" --msgbox \
		"To make selections from the menu use the following keys:\n\nUse the up/down cursor keys to navigate to the desired menu option and the <Space> bar to tick the menu selection.\n\nUse the left/right or tab keys to navigate the button options and press the <Enter> key to select." 13 60
}

#
#  Run a bunch of tests and monitor progress
#
do_test()
{
	
	num_tests=`fwts $1 --show-tests | wc -l`
	num_tests=$((num_tests - 1))
	if [ $num_tests -gt 0 ]; then
  		fwts --force-clean --skip-test=s3,s4 $1 --show-progress-dialog --log-type plaintext,html | dialog --backtitle "$FWTS" --title "$2" --gauge "" 13 80 0
	fi
}

#
#  Get user choice of tests to run
#
select_tests()
{
	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 to Run"' --help-button  --checklist '"Select from the list below the test(s) you want to run. 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
  				fwts --force-clean $run_tests --show-progress-dialog --log-type plaintext,html | dialog  --backtitle "$FWTS" --title "$2" --gauge "" 15 80 0
				done_tests_finish
			fi
			;;
		1)
			return
			;;
		2)
			do_help
			;;
		255)
			no_tests_finish
			;;
		esac
	done
}

#
#  View the results log
#
view_results()
{	
	tempfile=/tmp/view_results.tmp.$$
	dialog --print-maxsize 2>| $tempfile
	term_height=`sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\1/p" $tempfile 2> /dev/null`
	term_width=` sed -n "s/^MaxSize: \([0-9]*\), \([0-9]*\)$/\2/p" $tempfile 2> /dev/null`
	term_height=$((term_height))
	term_width=$((term_width - 2))
	rm $tempfile

	dialog --backtitle "$FWTS" --title "Test Results" \
		--textbox results.log \
		$term_height $term_width
}

#
#  Shutdown or exit
#
finish()
{
	if [ $SHUTDOWN_AT_END -eq 1 ]; then
		dialog  --backtitle "$FWTS" --infobox "      Shutting down.." 3 30
  		shutdown -P now
		exit 0
	else
		dialog --clear
		exit 0
	fi
}

#
#  Aborted, no tests run
#
no_tests_finish()
{
	dialog --backtitle "$FWTS" --title "Abort Testing!" --msgbox \
		"   You did not select any tests to be run.\n\n          Press Enter to shutdown." 7 50
	finish
}

#
#  Finish after running some tests
#
done_tests_finish()
{
	#
	# Dump out firmware and system data, LP: #1322543
	#
	cd $WORK_DIR
	fwts --dump > /dev/null

	dialog  --backtitle "$FWTS" --title "Testing Complete" --yesno \
"The results can be found on the USB stick in the\n
the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n
     Do you want to view the results log now?" 9 55
	case $? in
	0)
		view_results
		;;
	1|255)
		;;
	esac

	dialog  --backtitle "$FWTS" --title "Testing Complete" --msgbox \
"The results can be found on the USB stick in the\n
the directory: /fwts/$FWTS_DATE/$FWTS_TIME/results.log\n\n
            Press Enter to shutdown" 9 55
	finish
}

#
#  Here we go..
#
mkdir -p $WORK_DIR >& /dev/null
if [ $? -ne 0 ]; then
	dialog --ok-label "Shutdown" --backtitle "$FWTS" --title "Error" --msgbox "Could not create directory fwts/$FWTS_DATE/$FWTS_TIME to store test results.\n\n          Press Enter to shutdown." 8 50 
	finish
	exit 0
fi

while true
do
	dialog --help-button --backtitle "$FWTS" --title "Select Tests" --radiolist \
  		"This will run a suite of firmware tests that will check the BIOS and ACPI tables. It can also find issues that can cause Linux problems.\n\n\
The default below is to run just all the Batch Tests, but you can select more tests below if required.\n\nPlease select below (using cursor up/down and space) and press enter to continue:" \
		22 70 6 \
		1 "All Batch Tests" on \
		2 "ACPI Tests" off \
		3 "UEFI Tests" off \
		4 "Recommended Tests" off \
		5 "Select Individual Tests" off \
		6 "Abort Testing" off \
	2> $OPTIONS

	case $? in
	0)
		cd $WORK_DIR >& /dev/null
		case `cat $OPTIONS` in
		'1')
			do_test "--batch --uefitests" 'Running Batch Tests'
			done_tests_finish
			;;
		'2')
			do_test "--acpitests" 'Running ACPI Tests'
			done_tests_finish
			;;
		'3')
			do_test "--uefitests" 'Running UEFI Tests'
			done_tests_finish
			;;
		'4')
			do_test "version cpufreq maxfreq msr mtrr nx virt aspm dmicheck apicedge klog oops --acpitests --uefitests --log-level=medium" 'Running Recommended Tests'
			done_tests_finish
			;;
		'5')
			select_tests
			;;
		'6')
			no_tests_finish
			;;
		esac
		;;
	2)
		do_help
		;;
	1|255)
		no_tests_finish
		;;
	esac
done