8
8
9
9
class TestHeaderGenIntegration (unittest .TestCase ):
10
10
def setUp (self ):
11
-
12
11
self .output_dir = Path (
13
12
args .output_dir if args .output_dir else "libc/newhdrgen/tests/output"
14
13
)
@@ -17,19 +16,24 @@ def setUp(self):
17
16
18
17
self .source_dir = Path (__file__ ).resolve ().parent .parent .parent .parent
19
18
20
- def run_script (self , yaml_file , h_def_file , output_dir ):
19
+ def run_script (self , yaml_file , h_def_file , output_dir , entry_points ):
21
20
yaml_file = self .source_dir / yaml_file
22
21
h_def_file = self .source_dir / h_def_file
22
+ command = [
23
+ "python3" ,
24
+ str (self .source_dir / "libc/newhdrgen/yaml_to_classes.py" ),
25
+ str (yaml_file ),
26
+ "--h_def_file" ,
27
+ str (h_def_file ),
28
+ "--output_dir" ,
29
+ str (output_dir ),
30
+ ]
31
+
32
+ for entry_point in entry_points :
33
+ command .extend (["--e" , entry_point ])
34
+
23
35
result = subprocess .run (
24
- [
25
- "python3" ,
26
- str (self .source_dir / "libc/newhdrgen/yaml_to_classes.py" ),
27
- str (yaml_file ),
28
- "--h_def_file" ,
29
- str (h_def_file ),
30
- "--output_dir" ,
31
- str (output_dir ),
32
- ],
36
+ command ,
33
37
capture_output = True ,
34
38
text = True ,
35
39
)
@@ -53,11 +57,12 @@ def test_generate_header(self):
53
57
self .source_dir / "libc/newhdrgen/tests/expected_output/test_header.h"
54
58
)
55
59
output_file = self .output_dir / "test_small.h"
60
+ entry_points = {"func_b" , "func_a" , "func_c" , "func_d" , "func_e" }
56
61
57
62
if not self .output_dir .exists ():
58
63
self .output_dir .mkdir (parents = True )
59
64
60
- self .run_script (yaml_file , h_def_file , self .output_dir )
65
+ self .run_script (yaml_file , h_def_file , self .output_dir , entry_points )
61
66
62
67
self .compare_files (output_file , expected_output_file )
63
68
0 commit comments