54
54
# constants
55
55
PATH_UNITTESTS = "graalpython/lib-python/3/test/"
56
56
57
- CSV_RESULTS_NAME = "unittests.csv"
58
- HTML_RESULTS_NAME = "unittests.html"
57
+ _BASE_NAME = "unittests"
58
+ TXT_RESULTS_NAME = "{}.txt" .format (_BASE_NAME )
59
+ CSV_RESULTS_NAME = "{}.csv" .format (_BASE_NAME )
60
+ HTML_RESULTS_NAME = "{}.html" .format (_BASE_NAME )
61
+
59
62
60
63
PTRN_ERROR = re .compile (r'^(?P<error>[A-Z][a-z][a-zA-Z]+):(?P<message>.*)$' )
61
64
PTRN_UNITTEST = re .compile (r'^#### running: graalpython/lib-python/3/test/(?P<unittest>.*)$' )
@@ -117,7 +120,7 @@ def scp(results_file_path, destination_path, destination_name=None):
117
120
118
121
119
122
def _run_unittest (test_path ):
120
- cmd = ["mx" , "python3" , "--python.CatchAllExceptions=true" , test_path ]
123
+ cmd = ["mx" , "python3" , "--python.CatchAllExceptions=true" , test_path , "-v" ]
121
124
success , output = _run_cmd (cmd )
122
125
output = '''
123
126
##############################################################
@@ -278,6 +281,13 @@ class Stat(object):
278
281
TEST_PERCENT_PASS = "test_percent_pass" # percentage of tests which pass from all running tests (all unittests)
279
282
280
283
284
+ def save_as_txt (report_path , results ):
285
+ with open (report_path , 'w' ) as TXT :
286
+ output = '\n ' .join (results )
287
+ TXT .write (output )
288
+ return output
289
+
290
+
281
291
def save_as_csv (report_path , unittests , error_messages , stats , current_date ):
282
292
rows = []
283
293
with open (report_path , 'w' ) as CSV :
@@ -595,7 +605,10 @@ def _fmt(t):
595
605
unittests = get_unittests (flags .tests_path , limit = flags .limit )
596
606
597
607
results = run_unittests (unittests )
598
- unittests , error_messages , stats = process_output ('\n ' .join (results ))
608
+ txt_report_path = file_name (TXT_RESULTS_NAME , current_date )
609
+ output = save_as_txt (txt_report_path , results )
610
+
611
+ unittests , error_messages , stats = process_output (output )
599
612
600
613
csv_report_path = file_name (CSV_RESULTS_NAME , current_date )
601
614
rows , totals = save_as_csv (csv_report_path , unittests , error_messages , stats , current_date )
@@ -608,6 +621,7 @@ def _fmt(t):
608
621
609
622
if flags .path :
610
623
log ("[SAVE] saving results to {} ... " , flags .path )
624
+ scp (txt_report_path , flags .path )
611
625
scp (csv_report_path , flags .path )
612
626
scp (html_report_path , flags .path )
613
627
0 commit comments