[libc-commits] [libc] a8b90c8 - [libc][newheadergen]: adding entry_point testing (#99587)
via libc-commits
libc-commits at lists.llvm.org
Fri Jul 19 11:18:28 PDT 2024
Author: aaryanshukla
Date: 2024-07-19T11:18:25-07:00
New Revision: a8b90c835291df9a6c152fd32de666192aa0da77
URL: https://github.com/llvm/llvm-project/commit/a8b90c835291df9a6c152fd32de666192aa0da77
DIFF: https://github.com/llvm/llvm-project/commit/a8b90c835291df9a6c152fd32de666192aa0da77.diff
LOG: [libc][newheadergen]: adding entry_point testing (#99587)
Added:
Modified:
libc/newhdrgen/tests/input/test_small.yaml
libc/newhdrgen/tests/test_integration.py
Removed:
################################################################################
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)
More information about the libc-commits
mailing list