Skip to content

Commit 5e644f2

Browse files
update utp tests
1 parent cf870e6 commit 5e644f2

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

.github/actions/scripts/run-utp-tests.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ for raw_test in "${tests[@]}"; do
104104

105105
test_failed=0
106106
message_found=0
107+
utp_error_found=0
107108

108109
if [ -n "$exp_msg" ]; then
109110
while IFS= read -r log_file; do
@@ -117,17 +118,32 @@ for raw_test in "${tests[@]}"; do
117118
done < <(find "$UNITY_PROJECT_PATH/Builds/Logs" -maxdepth 1 -type f -name "*${test_name}*.log")
118119
fi
119120

121+
# Look for error-level UTP entries for this test to treat as expected failure evidence.
122+
while IFS= read -r utp_file; do
123+
if [ -z "$utp_file" ]; then
124+
continue
125+
fi
126+
if node -e "const fs=require('fs');const p=process.argv[1];try{const data=JSON.parse(fs.readFileSync(p,'utf8'));if(Array.isArray(data)&&data.some(e=>['Error','Exception','Assert'].includes(e?.severity))){process.exit(0);} }catch{}process.exit(1);" "$utp_file"; then
127+
utp_error_found=1
128+
break
129+
fi
130+
done < <(find "$UNITY_PROJECT_PATH/Builds/Logs" -maxdepth 1 -type f -name "*${test_name}*-utp-json.log")
131+
120132
if [ "$expected" -eq 0 ]; then
121133
if [ "$validate_rc" -ne 0 ] || [ "$build_rc" -ne 0 ]; then
122134
echo "::error::Test $test_name was expected to succeed but failed (validate_rc=$validate_rc, build_rc=$build_rc)"
123135
test_failed=1
124136
fi
137+
if [ "$utp_error_found" -eq 1 ]; then
138+
echo "::error::Test $test_name produced UTP errors but was expected to succeed"
139+
test_failed=1
140+
fi
125141
if [ -n "$exp_msg" ] && [ "$message_found" -eq 0 ]; then
126142
echo "::error::Test $test_name did not emit expected message '$exp_msg'"
127143
test_failed=1
128144
fi
129145
else
130-
if [ "$validate_rc" -ne 0 ] || [ "$build_rc" -ne 0 ] || [ "$message_found" -eq 1 ]; then
146+
if [ "$validate_rc" -ne 0 ] || [ "$build_rc" -ne 0 ] || [ "$message_found" -eq 1 ] || [ "$utp_error_found" -eq 1 ]; then
131147
: # Expected failure observed
132148
else
133149
echo "::error::Test $test_name was expected to fail but succeeded"

0 commit comments

Comments
 (0)