[libcxx-commits] [libcxx] [libcxx] Add testing configuration for GPU targets (PR #104515)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 11 09:41:29 PDT 2024


================
@@ -30,3 +30,7 @@ config.substitutions.append(('%{target-include-dir}', '@LIBCXX_TESTING_INSTALL_P
 config.substitutions.append(('%{lib-dir}', '@LIBCXX_TESTING_INSTALL_PREFIX@/@LIBCXX_INSTALL_LIBRARY_DIR@'))
 config.substitutions.append(('%{module-dir}', '@LIBCXX_TESTING_INSTALL_PREFIX@/@LIBCXX_INSTALL_MODULES_DIR@'))
 config.substitutions.append(('%{test-tools-dir}', '@LIBCXX_TEST_TOOLS_PATH@'))
+
+# Available if building libc++ on top of llvm-libc.
+config.substitutions.append(('%{libc-dir}', '@LIBCXX_LIBC_LIBRARY_DIR@'))
+config.substitutions.append(('%{libc-include-dir}', '@LIBCXX_LIBC_INCLUDE_DIR@'))
----------------
ldionne wrote:

Think of it this way: this configuration file is like a hello world for running code on this platform. It's the bare minimum that's required by anyone trying to compile and run on this platform. When doing that requires manually specifying the C library to use, IMO there's something wrong.

If you're dead set on keeping these substitutions, the right way of passing that information without impacting the general-purpose libc++ configuration would be to add additional parameters to your Lit configuration, like:

```python
ADDITIONAL__PARAMETERS = [
    libcxx.test.dsl.Parameter(name='libc_lib_dir', type=str,
        actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{libc-lib-dir}', path)],
        help="""
        TODO explain what this is
        """),
    libcxx.test.dsl.Parameter(name='libc_include_dir', type=str,
        actions=lambda path: [libcxx.test.dsl.AddSubstitution('%{libc-include-dir}', path)],
        help="""
        TODO explain what this is
        """),
]

...

libcxx.test.config.configure(
  libcxx.test.params.DEFAULT_PARAMETERS + ADDITIONAL_PARAMETERS,
  ...
)
```

Then you'd call `lit` with `--param libc_lib_dir=<path> --param libc_include_dir=<path>` when running the tests, and the rest of libc++ doesn't have to know about this particularity of your setup.

https://github.com/llvm/llvm-project/pull/104515


More information about the libcxx-commits mailing list