Make run-tests --jerry-tests --jerry-test-suite work on Windows too (#3260)
Changes: * Bash based runners/run-test-suite.sh runner replaced with a python runner * Common util functions moved to util.py * Fixed EOL issues in tests directory JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
committed by
Dániel Bátyai
parent
525c35f148
commit
44b1b9855d
@@ -21,14 +21,16 @@ import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
TERM_NORMAL = '\033[0m'
|
||||
TERM_RED = '\033[1;31m'
|
||||
TERM_GREEN = '\033[1;32m'
|
||||
import util
|
||||
|
||||
|
||||
def get_arguments():
|
||||
runtime = os.environ.get('RUNTIME')
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-q', '--quiet', action='store_true',
|
||||
help='Only print out failing tests')
|
||||
parser.add_argument('--runtime', metavar='FILE', default=runtime,
|
||||
help='Execution runtime (e.g. qemu)')
|
||||
parser.add_argument('path',
|
||||
help='Path of test binaries')
|
||||
|
||||
@@ -54,39 +56,30 @@ def main(args):
|
||||
print("%s: no unit-* test to execute", args.path)
|
||||
return 1
|
||||
|
||||
test_cmd = [args.runtime] if args.runtime else []
|
||||
|
||||
tested = 0
|
||||
passed = 0
|
||||
failed = 0
|
||||
|
||||
runtime = os.environ.get('RUNTIME')
|
||||
test_cmd = [runtime] if runtime else []
|
||||
|
||||
for test in unittests:
|
||||
tested += 1
|
||||
testpath = os.path.relpath(test)
|
||||
test_path = os.path.relpath(test)
|
||||
try:
|
||||
subprocess.check_output(test_cmd + [test], stderr=subprocess.STDOUT, universal_newlines=True)
|
||||
passed += 1
|
||||
if not args.quiet:
|
||||
print("[%4d/%4d] %sPASS: %s%s" % (tested, total, TERM_GREEN, testpath, TERM_NORMAL))
|
||||
util.print_test_result(tested, total, True, 'PASS', test_path)
|
||||
except subprocess.CalledProcessError as err:
|
||||
failed += 1
|
||||
print("[%4d/%4d] %sFAIL (%d): %s%s" % (tested, total, TERM_RED, err.returncode, testpath, TERM_NORMAL))
|
||||
util.print_test_result(tested, total, False, 'FAIL (%d)' % err.returncode, test_path)
|
||||
print("================================================")
|
||||
print(err.output)
|
||||
print("================================================")
|
||||
|
||||
print("\n[summary] %s\n" % os.path.join(os.path.relpath(args.path), "unit-*"))
|
||||
print("TOTAL: %d" % total)
|
||||
print("%sPASS: %d%s" % (TERM_GREEN, passed, TERM_NORMAL))
|
||||
print("%sFAIL: %d%s\n" % (TERM_RED, failed, TERM_NORMAL))
|
||||
|
||||
success_color = TERM_GREEN if passed == total else TERM_RED
|
||||
print("%sSuccess: %d%%%s" % (success_color, passed*100/total, TERM_NORMAL))
|
||||
util.print_test_summary(os.path.join(os.path.relpath(args.path), "unit-*"), total, passed, failed)
|
||||
|
||||
if failed > 0:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user