This commit is contained in:
Barrett Ruth 2025-08-17 13:00:50 -05:00
parent 78ead22797
commit 59d8a872b6
41 changed files with 1073 additions and 17 deletions

View file

@ -25,5 +25,5 @@ compile_source "$SRC" "$DBG_BIN" "$OUTPUT" @debug_flags.txt
CODE=$?
test $CODE -gt 0 && exit $CODE
execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT"
execute_binary "$DBG_BIN" "$INPUT" "$OUTPUT" true
exit $?

View file

@ -4,9 +4,15 @@ execute_binary() {
binary="$1"
input="$2"
output="$3"
is_debug="$4"
start=$(date '+%s.%N')
timeout 2s ./"$binary" <"$input" >"$output" 2>&1
if [ -n "$is_debug" ]; then
asan="$(ldconfig -p | grep libasan.so | head -n1 | awk '{print $4}')"
LD_PRELOAD="$asan" timeout 2s ./"$binary" <"$input" >"$output" 2>&1
else
timeout 2s ./"$binary" <"$input" >"$output" 2>&1
fi
CODE=$?
end=$(date '+%s.%N')
truncate -s "$(head -n 1000 "$output" | wc -c)" "$output"
@ -30,6 +36,8 @@ execute_binary() {
fi
printf '\n[time]: %s ms' "$(awk "BEGIN {print ($end - $start) * 1000}")" >>$output
test -n "$is_debug" && is_debug_string=true || is_debug_string=false
printf '\n[debug]: %s' "$is_debug_string" >>$output
return $CODE
}