-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtcgt
executable file
·77 lines (65 loc) · 2.28 KB
/
tcgt
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
#!/bin/bash
TCG_ROOT="${TCG_ROOT:-"$(readlink -f "$(dirname $0)"/../build/test-tpm2)"}"
last_success='.last_success'
if [ -f "${last_success}" ]; then
skip=1
until="$(cat "${last_success}")"
fi
# List of tests which are known to fail on the simulator (none at this time).
excludes='noncence'
if [ "${1}" == '-h' ]; then
cat <<EOF
This script helps to run TCG compliance test suite tests.
When invoked without command line parameters it discovers the list of
tests available from the suite and starts executing them one by one.
Local file named '.last_success' is used to keep track of tests which
succeeded so far. Each time a test passes, its name is saved in the file.
When this script is restarted, it skips all tests up to the one contained
in ./.last_success. This helps to start running from the spot where the
previous attempt failed. Remove ./.last_success file to have the script to
start over from the first test.
By default, if a test fails, the script re-runs the test, this time
allowing its console output to be visible, then prints out the command
line used to invoke the failing test (so that it can be re-run manually),
and then stops.
If -a is passed as the first command line argument, the script does not
stop at failures and continues to run through the entire set of tests,
reporting their success of failure.
EOF
exit 0
fi
COMPLIANCE="${TCG_ROOT}/install/bin/compliance"
count=0
for t in $("${COMPLIANCE}" --list | awk '/Test / {print $2}'); do
echo -n "$t "
if echo $t | egrep -qv "(${excludes})"; then
count=$(expr $count + 1)
if [ "${skip}" == "1" ]; then
if [ "$t" == "${until}" ]; then
skip=0
fi
echo 'skipped'
continue
fi
if ! "${COMPLIANCE}" -s $t --ntpm localhost:9883 | egrep -q 'Passed Tests:.*1'; then
echo failed
if [ "$1" == "-a" ]; then
count=$(expr $count - 1)
continue
fi
eval "${COMPLIANCE} -s $t --ntpm localhost:9883"
echo
echo $count passed
echo "Ran this to reproduce the failure:"
echo "${COMPLIANCE} -s $t --ntpm localhost:9883"
break
else
echo passed
echo "$t" > "${last_success}"
fi
else
echo 'excluded'
continue
fi
done
echo "${count} tests passed"