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:
+14
-7
@@ -196,6 +196,13 @@ def get_arguments():
|
|||||||
|
|
||||||
BINARY_CACHE = {}
|
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):
|
def create_binary(job, options):
|
||||||
build_args = job.build_args[:]
|
build_args = job.build_args[:]
|
||||||
if options.buildoptions:
|
if options.buildoptions:
|
||||||
@@ -214,7 +221,7 @@ def create_binary(job, options):
|
|||||||
if options.toolchain:
|
if options.toolchain:
|
||||||
build_cmd.append('--toolchain=%s' % 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))
|
binary_key = tuple(sorted(build_args))
|
||||||
if binary_key in BINARY_CACHE:
|
if binary_key in BINARY_CACHE:
|
||||||
@@ -273,7 +280,7 @@ def iterate_test_runner_jobs(jobs, options):
|
|||||||
yield job, ret_build, test_cmd
|
yield job, ret_build, test_cmd
|
||||||
|
|
||||||
def run_check(runnable):
|
def run_check(runnable):
|
||||||
sys.stderr.write('Test command: %s\n' % ' '.join(runnable))
|
report_command('Test command:', runnable)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ret = subprocess.check_call(runnable)
|
ret = subprocess.check_call(runnable)
|
||||||
@@ -391,11 +398,11 @@ def run_unittests(options):
|
|||||||
if ret_build:
|
if ret_build:
|
||||||
break
|
break
|
||||||
|
|
||||||
ret_test |= run_check([
|
ret_test |= run_check(
|
||||||
settings.UNITTEST_RUNNER_SCRIPT,
|
[settings.UNITTEST_RUNNER_SCRIPT] +
|
||||||
os.path.join(build_dir_path, 'tests'),
|
[os.path.join(build_dir_path, 'tests')] +
|
||||||
"-q" if options.quiet else "",
|
(["-q"] if options.quiet else [])
|
||||||
])
|
)
|
||||||
|
|
||||||
return ret_build | ret_test
|
return ret_build | ret_test
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ DEBUGGER_CLIENT=$2
|
|||||||
TEST_CASE=$3
|
TEST_CASE=$3
|
||||||
CLIENT_ARGS=""
|
CLIENT_ARGS=""
|
||||||
|
|
||||||
|
TERM_NORMAL='\033[0m'
|
||||||
|
TERM_RED='\033[1;31m'
|
||||||
|
TERM_GREEN='\033[1;32m'
|
||||||
|
|
||||||
if [[ $TEST_CASE == *"client_source"* ]]; then
|
if [[ $TEST_CASE == *"client_source"* ]]; then
|
||||||
START_DEBUG_SERVER="${JERRY} --start-debug-server --debugger-wait-source &"
|
START_DEBUG_SERVER="${JERRY} --start-debug-server --debugger-wait-source &"
|
||||||
if [[ $TEST_CASE == *"client_source_multiple"* ]]; then
|
if [[ $TEST_CASE == *"client_source_multiple"* ]]; then
|
||||||
@@ -50,9 +54,9 @@ rm -f ${RESULT_TEMP}
|
|||||||
|
|
||||||
if [ ${STATUS_CODE} -ne 0 ]
|
if [ ${STATUS_CODE} -ne 0 ]
|
||||||
then
|
then
|
||||||
echo "${TEST_CASE} failed"
|
echo -e "${TERM_RED}FAIL: ${TEST_CASE}${TERM_NORMAL}\n"
|
||||||
else
|
else
|
||||||
echo "${TEST_CASE} passed"
|
echo -e "${TERM_GREEN}PASS: ${TEST_CASE}${TERM_NORMAL}\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit ${STATUS_CODE}
|
exit ${STATUS_CODE}
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ TEST_FILES=$OUTPUT_DIR/$TESTS_BASENAME.files
|
|||||||
TEST_FAILED=$OUTPUT_DIR/$TESTS_BASENAME.failed
|
TEST_FAILED=$OUTPUT_DIR/$TESTS_BASENAME.failed
|
||||||
TEST_PASSED=$OUTPUT_DIR/$TESTS_BASENAME.passed
|
TEST_PASSED=$OUTPUT_DIR/$TESTS_BASENAME.passed
|
||||||
|
|
||||||
|
TERM_NORMAL="\033[0m"
|
||||||
|
TERM_RED="\033[1;31m"
|
||||||
|
TERM_GREEN="\033[1;32m"
|
||||||
|
|
||||||
VERBOSE=1
|
VERBOSE=1
|
||||||
if [[ "$1" == "-q" ]]
|
if [[ "$1" == "-q" ]]
|
||||||
then
|
then
|
||||||
@@ -148,29 +152,29 @@ do
|
|||||||
# Testing snapshot
|
# Testing snapshot
|
||||||
SNAPSHOT_TEMP=`mktemp $(basename -s .js $test).snapshot.XXXXXXXXXX`
|
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
|
$TIMEOUT_CMD $TIMEOUT $RUNTIME $SNAPSHOT_TOOL generate -o $SNAPSHOT_TEMP $full_test &> $ENGINE_TEMP
|
||||||
status_code=$?
|
status_code=$?
|
||||||
|
comment=" (generate snapshot)"
|
||||||
|
|
||||||
if [ $status_code -eq 0 ]
|
if [ $status_code -eq 0 ]
|
||||||
then
|
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
|
$TIMEOUT_CMD $TIMEOUT $RUNTIME $ENGINE $ENGINE_ARGS --exec-snapshot $SNAPSHOT_TEMP &> $ENGINE_TEMP
|
||||||
status_code=$?
|
status_code=$?
|
||||||
|
comment=" (execute snapshot)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $SNAPSHOT_TEMP
|
rm -f $SNAPSHOT_TEMP
|
||||||
else
|
else
|
||||||
cmd_line="$RUNTIME ${ENGINE#$ROOT_DIR} $ENGINE_ARGS ${full_test#$ROOT_DIR}"
|
|
||||||
$TIMEOUT_CMD $TIMEOUT $RUNTIME $ENGINE $ENGINE_ARGS $full_test &> $ENGINE_TEMP
|
$TIMEOUT_CMD $TIMEOUT $RUNTIME $ENGINE $ENGINE_ARGS $full_test &> $ENGINE_TEMP
|
||||||
status_code=$?
|
status_code=$?
|
||||||
|
comment=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $status_code -ne $error_code ]
|
if [ $status_code -ne $error_code ]
|
||||||
then
|
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
|
cat $ENGINE_TEMP
|
||||||
|
|
||||||
echo "$status_code: $test" >> $TEST_FAILED
|
echo "$status_code: $test" >> $TEST_FAILED
|
||||||
@@ -182,8 +186,7 @@ do
|
|||||||
|
|
||||||
failed=$((failed+1))
|
failed=$((failed+1))
|
||||||
else
|
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
|
echo "$test" >> $TEST_PASSED
|
||||||
|
|
||||||
passed=$((passed+1))
|
passed=$((passed+1))
|
||||||
@@ -195,13 +198,23 @@ done
|
|||||||
rm -f $ENGINE_TEMP
|
rm -f $ENGINE_TEMP
|
||||||
|
|
||||||
ratio=$(echo $passed*100/$TOTAL | bc)
|
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 ]
|
if [ "$IS_SNAPSHOT" == true ]
|
||||||
then
|
then
|
||||||
ENGINE_ARGS="--snapshot $ENGINE_ARGS"
|
ENGINE_ARGS="--snapshot $ENGINE_ARGS"
|
||||||
fi
|
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 ]
|
if [ $failed -ne 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -63,6 +63,10 @@ passed=0
|
|||||||
|
|
||||||
UNITTEST_TEMP=`mktemp unittest-out.XXXXXXXXXX`
|
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
|
for unit_test in $UNITTESTS
|
||||||
do
|
do
|
||||||
cmd_line="$RUNTIME ${unit_test#$ROOT_DIR}"
|
cmd_line="$RUNTIME ${unit_test#$ROOT_DIR}"
|
||||||
@@ -71,7 +75,7 @@ do
|
|||||||
|
|
||||||
if [ $status_code -ne 0 ]
|
if [ $status_code -ne 0 ]
|
||||||
then
|
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
|
cat $UNITTEST_TEMP
|
||||||
|
|
||||||
echo "$status_code: $unit_test" >> $UNITTEST_ERROR
|
echo "$status_code: $unit_test" >> $UNITTEST_ERROR
|
||||||
@@ -83,8 +87,7 @@ do
|
|||||||
|
|
||||||
failed=$((failed+1))
|
failed=$((failed+1))
|
||||||
else
|
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
|
echo "$unit_test" >> $UNITTEST_OK
|
||||||
|
|
||||||
passed=$((passed+1))
|
passed=$((passed+1))
|
||||||
@@ -96,8 +99,18 @@ done
|
|||||||
rm -f $UNITTEST_TEMP
|
rm -f $UNITTEST_TEMP
|
||||||
|
|
||||||
ratio=$(echo $passed*100/$total | bc)
|
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 ]
|
if [ $failed -ne 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
Reference in New Issue
Block a user