@@ -17,3 +17,55 @@ NO_SILENCE=" --version | test "
1717TOOL=" make"
1818
1919. " $( dirname " $0 " ) /quiet.sh"
20+ EXIT_STATUS=$?
21+
22+ if [ -n " ${MBEDTLS_TEST_OUTCOME_FILE} " ] &&
23+ [ -n " ${MBEDTLS_TEST_CONFIGURATION} " ]; then
24+ targets=
25+ skip=
26+ for arg in " $@ " ; do
27+ if [ -n " $skip " ]; then
28+ skip=
29+ continue
30+ fi
31+ case $arg in
32+ --assume-new|--assume-old|--directory|--file| \
33+ --include-dir|--makefile|--new-file|--old-file|--what-if| \
34+ -C|-I|-W|-f|-k|-o) # Option with separate argument
35+ skip=1; continue ;;
36+ -* ) continue ;; # Option
37+ * =* ) continue ;; # Variable assignment
38+ * [!-+./0-9@A-Z_a-z]* ) # Target with problematic character
39+ targets=" $targets ${arg%% [!-+./0-9@A-Z_a-z]* } ..." ;;
40+ * ) # Normal target
41+ targets=" $targets $arg " ;;
42+ esac
43+ done
44+ if [ -n " $targets " ]; then
45+ targets=${targets# }
46+ else
47+ targets=all
48+ fi
49+
50+ # We have a single pass/fail status. This is not accurate when there are
51+ # multiple targets: it's possible that some passed and some failed.
52+ # To figure out which targets passed when the overall result is a failure,
53+ # we'd have to do some complex parsing of logs.
54+ if [ $EXIT_STATUS -eq 0 ]; then
55+ result=PASS
56+ else
57+ result=FAIL
58+ fi
59+ cause= # Identifying failure causes wuld be nice, but difficult
60+
61+ for target in $targets ; do
62+ if [ " $target " = " clean" ]; then
63+ # Boring
64+ continue
65+ fi
66+ echo >> " ${MBEDTLS_TEST_OUTCOME_FILE} " \
67+ " ${MBEDTLS_TEST_PLATFORM} ;${MBEDTLS_TEST_CONFIGURATION} ;${TOOL} ;${target} ;${result} ;${cause} "
68+ done
69+ fi
70+
71+ exit $EXIT_STATUS
0 commit comments