1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00
serenity/Libraries/LibJS/Tests/run-tests
Andreas Kling 69566bd4d6 LibJS: Allow passing "js" flags to run-tests
This allows us to run "run-tests -g" for testing with GC after every
heap allocation. This may flush out bugs that would otherwise not
occur if GC'ing only occasionally.
2020-04-19 17:34:33 +02:00

45 lines
937 B
Bash
Executable file

#!/bin/bash
if [ "`uname`" = "SerenityOS" ]; then
js_program=/bin/js
else
[ -z "$js_program" ] && js_program="$SERENITY_ROOT/Meta/Lagom/build/js"
# Enable back traces if sanitizers are enabled
export UBSAN_OPTIONS=print_stacktrace=1
fi
extra_args="$*"
pass_count=0
fail_count=0
count=0
GLOBIGNORE=test-common.js
for f in *.js; do
result=`$js_program $extra_args -t $f 2>/dev/null`
if [ "$result" = "PASS" ]; then
let pass_count++
echo -ne "( \033[32;1mPass\033[0m ) "
else
echo -ne "( \033[31;1mFail\033[0m ) "
let fail_count++
fi
echo $f
let count++
done
pass_color=""
fail_color=""
color_off="\033[0m"
if [ $pass_count -gt 0 ]; then
pass_color="\033[32;1m"
fi
if [ $fail_count -gt 0 ]; then
fail_color="\033[31;1m"
fi
echo
echo -e "Ran $count tests. Passed: ${pass_color}${pass_count}${color_off}, Failed: ${fail_color}${fail_count}${color_off}"