Skip to content

Commit e807a33

Browse files
committed
cleaned up some regression tests for v5-unity
1 parent 3c11ec2 commit e807a33

6 files changed

Lines changed: 57 additions & 37 deletions

File tree

v3/tests/backend-tests/cs61a-multi-lambdas.golden

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,7 +1216,7 @@
12161216
"func_name": "<lambda> <line 3>",
12171217
"is_zombie": true,
12181218
"parent_frame_id_list": [
1219-
4
1219+
1
12201220
],
12211221
"unique_hash": "<lambda> <line 3>_f2_p_z",
12221222
"ordered_varnames": [
@@ -1332,7 +1332,7 @@
13321332
"func_name": "<lambda> <line 3>",
13331333
"is_zombie": true,
13341334
"parent_frame_id_list": [
1335-
4
1335+
1
13361336
],
13371337
"unique_hash": "<lambda> <line 3>_f2_p_z",
13381338
"ordered_varnames": [
@@ -1370,7 +1370,7 @@
13701370
"func_name": "<lambda> <line 3>",
13711371
"is_zombie": false,
13721372
"parent_frame_id_list": [
1373-
4
1373+
1
13741374
],
13751375
"unique_hash": "<lambda> <line 3>_f5_p",
13761376
"ordered_varnames": [
@@ -1465,7 +1465,7 @@
14651465
"func_name": "<lambda> <line 3>",
14661466
"is_zombie": true,
14671467
"parent_frame_id_list": [
1468-
4
1468+
1
14691469
],
14701470
"unique_hash": "<lambda> <line 3>_f2_p_z",
14711471
"ordered_varnames": [
@@ -1503,7 +1503,7 @@
15031503
"func_name": "<lambda> <line 3>",
15041504
"is_zombie": false,
15051505
"parent_frame_id_list": [
1506-
4
1506+
1
15071507
],
15081508
"unique_hash": "<lambda> <line 3>_f5_p",
15091509
"ordered_varnames": [
@@ -1598,7 +1598,7 @@
15981598
"func_name": "<lambda> <line 3>",
15991599
"is_zombie": true,
16001600
"parent_frame_id_list": [
1601-
4
1601+
1
16021602
],
16031603
"unique_hash": "<lambda> <line 3>_f2_p_z",
16041604
"ordered_varnames": [
@@ -1640,7 +1640,7 @@
16401640
"func_name": "<lambda> <line 3>",
16411641
"is_zombie": false,
16421642
"parent_frame_id_list": [
1643-
4
1643+
1
16441644
],
16451645
"unique_hash": "<lambda> <line 3>_f5_p",
16461646
"ordered_varnames": [
@@ -1741,7 +1741,7 @@
17411741
"func_name": "<lambda> <line 3>",
17421742
"is_zombie": true,
17431743
"parent_frame_id_list": [
1744-
4
1744+
1
17451745
],
17461746
"unique_hash": "<lambda> <line 3>_f2_p_z",
17471747
"ordered_varnames": [
@@ -1783,7 +1783,7 @@
17831783
"func_name": "<lambda> <line 3>",
17841784
"is_zombie": true,
17851785
"parent_frame_id_list": [
1786-
4
1786+
1
17871787
],
17881788
"unique_hash": "<lambda> <line 3>_f5_p_z",
17891789
"ordered_varnames": [
@@ -1801,8 +1801,8 @@
18011801
"func_name": "<lambda> <line 3>",
18021802
"is_zombie": false,
18031803
"parent_frame_id_list": [
1804-
2,
1805-
4
1804+
5,
1805+
1
18061806
],
18071807
"unique_hash": "<lambda> <line 3>_f6",
18081808
"ordered_varnames": [
@@ -1902,7 +1902,7 @@
19021902
"func_name": "<lambda> <line 3>",
19031903
"is_zombie": true,
19041904
"parent_frame_id_list": [
1905-
4
1905+
1
19061906
],
19071907
"unique_hash": "<lambda> <line 3>_f2_p_z",
19081908
"ordered_varnames": [
@@ -1944,7 +1944,7 @@
19441944
"func_name": "<lambda> <line 3>",
19451945
"is_zombie": true,
19461946
"parent_frame_id_list": [
1947-
4
1947+
1
19481948
],
19491949
"unique_hash": "<lambda> <line 3>_f5_p_z",
19501950
"ordered_varnames": [
@@ -1962,8 +1962,8 @@
19621962
"func_name": "<lambda> <line 3>",
19631963
"is_zombie": false,
19641964
"parent_frame_id_list": [
1965-
2,
1966-
4
1965+
5,
1966+
1
19671967
],
19681968
"unique_hash": "<lambda> <line 3>_f6",
19691969
"ordered_varnames": [
@@ -2063,7 +2063,7 @@
20632063
"func_name": "<lambda> <line 3>",
20642064
"is_zombie": true,
20652065
"parent_frame_id_list": [
2066-
4
2066+
1
20672067
],
20682068
"unique_hash": "<lambda> <line 3>_f2_p_z",
20692069
"ordered_varnames": [
@@ -2105,7 +2105,7 @@
21052105
"func_name": "<lambda> <line 3>",
21062106
"is_zombie": true,
21072107
"parent_frame_id_list": [
2108-
4
2108+
1
21092109
],
21102110
"unique_hash": "<lambda> <line 3>_f5_p_z",
21112111
"ordered_varnames": [
@@ -2124,8 +2124,8 @@
21242124
"func_name": "<lambda> <line 3>",
21252125
"is_zombie": false,
21262126
"parent_frame_id_list": [
2127-
2,
2128-
4
2127+
5,
2128+
1
21292129
],
21302130
"unique_hash": "<lambda> <line 3>_f6",
21312131
"ordered_varnames": [
@@ -2226,7 +2226,7 @@
22262226
"func_name": "<lambda> <line 3>",
22272227
"is_zombie": true,
22282228
"parent_frame_id_list": [
2229-
4
2229+
1
22302230
],
22312231
"unique_hash": "<lambda> <line 3>_f2_p_z",
22322232
"ordered_varnames": [
@@ -2268,7 +2268,7 @@
22682268
"func_name": "<lambda> <line 3>",
22692269
"is_zombie": true,
22702270
"parent_frame_id_list": [
2271-
4
2271+
1
22722272
],
22732273
"unique_hash": "<lambda> <line 3>_f5_p_z",
22742274
"ordered_varnames": [

v3/tests/backend-tests/nested-func-identical-frames.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@
796796
"func_name": "g",
797797
"is_zombie": false,
798798
"parent_frame_id_list": [
799-
3
799+
1
800800
],
801801
"unique_hash": "g_f4",
802802
"ordered_varnames": []
@@ -889,7 +889,7 @@
889889
"func_name": "g",
890890
"is_zombie": false,
891891
"parent_frame_id_list": [
892-
3
892+
1
893893
],
894894
"unique_hash": "g_f4",
895895
"ordered_varnames": []
@@ -984,7 +984,7 @@
984984
"func_name": "g",
985985
"is_zombie": false,
986986
"parent_frame_id_list": [
987-
3
987+
1
988988
],
989989
"unique_hash": "g_f4",
990990
"ordered_varnames": [

v3/tests/backend-tests/nested-func-identical-frames.golden_py3

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@
796796
"func_name": "g",
797797
"is_zombie": false,
798798
"parent_frame_id_list": [
799-
3
799+
1
800800
],
801801
"unique_hash": "g_f4",
802802
"ordered_varnames": []
@@ -889,7 +889,7 @@
889889
"func_name": "g",
890890
"is_zombie": false,
891891
"parent_frame_id_list": [
892-
3
892+
1
893893
],
894894
"unique_hash": "g_f4",
895895
"ordered_varnames": []
@@ -984,7 +984,7 @@
984984
"func_name": "g",
985985
"is_zombie": false,
986986
"parent_frame_id_list": [
987-
3
987+
1
988988
],
989989
"unique_hash": "g_f4",
990990
"ordered_varnames": [

v3/tests/golden_test.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@
1111
I've been focusing on Python 2 for now.
1212
'''
1313

14+
#GEN_JSON_TRACE_PY = '../generate_json_trace.py'
15+
GEN_JSON_TRACE_PY = '../../v5-unity/generate_json_trace.py'
16+
17+
# no longer supported by v5-unity
18+
IGNORED_TESTS = [
19+
'backend-tests/callback-test.txt',
20+
'backend-tests/ttt_min.txt',
21+
'../example-code/chris-meyers/optFib.txt',
22+
'../example-code/chris-meyers/optMinpath.txt',
23+
'../example-code/chris-meyers/optSieve.txt',
24+
'../example-code/chris-meyers/optKnapsack.txt',
25+
]
26+
1427
import itertools
1528
import os, re, shutil, optparse, difflib
1629
from subprocess import *
@@ -149,11 +162,11 @@ def diff_all_test_outputs():
149162
INPUT_FILE_EXTENSION = '.txt' # input test files are .txt, NOT .py
150163

151164
if options.py3:
152-
PROGRAM = ['python3.2', '../generate_json_trace.py']
165+
PROGRAM = ['python3.2', GEN_JSON_TRACE_PY]
153166
OUTPUT_FILE_EXTENSION = '.out_py3'
154167
GOLDEN_FILE_EXTENSION = '.golden_py3'
155168
else:
156-
PROGRAM = ['python2.7', '../generate_json_trace.py']
169+
PROGRAM = ['python2.7', GEN_JSON_TRACE_PY]
157170
OUTPUT_FILE_EXTENSION = '.out'
158171
GOLDEN_FILE_EXTENSION = '.golden'
159172

@@ -164,7 +177,8 @@ def diff_all_test_outputs():
164177
(base, ext) = os.path.splitext(f)
165178
if ext == INPUT_FILE_EXTENSION:
166179
fullpath = os.path.join(pwd, f)
167-
ALL_TESTS.append(fullpath)
180+
if fullpath not in IGNORED_TESTS:
181+
ALL_TESTS.append(fullpath)
168182

169183

170184
if options.run_all:

v5-unity/doctest_exec.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
import os
55
import sys
66

7+
import pprint
8+
pp = pprint.PrettyPrinter()
9+
710
def my_finalizer(input_code, output_trace):
811
ret = dict(code=input_code, trace=output_trace)
9-
print(ret)
12+
pp.pprint(output_trace)
13+
#print(ret)
1014
#json_output = json.dumps(ret, indent=None) # use indent=None for most compact repr
1115
#print(json_output)
1216

v5-unity/pg_logger.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,15 +1278,17 @@ def _runscript(self, script_str, custom_globals=None):
12781278
# errors, will be silently ignored. WEIRD!
12791279
#sys.stderr = NullDevice # silence errors
12801280

1281-
user_globals = {"__name__" : "__main__",
1282-
"__builtins__" : user_builtins,
1283-
"__user_stdout__" : user_stdout,
1284-
# sentinel value for frames deriving from a top-level module
1285-
"__OPT_toplevel__": True}
1286-
1281+
user_globals = {}
12871282
if custom_globals:
12881283
user_globals.update(custom_globals)
12891284

1285+
# update AFTER custom_globals so that custom_globals doesn't clobber us
1286+
user_globals.update({"__name__" : "__main__",
1287+
"__builtins__" : user_builtins,
1288+
"__user_stdout__" : user_stdout,
1289+
# sentinel value for frames deriving from a top-level module
1290+
"__OPT_toplevel__": True})
1291+
12901292
try:
12911293
# enforce resource limits RIGHT BEFORE running script_str
12921294

0 commit comments

Comments
 (0)