Skip to content

Commit d376938

Browse files
committed
[GR-22987] Put 're' into app scripting category.
PullRequest: graalpython/942
2 parents 65265fb + ae3d698 commit d376938

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

graalpython/com.oracle.graal.python.test/src/python_unittests.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
TXT_RESULTS_NAME = "{}.txt.gz".format(_BASE_NAME)
6666
CSV_RESULTS_NAME = "{}.csv".format(_BASE_NAME)
6767
HTML_RESULTS_NAME = "{}.html".format(_BASE_NAME)
68+
LATEST_HTML_NAME = "latest.html"
6869

6970
HR = "".join(['-' for _ in range(120)])
7071

@@ -83,23 +84,23 @@
8384
PTRN_TEST_STATUS_INDIVIDUAL = re.compile(r"(?P<name>test[\w_]+ \(.+?\)) ... (?P<status>.+)")
8485
PTRN_TEST_STATUS_ERROR = re.compile(r"(?P<status>.+): (?P<name>test[\w_]+ \(.+?\))")
8586

86-
TEST_TYPES = ('array','buffer','code','frame','long','memoryview','unicode','exceptions',
87+
TEST_TYPES = tuple(sorted(('array','buffer','code','frame','long','memoryview','unicode','exceptions',
8788
'baseexception','range','builtin','bytes','thread','property','class','dictviews',
8889
'sys','imp','rlcompleter','types','coroutines','dictcomps','int_literal','mmap',
8990
'module','numeric_tower','syntax','traceback','typechecks','int','keyword','raise',
9091
'descr','generators','list','complex','tuple','enumerate','super','float',
91-
'bool','fstring','dict','iter','string','scope','with','set')
92+
'bool','fstring','dict','iter','string','scope','with','set')))
9293

93-
TEST_APP_SCRIPTING = ('test_json','csv','io','memoryio','bufio','fileio','file','fileinput','tempfile',
94+
TEST_APP_SCRIPTING = tuple(sorted(('test_json','csv','io','memoryio','bufio','fileio','file','fileinput','tempfile',
9495
'pickle','pickletester','pickle','picklebuffer','pickletools','codecs','functools',
95-
'itertools','math','operator','zlib','zipimport_support','zipfile','zipimport',
96-
'zipapp','gzip','bz2','builtin')
96+
'itertools','math','operator','zlib','zipimport_support','zipfile','zipimport','re',
97+
'zipapp','gzip','bz2','builtin')))
9798

98-
TEST_SERVER_SCRIPTING_DS = ('sqlite3','asyncio','marshal','select','crypt','ssl','uuid','multiprocessing',
99+
TEST_SERVER_SCRIPTING_DS = tuple(sorted(('sqlite3','asyncio','marshal','select','crypt','ssl','uuid','multiprocessing',
99100
'fork','forkserver','main_handling','spawn','socket','socket','socketserver',
100101
'signal','mmap','resource','thread','dummy_thread','threading','threading_local',
101-
'threadsignals','dummy_threading','threadedtempfile','thread','hashlib','re',
102-
'pyexpat','locale','_locale','locale','c_locale_coercion','struct') + TEST_APP_SCRIPTING
102+
'threadsignals','dummy_threading','threadedtempfile','thread','hashlib',
103+
'pyexpat','locale','_locale','locale','c_locale_coercion','struct') + TEST_APP_SCRIPTING))
103104

104105

105106
USE_CASE_GROUPS = {
@@ -773,8 +774,8 @@ def format_val(row, k):
773774
var data = tr.data('errors');
774775
if (data) {{
775776
function formatEntry(entry) {{
776-
var description = entry[0][0];
777-
var text = ('' + entry[0][1]).replace(/(.{{195}} )/g, '$1<br/>&nbsp;&nbsp;&nbsp;&nbsp;'); // break long lines
777+
var description = ('' + entry[0][0]).replace(/&/g, "&amp;").replace(/</g, "&lt;");
778+
var text = ('' + entry[0][1]).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/(.{{195}} )/g, '$1<br/>&nbsp;&nbsp;&nbsp;&nbsp;'); // break long lines
778779
var count = (entry[1] > 1 ? ('<font color="red"> (x ' + entry[1] + ')</font>') : '');
779780
return description + ': ' + text + count + '<br/>';
780781
}}
@@ -862,6 +863,15 @@ def format_val(row, k):
862863
with open(report_name, 'w') as HTML:
863864
HTML.write(report)
864865

866+
def generate_latest(output_name, html_report_path):
867+
contents = '''
868+
<html>
869+
<head><style type="text/css"> body { margin:0; overflow:hidden; } #fr { height:100%; left:0px; position:absolute; top:0px; width:100%; }</style></head>
870+
<body><iframe id="fr" src="''' + html_report_path + '''" frameborder="0"></iframe></body>
871+
</html>
872+
'''
873+
with open(output_name, 'w') as HTML:
874+
HTML.write(contents)
865875

866876
# ----------------------------------------------------------------------------------------------------------------------
867877
#
@@ -882,6 +892,7 @@ def main(prog, args):
882892
"the only_tets option takes precedence", default=None)
883893
parser.add_argument("-r", "--regression_running_tests", help="Regression threshold for running tests.", type=float,
884894
default=None)
895+
parser.add_argument("--no_latest", help="Don't generate latest.html file.", action="store_true")
885896
parser.add_argument("-g", "--gate", help="Run in gate mode (Skip cpython runs; Do not upload results; "
886897
"Detect regressions).", action="store_true")
887898
parser.add_argument("path", help="Path to store the csv output and logs to.", nargs='?', default=None)
@@ -960,6 +971,9 @@ def _fmt(t):
960971
scp(txt_report_path, flags.path)
961972
scp(csv_report_path, flags.path)
962973
scp(html_report_path, flags.path)
974+
if not flags.no_latest:
975+
generate_latest(LATEST_HTML_NAME, html_report_path)
976+
scp(LATEST_HTML_NAME, flags.path)
963977

964978
gate_failed = False
965979
if flags.gate and flags.regression_running_tests:

0 commit comments

Comments
 (0)