diff --git a/libc/newhdrgen/tests/input/test_small.yaml b/libc/newhdrgen/tests/input/test_small.yaml index f1f9f020ce6a4..a2e96939b4be0 100644 --- a/libc/newhdrgen/tests/input/test_small.yaml +++ b/libc/newhdrgen/tests/input/test_small.yaml @@ -54,4 +54,13 @@ functions: standards: - stdc guard: LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128 + - name: func_f + return_type: _Float16 + arguments: + - type: int + - type: double + - type: float + standards: + - stdc + diff --git a/libc/newhdrgen/tests/test_integration.py b/libc/newhdrgen/tests/test_integration.py index 628a37b11c309..33353785af233 100644 --- a/libc/newhdrgen/tests/test_integration.py +++ b/libc/newhdrgen/tests/test_integration.py @@ -8,7 +8,6 @@ class TestHeaderGenIntegration(unittest.TestCase): def setUp(self): - self.output_dir = Path( args.output_dir if args.output_dir else "libc/newhdrgen/tests/output" ) @@ -17,19 +16,24 @@ def setUp(self): self.source_dir = Path(__file__).resolve().parent.parent.parent.parent - def run_script(self, yaml_file, h_def_file, output_dir): + def run_script(self, yaml_file, h_def_file, output_dir, entry_points): yaml_file = self.source_dir / yaml_file h_def_file = self.source_dir / h_def_file + command = [ + "python3", + str(self.source_dir / "libc/newhdrgen/yaml_to_classes.py"), + str(yaml_file), + "--h_def_file", + str(h_def_file), + "--output_dir", + str(output_dir), + ] + + for entry_point in entry_points: + command.extend(["--e", entry_point]) + result = subprocess.run( - [ - "python3", - str(self.source_dir / "libc/newhdrgen/yaml_to_classes.py"), - str(yaml_file), - "--h_def_file", - str(h_def_file), - "--output_dir", - str(output_dir), - ], + command, capture_output=True, text=True, ) @@ -53,11 +57,12 @@ def test_generate_header(self): self.source_dir / "libc/newhdrgen/tests/expected_output/test_header.h" ) output_file = self.output_dir / "test_small.h" + entry_points = {"func_b", "func_a", "func_c", "func_d", "func_e"} if not self.output_dir.exists(): self.output_dir.mkdir(parents=True) - self.run_script(yaml_file, h_def_file, self.output_dir) + self.run_script(yaml_file, h_def_file, self.output_dir, entry_points) self.compare_files(output_file, expected_output_file)