Skip to content

Commit 1a59068

Browse files
committed
Issue #27: organize tests.
1 parent 7171908 commit 1a59068

17 files changed

+29
-25
lines changed

tools/evm-test/evm_test.py

+29-25
Original file line numberDiff line numberDiff line change
@@ -187,120 +187,125 @@ def run_string_input(name: str, inputs: List[str], output: str, function: str) -
187187

188188
runtime_file_prefix = "../../test/CodeGen/EVM/runtime_tests/"
189189

190-
file_input_fixtures = OrderedDict({
190+
simple_tests = OrderedDict({
191191
"simple_test_1" : {
192-
"file": "simple_test_1.ll",
192+
"file": "simple_tests/simple_test_1.ll",
193193
"input": [],
194194
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
195195
},
196196
"simple_test_2" : {
197-
"file": "simple_test_2.ll",
197+
"file": "simple_tests/simple_test_2.ll",
198198
"input": ["0x12345678", "0x87654321"],
199199
"output": "0x0000000000000000000000000000000000000000000000000000000099999999",
200200
},
201201
"simple_test_3" : {
202-
"file": "simple_test_3.ll",
202+
"file": "simple_tests/simple_test_3.ll",
203203
"input": [],
204204
"output": "0x",
205205
},
206206
"simple_test_4" : {
207-
"file": "simple_test_4.ll",
207+
"file": "simple_tests/simple_test_4.ll",
208208
"input": ["0x12345678"],
209209
"output": "0x",
210210
},
211211
"simple_test_5.ll" : {
212-
"file": "simple_test_5.ll",
212+
"file": "simple_tests/simple_test_5.ll",
213213
"input": ["0x12345678"],
214214
"output": "0x0000000000000000000000000000000000000000000000000000000012345679",
215215
},
216216
"simple_test_6" : {
217-
"file": "simple_test_6.ll",
217+
"file": "simple_tests/simple_test_6.ll",
218218
"input": ["0x12345678", "0x87654321"],
219219
"output": "0x0000000000000000000000000000000000000000000000000000000012345678",
220220
},
221221
"simple_test_7" : {
222-
"file": "simple_test_7.ll",
222+
"file": "simple_tests/simple_test_7.ll",
223223
"input": ["0x12345678", "0x87654321"],
224224
"output": "0x0000000000000000000000000000000000000000000000000000000087654321",
225225
},
226226
"simple_test_8.ll" : {
227-
"file": "simple_test_8.ll",
227+
"file": "simple_tests/simple_test_8.ll",
228228
"input": ["0x12345678", "0x87654321"],
229229
"output": "0x0000000000000000000000000000000000000000000000000000000012345678",
230230
},
231231
})
232232

233233
loop_tests = OrderedDict({
234234
"loop1" : {
235-
"file": "loop.ll",
235+
"file": "loops/loop.ll",
236236
"input": ["0x00001000", "0x00000001"],
237237
"output": "0x000000000000000000000000000000000000000000000000000000000000100a",
238238
},
239239
"loop2" : {
240-
"file": "loop2.ll",
240+
"file": "loops/loop2.ll",
241241
"input": ["0x00001000", "0x0000000a"],
242242
"output": "0x000000000000000000000000000000000000000000000000000000000000100a"
243243
},
244244
"loop3" : {
245-
"file": "loop2.ll",
245+
"file": "loops/loop2.ll",
246246
"input": ["0x0000000a", "0x00001000"],
247247
"output": "0x000000000000000000000000000000000000000000000000000000000000100a"
248248
},
249249
})
250250

251251
setcc_tests = OrderedDict({
252252
"setcc_eq1" : {
253-
"file": "setcc_eq.ll",
253+
"file": "setcc/setcc_eq.ll",
254254
"input": ["0xff00ff00", "0x00ff00ff"],
255255
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
256256
},
257257
"setcc_ne1" : {
258-
"file": "setcc_ne.ll",
258+
"file": "setcc/setcc_ne.ll",
259259
"input": ["0xff00ff01", "0x00ff00ff"],
260260
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
261261
},
262262
"setcc_ule" : {
263-
"file": "setcc_ule.ll",
263+
"file": "setcc/setcc_ule.ll",
264264
"input": ["0xff00ff00", "0x00ff01ff"],
265265
"output": "0x0000000000000000000000000000000000000000000000000000000000000000",
266266
},
267267
"setcc_uge" : {
268-
"file": "setcc_uge.ll",
268+
"file": "setcc/setcc_uge.ll",
269269
"input": ["0xff00ff00", "0x00ff00ff"],
270270
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
271271
},
272272
"cmp1" : {
273-
"file": "cmp.ll",
273+
"file": "setcc/cmp.ll",
274274
"input": ["0x00001234", "0x00004321"],
275275
"output": "0x0000000000000000000000000000000000000000000000000000000000021908",
276276
},
277277
"cmp2" : {
278-
"file": "cmp.ll",
278+
"file": "setcc/cmp.ll",
279279
"input": ["0x00004321", "0x00001234"],
280280
"output": "0x0000000000000000000000000000000000000000000000000000000004c5f4b4",
281281
},
282+
})
283+
284+
fib_tests = OrderedDict({
282285
"fibonacci 1" : {
283-
"file": "fib.ll",
286+
"file": "fib/fib.ll",
284287
"input": ["0x00000001"],
285288
"output": "0x0000000000000000000000000000000000000000000000000000000000000001",
286289
},
287290
"fibonacci 2" : {
288-
"file": "fib.ll",
291+
"file": "fib/fib.ll",
289292
"input": ["0x00000002"],
290293
"output": "0x0000000000000000000000000000000000000000000000000000000000000002",
291294
},
292295
"fibonacci 3" : {
293-
"file": "fib.ll",
296+
"file": "fib/fib.ll",
294297
"input": ["0x00000003"],
295298
"output": "0x0000000000000000000000000000000000000000000000000000000000000003",
296299
},
297300
"fibonacci 10" : {
298-
"file": "fib.ll",
301+
"file": "fib/fib.ll",
299302
"input": ["0x0000000a"],
300303
"output": "0x0000000000000000000000000000000000000000000000000000000000000059",
301304
},
302305
})
303306

307+
test_suite = [simple_tests, setcc_tests, loop_tests, fib_tests]
308+
304309
def run_testset(testset) -> List[str]:
305310
failed_tests = []
306311
for key,val in testset.items():
@@ -316,9 +321,8 @@ def run_testset(testset) -> List[str]:
316321

317322
def assembly_tests() -> List[str]:
318323
failed_tests = []
319-
failed_tests += run_testset(file_input_fixtures)
320-
failed_tests += run_testset(setcc_tests)
321-
failed_tests += run_testset(loop_tests)
324+
for tests in test_suite:
325+
failed_tests += run_testset(tests)
322326
return failed_tests
323327

324328
def print_failed(tests: List[str]) -> None:

0 commit comments

Comments
 (0)