diff --git a/tools/run-tests.py b/tools/run-tests.py index 5ef8a0f21..c9feb7709 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -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 diff --git a/tools/runners/run-debugger-test.sh b/tools/runners/run-debugger-test.sh index 25fd27678..72da01224 100755 --- a/tools/runners/run-debugger-test.sh +++ b/tools/runners/run-debugger-test.sh @@ -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} diff --git a/tools/runners/run-test-suite.sh b/tools/runners/run-test-suite.sh index 1dbd644c3..9725d3a0f 100755 --- a/tools/runners/run-test-suite.sh +++ b/tools/runners/run-test-suite.sh @@ -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 diff --git a/tools/runners/run-unittests.sh b/tools/runners/run-unittests.sh index 536ef453b..651b1a07d 100755 --- a/tools/runners/run-unittests.sh +++ b/tools/runners/run-unittests.sh @@ -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