Skip to content

Commit a5cdaf8

Browse files
Add typemap for command_line_args_get_argv (#2009)
* Add typemap for command_line_args_get_argv * Add unit tests for `CommandLineArguments:get_{argc,argv}` * Add python unit tests * Fix python unit test * `-OO` not `-00` * Added sie append runtime to be consistent with the corresponding analyze. * Added one c interface test, changed to only run unit_test.py for SIM_test_output_dir, and added helper class just to have some coding exercises :-) * Slight formatting and static class changes --------- Co-authored-by: Hong Chen <[email protected]>
1 parent 3674388 commit a5cdaf8

File tree

5 files changed

+411
-9
lines changed

5 files changed

+411
-9
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
trick.stop(15)
2+
3+
trick.sie_append_runtime_objs()
4+
5+
from trick.unit_test import *
6+
7+
trick_utest.unit_tests.enable()
8+
trick_utest.unit_tests.set_file_name(
9+
os.getenv("TRICK_HOME") + "/trick_test/SIM_test_output_dir.xml"
10+
)
11+
trick_utest.unit_tests.set_test_name("CommandLineArgumentsTests")
12+
13+
test_suite = "command_line_arguments"
14+
15+
cpu = os.getenv("TRICK_HOST_CPU")
16+
17+
expected_argv = [
18+
f"./T_main_{cpu}_test.exe",
19+
"RUN_test/unit_test.py",
20+
"-OO",
21+
"sim_output",
22+
"--read-only-sim",
23+
]
24+
expected_argc = len(expected_argv)
25+
26+
argc = trick.command_line_args_get_argc()
27+
argv = trick.command_line_args_get_argv()
28+
29+
30+
TRICK_EXPECT_EQ(expected_argc, argc, test_suite, "Expected argument count to match")
31+
32+
TRICK_EXPECT_EQ(expected_argv, argv, test_suite, "Expected argument values to match")
33+
34+
TRICK_EXPECT_EQ(expected_argv[0], argv[0], test_suite, "Expected first argument to match")
35+
36+
TRICK_EXPECT_EQ(expected_argv[1], argv[1], test_suite, "Expected second argument to match")
37+
38+
TRICK_EXPECT_EQ(expected_argv[2], argv[2], test_suite, "Expected third argument to match")
39+
40+
TRICK_EXPECT_EQ(expected_argv[3], argv[3], test_suite, "Expected fourth argument to match")
41+
42+
TRICK_EXPECT_EQ(expected_argv[4], argv[4], test_suite, "Expected fifth argument to match")

test_sims.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -301,19 +301,19 @@ SIM_checkpoint_data_recording:
301301
- test/SIM_checkpoint_data_recording/RUN_test5/ref_log_foo.csv vs. test/SIM_checkpoint_data_recording/RUN_test5/log_foo.csv
302302
RUN_test6/unit_test.py:
303303
returns: 0
304-
compare:
304+
compare:
305305
- test/SIM_checkpoint_data_recording/RUN_test6/ref_log_foo2.csv vs. test/SIM_checkpoint_data_recording/RUN_test6/log_foo2.csv
306306
RUN_test7/unit_test.py:
307307
returns: 0
308-
compare:
308+
compare:
309309
- test/SIM_checkpoint_data_recording/RUN_test7/ref_log_fooChange.csv vs. test/SIM_checkpoint_data_recording/RUN_test7/log_fooChange.csv
310310
RUN_test8/unit_test.py:
311311
returns: 0
312-
compare:
312+
compare:
313313
- test/SIM_checkpoint_data_recording/RUN_test8/ref_log_fooChange2.csv vs. test/SIM_checkpoint_data_recording/RUN_test8/log_fooChange2.csv
314314
RUN_test9/unit_test.py:
315315
returns: 0
316-
compare:
316+
compare:
317317
- test/SIM_checkpoint_data_recording/RUN_test9/ref_log_foo2.csv vs. test/SIM_checkpoint_data_recording/RUN_test9/log_foo2.csv
318318

319319
SIM_events:
@@ -322,7 +322,7 @@ SIM_events:
322322
binary: "T_main_{cpu}_test.exe"
323323
runs:
324324
RUN_test/unit_test.py:
325-
returns: 0
325+
returns: 0
326326
RUN_test/unit_test_error1.py:
327327
returns: 255
328328
RUN_test/unit_test_error2.py:
@@ -334,15 +334,14 @@ SIM_events:
334334

335335
SIM_test_output_dir:
336336
path: test/SIM_test_output_dir
337-
build_args: "-t"
337+
build_args: "-t"
338338
binary: "T_main_{cpu}_test.exe"
339339
runs:
340-
RUN_test/input.py -OO sim_output --read-only-sim:
340+
RUN_test/unit_test.py -OO sim_output --read-only-sim:
341341
returns: 0
342342
analyze: 'python3 test/SIM_test_output_dir/ref_files/check_file_endings.py test/SIM_test_output_dir/ref_files/ref_compiletime_S_sie.resource test/SIM_test_output_dir/S_sie.resource'
343343
analyze: 'python3 test/SIM_test_output_dir/ref_files/check_file_endings.py test/SIM_test_output_dir/ref_files/ref_runtime_S_sie.resource test/SIM_test_output_dir/sim_output/RUN_test/S_sie.resource'
344344

345-
346345
# The variable server client and SIM_amoeba sometimes fail to connect and need to be retried
347346

348347
# JMP (9/23/2023): We can't have these in our regular CI test suite if they are going to

0 commit comments

Comments
 (0)