38
usage = 'usage %prog [OPTIONS]'
39
parser = OptionParser(usage)
40
parser.add_option('-c','--cpufreq',
39
parser = ArgumentParser(description='Tests the system BIOS using the \
41
group = parser.add_mutually_exclusive_group()
42
group.add_argument('-c', '--cpufreq',
41
43
action='store_true',
42
help='Chose this option to run the CPU Frequency Scaling test only')
43
parser.add_option('-w','--wakealarm',
44
help=('Chose this option to run '
45
'the CPU Frequency Scaling test only'))
46
group.add_argument('-w', '--wakealarm',
44
47
action='store_true',
45
48
help='Run the fwts wakealarm test only')
46
parser.add_option('-a','--all',
49
parser.add_argument('-a', '--all',
47
50
action='store_true',
48
51
help='Run ALL FWTS automated tests (assumes -w and -c)')
49
parser.add_option('-l','--log',
52
parser.add_argument('-l', '--log',
50
53
default='/tmp/fwts_results.log',
51
help='Specify the location and name of the log file. Default log path is %default')
52
(options, args) = parser.parse_args()
54
if options.cpufreq and options.wakealarm:
55
parser.error('cpufreq and wakealarm can not be chosen togehter. Choose -a instead')
54
help=('Specify the location and name of the log file. '
55
'[Default: %(default)s]'))
56
args = parser.parse_args()
62
elif options.wakealarm:
63
tests += ['wakealarm']
65
tests += ['wakealarm','cpufreq'] + TESTS
66
tests.append('cpufreq')
68
tests.append('wakealarm')
70
tests.extend(['wakealarm', 'cpufreq'] + TESTS)
69
74
# run the tests we want
71
command = 'fwts -q --stdout-summary -r %s %s' % (options.log,test)
72
results[test] = Popen(command, stdout=PIPE, shell=True).communicate()[0].strip()
76
command = ('fwts -q --stdout-summary -r %s %s'
78
results[test] = (Popen(command, stdout=PIPE, shell=True)
79
.communicate()[0].strip()).decode()
74
81
# parse the summaries
78
if results[test] == 'FAILED_CRITICAL' or \
79
results[test] == 'FAILED_HIGH':
85
if results[test] == 'FAILED_CRITICAL':
86
critical_fails.append(test)
87
elif results[test] == 'FAILED_HIGH':
88
high_fails.append(test)
89
elif results[test] == 'FAILED_MEDIUM':
90
medium_fails.append(test)
91
elif results[test] == 'FAILED_LOW':
92
low_fails.append(test)
81
93
elif results[test] == 'PASSED':
99
print("Critical Failures: %d" % len(critical_fails))
100
for test in critical_fails: print(" - " + test)
102
print("High Failures: %d" % len(high_fails))
103
for test in high_fails: print(" - " + test)
105
print("Medium Failures: %d" % len(medium_fails))
106
for test in medium_fails: print(" - " + test)
108
print("Low Failures: %d" % len(low_fails))
109
for test in low_fails: print(" - " + test)
110
print("Passed: %d" % passed)
112
if critical_fails or high_fails: