This is an archive of the discontinued LLVM Phabricator instance.

[openmp] Create a local llvm-lit script when building openmp standalone
Needs ReviewPublic

Authored by mstorsjo on Nov 10 2022, 1:57 AM.

Details

Summary

Check whether the main llvm directory exists adjacent to the
openmp directory (when building from the monorepo, this is always
the case; if building from a separate tarball it won't be found).

If found, include the AddLLVM cmake module, which contains
functions such as add_lit_testsuite.

Use add_lit_testsuite instead of add_custom_target, and
configure_lit_site_cfg instead of the plain configure_file,
if available.

By using configure_lit_site_cfg, it includes lit.site.cfg in the
generated llvm-lit script, which allows pointing llvm-lit directly
at individual tests, instead of needing to point it at the generated
test directory in the build directory (where one can't easily run
individual tests).

This allows investigating and rerunning individual tests without
needing to run the full testsuite via "check-openmp".

This is similar to what other runtime subprojects such as libcxx
did (before libcxx entirely removed support for building standalone).
If openmp is built via the main llvm-project/runtimes directory,
that directory provides the llvm-lit script.

If building outside of the main llvm build, it's still necessary
to provide the FileCheck and "not" executables for running the
tests though.

Diff Detail

Event Timeline

mstorsjo created this revision.Nov 10 2022, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 1:57 AM
mstorsjo requested review of this revision.Nov 10 2022, 1:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 10 2022, 1:57 AM
Herald added a subscriber: sstefan1. · View Herald Transcript

Why not using env LIT_FILTER=<testname> ninja check-openmp environment variable to run individual tests?

Why not using env LIT_FILTER=<testname> ninja check-openmp environment variable to run individual tests?

Oh, I wasn't aware of that - I guess that works in many cases too. However despite that, I think moving towards using configure_lit_site_cfg would be in line with how all other subprojects do it.

This patch is in itself also a preparatory step for being able to run tests when openmp is built via the llvm-project/runtimes directory (e.g. libcxx no longer allows being built entirely standalone).

Why not using env LIT_FILTER=<testname> ninja check-openmp environment variable to run individual tests?

Oh, I wasn't aware of that - I guess that works in many cases too.

... but I guess that syntax doesn't work when running things from cmd.exe?

Why not using env LIT_FILTER=<testname> ninja check-openmp environment variable to run individual tests?

Oh, I wasn't aware of that - I guess that works in many cases too.

... but I guess that syntax doesn't work when running things from cmd.exe?

Also - by calling lit directly, it's easy to request it to e.g. run specific subsets of the tests, by listing one or more directories.