Skip to content

Commit 846a918

Browse files
Record build steps in the outcome file
Add an outcome line when all.sh calls make. Signed-off-by: Gilles Peskine <[email protected]>
1 parent d8ae3d4 commit 846a918

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed

tests/scripts/quiet/make

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,55 @@ NO_SILENCE=" --version | test "
1717
TOOL="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

tests/scripts/quiet/quiet.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fi
5959

6060
if [[ " $@ " =~ $NO_SILENCE || -n "${VERBOSE_LOGS}" ]]; then
6161
# Run original command with no output supression
62-
exec "${ORIGINAL_TOOL}" "$@"
62+
"${ORIGINAL_TOOL}" "$@"
6363
else
6464
# Run original command and capture output & exit status
6565
TMPFILE=$(mktemp "quiet-${TOOL}.XXXXXX")
@@ -75,5 +75,6 @@ else
7575
rm "${TMPFILE}"
7676

7777
# Propagate the exit status
78-
exit $EXIT_STATUS
78+
set_status () { return $1; }
79+
set_status $EXIT_STATUS
7980
fi

0 commit comments

Comments
 (0)