88
99class TestHeaderGenIntegration (unittest .TestCase ):
1010 def setUp (self ):
11-
1211 self .output_dir = Path (
1312 args .output_dir if args .output_dir else "libc/newhdrgen/tests/output"
1413 )
@@ -17,19 +16,24 @@ def setUp(self):
1716
1817 self .source_dir = Path (__file__ ).resolve ().parent .parent .parent .parent
1918
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 ):
2120 yaml_file = self .source_dir / yaml_file
2221 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+
2335 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 ,
3337 capture_output = True ,
3438 text = True ,
3539 )
@@ -53,11 +57,12 @@ def test_generate_header(self):
5357 self .source_dir / "libc/newhdrgen/tests/expected_output/test_header.h"
5458 )
5559 output_file = self .output_dir / "test_small.h"
60+ entry_points = {"func_b" , "func_a" , "func_c" , "func_d" , "func_e" }
5661
5762 if not self .output_dir .exists ():
5863 self .output_dir .mkdir (parents = True )
5964
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 )
6166
6267 self .compare_files (output_file , expected_output_file )
6368
0 commit comments