Skip to content

[libc][newheadergen]: adding entry_point testing #99587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

aaryanshukla
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jul 19, 2024

@llvm/pr-subscribers-libc

Author: None (aaryanshukla)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/99587.diff

2 Files Affected:

  • (modified) libc/newhdrgen/tests/expected_output/test_header.h (-4)
  • (modified) libc/newhdrgen/tests/test_integration.py (+17-12)
diff --git a/libc/newhdrgen/tests/expected_output/test_header.h b/libc/newhdrgen/tests/expected_output/test_header.h
index a777976134b04..6533faf284a87 100644
--- a/libc/newhdrgen/tests/expected_output/test_header.h
+++ b/libc/newhdrgen/tests/expected_output/test_header.h
@@ -40,10 +40,6 @@ _Float16 func_c(int, float) __NOEXCEPT;
 _Float16 func_d(int, float) __NOEXCEPT;
 #endif // LIBC_TYPES_HAS_FLOAT16
 
-#ifdef LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
-_Float16 func_e(float128) __NOEXCEPT;
-#endif // LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
-
 extern obj object_1;
 extern obj object_2;
 
diff --git a/libc/newhdrgen/tests/test_integration.py b/libc/newhdrgen/tests/test_integration.py
index 628a37b11c309..f9fa956077f56 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"}
 
         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)
 

@@ -40,10 +40,6 @@ _Float16 func_c(int, float) __NOEXCEPT;
_Float16 func_d(int, float) __NOEXCEPT;
#endif // LIBC_TYPES_HAS_FLOAT16

#ifdef LIBC_TYPES_HAS_FLOAT16_AND_FLOAT128
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make more sense to leave this function here and add a new function for the entrypoint testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, let me if I'm good to merge

Copy link
Contributor

@michaelrj-google michaelrj-google left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good to land

@aaryanshukla aaryanshukla merged commit a8b90c8 into llvm:main Jul 19, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants