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
+14 -7
View File
@@ -196,6 +196,13 @@ def get_arguments():
BINARY_CACHE = {}
TERM_NORMAL = '\033[0m'
TERM_BLUE = '\033[1;34m'
def report_command(cmd_type, cmd):
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, cmd_type, TERM_NORMAL))
sys.stderr.write('%s%s%s\n' % (TERM_BLUE, (' \\%s\n\t%s' % (TERM_NORMAL, TERM_BLUE)).join(cmd), TERM_NORMAL))
def create_binary(job, options):
build_args = job.build_args[:]
if options.buildoptions:
@@ -214,7 +221,7 @@ def create_binary(job, options):
if options.toolchain:
build_cmd.append('--toolchain=%s' % options.toolchain)
sys.stderr.write('Build command: %s\n' % ' '.join(build_cmd))
report_command('Build command:', build_cmd)
binary_key = tuple(sorted(build_args))
if binary_key in BINARY_CACHE:
@@ -273,7 +280,7 @@ def iterate_test_runner_jobs(jobs, options):
yield job, ret_build, test_cmd
def run_check(runnable):
sys.stderr.write('Test command: %s\n' % ' '.join(runnable))
report_command('Test command:', runnable)
try:
ret = subprocess.check_call(runnable)
@@ -391,11 +398,11 @@ def run_unittests(options):
if ret_build:
break
ret_test |= run_check([
settings.UNITTEST_RUNNER_SCRIPT,
os.path.join(build_dir_path, 'tests'),
"-q" if options.quiet else "",
])
ret_test |= run_check(
[settings.UNITTEST_RUNNER_SCRIPT] +
[os.path.join(build_dir_path, 'tests')] +
(["-q"] if options.quiet else [])
)
return ret_build | ret_test
+6 -2
View File
@@ -19,6 +19,10 @@ DEBUGGER_CLIENT=$2
TEST_CASE=$3
CLIENT_ARGS=""
TERM_NORMAL='\033[0m'
TERM_RED='\033[1;31m'
TERM_GREEN='\033[1;32m'
if [[ $TEST_CASE == *"client_source"* ]]; then
START_DEBUG_SERVER="${JERRY} --start-debug-server --debugger-wait-source &"
if [[ $TEST_CASE == *"client_source_multiple"* ]]; then
@@ -50,9 +54,9 @@ rm -f ${RESULT_TEMP}
if [ ${STATUS_CODE} -ne 0 ]
then
echo "${TEST_CASE} failed"
echo -e "${TERM_RED}FAIL: ${TEST_CASE}${TERM_NORMAL}\n"
else
echo "${TEST_CASE} passed"
echo -e "${TERM_GREEN}PASS: ${TEST_CASE}${TERM_NORMAL}\n"
fi
exit ${STATUS_CODE}
+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
+17 -4
View File
@@ -63,6 +63,10 @@ passed=0
UNITTEST_TEMP=`mktemp unittest-out.XXXXXXXXXX`
TERM_NORMAL="\033[0m"
TERM_RED="\033[1;31m"
TERM_GREEN="\033[1;32m"
for unit_test in $UNITTESTS
do
cmd_line="$RUNTIME ${unit_test#$ROOT_DIR}"
@@ -71,7 +75,7 @@ do
if [ $status_code -ne 0 ]
then
echo "[$tested/$total] $cmd_line: FAIL ($status_code)"
printf "[%4d/%4d] %bFAIL (%d): %s%b\n" "$tested" "$total" "$TERM_RED" "$status_code" "${unit_test#$ROOT_DIR}" "$TERM_NORMAL"
cat $UNITTEST_TEMP
echo "$status_code: $unit_test" >> $UNITTEST_ERROR
@@ -83,8 +87,7 @@ do
failed=$((failed+1))
else
test $VERBOSE && echo "[$tested/$total] $cmd_line: PASS"
test $VERBOSE && printf "[%4d/%4d] %bPASS: %s%b\n" "$tested" "$total" "$TERM_GREEN" "${unit_test#$ROOT_DIR}" "$TERM_NORMAL"
echo "$unit_test" >> $UNITTEST_OK
passed=$((passed+1))
@@ -96,8 +99,18 @@ done
rm -f $UNITTEST_TEMP
ratio=$(echo $passed*100/$total | bc)
if [ $passed -eq $total ]
then
success_color=$TERM_GREEN
else
success_color=$TERM_RED
fi
echo "[summary] ${DIR#$ROOT_DIR}/unit-*: $passed PASS, $failed FAIL, $total total, $ratio% success"
echo -e "\n[summary] ${DIR#$ROOT_DIR}/unit-*\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