Improve the output format of the testrunner (#2438)

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
This commit is contained in:
Peter Marki
2018-08-08 16:33:02 +02:00
committed by yichoi
parent 1ac2903d3c
commit 47087dec56
4 changed files with 58 additions and 21 deletions
+21 -8
View File
@@ -37,6 +37,10 @@ TEST_FILES=$OUTPUT_DIR/$TESTS_BASENAME.files
TEST_FAILED=$OUTPUT_DIR/$TESTS_BASENAME.failed
TEST_PASSED=$OUTPUT_DIR/$TESTS_BASENAME.passed
TERM_NORMAL="\033[0m"
TERM_RED="\033[1;31m"
TERM_GREEN="\033[1;32m"
VERBOSE=1
if [[ "$1" == "-q" ]]
then
@@ -148,29 +152,29 @@ do
# Testing snapshot
SNAPSHOT_TEMP=`mktemp $(basename -s .js $test).snapshot.XXXXXXXXXX`
cmd_line="$RUNTIME ${SNAPSHOT_TOOL#$ROOT_DIR} generate -o $SNAPSHOT_TEMP ${full_test#$ROOT_DIR}"
$TIMEOUT_CMD $TIMEOUT $RUNTIME $SNAPSHOT_TOOL generate -o $SNAPSHOT_TEMP $full_test &> $ENGINE_TEMP
status_code=$?
comment=" (generate snapshot)"
if [ $status_code -eq 0 ]
then
test $VERBOSE && echo "[$tested/$TOTAL] $cmd_line: PASS"
test $VERBOSE && printf "[%4d/%4d] %bPASS: %s%s%b\n" "$tested" "$TOTAL" "$TERM_GREEN" "${full_test#$ROOT_DIR}" "$comment" "$TERM_NORMAL"
cmd_line="$RUNTIME ${ENGINE#$ROOT_DIR} $ENGINE_ARGS --exec-snapshot $SNAPSHOT_TEMP"
$TIMEOUT_CMD $TIMEOUT $RUNTIME $ENGINE $ENGINE_ARGS --exec-snapshot $SNAPSHOT_TEMP &> $ENGINE_TEMP
status_code=$?
comment=" (execute snapshot)"
fi
rm -f $SNAPSHOT_TEMP
else
cmd_line="$RUNTIME ${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${full_test#$ROOT_DIR}"
$TIMEOUT_CMD $TIMEOUT $RUNTIME $ENGINE $ENGINE_ARGS $full_test &> $ENGINE_TEMP
status_code=$?
comment=""
fi
if [ $status_code -ne $error_code ]
then
echo "[$tested/$TOTAL] $cmd_line: FAIL ($status_code)"
printf "[%4d/%4d] %bFAIL (%d): %s%s%b\n" "$tested" "$TOTAL" "$TERM_RED" "$status_code" "${full_test#$ROOT_DIR}" "$comment" "$TERM_NORMAL"
cat $ENGINE_TEMP
echo "$status_code: $test" >> $TEST_FAILED
@@ -182,8 +186,7 @@ do
failed=$((failed+1))
else
test $VERBOSE && echo "[$tested/$TOTAL] $cmd_line: $PASS"
test $VERBOSE && printf "[%4d/%4d] %b%s: %s%s%b\n" "$tested" "$TOTAL" "$TERM_GREEN" "$PASS" "${full_test#$ROOT_DIR}" "$comment" "$TERM_NORMAL"
echo "$test" >> $TEST_PASSED
passed=$((passed+1))
@@ -195,13 +198,23 @@ done
rm -f $ENGINE_TEMP
ratio=$(echo $passed*100/$TOTAL | bc)
if [ $passed -eq $TOTAL ]
then
success_color=$TERM_GREEN
else
success_color=$TERM_RED
fi
if [ "$IS_SNAPSHOT" == true ]
then
ENGINE_ARGS="--snapshot $ENGINE_ARGS"
fi
echo "[summary] ${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${TESTS#$ROOT_DIR}: $passed PASS, $failed FAIL, $TOTAL total, $ratio% success"
echo -e "\n[summary] ${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${TESTS#$ROOT_DIR}\n"
echo -e "TOTAL: $TOTAL"
echo -e "${TERM_GREEN}PASS: $passed${TERM_NORMAL}"
echo -e "${TERM_RED}FAIL: $failed${TERM_NORMAL}\n"
echo -e "${success_color}Success: $ratio%${TERM_NORMAL}\n"
if [ $failed -ne 0 ]
then