This is an archive of the discontinued LLVM Phabricator instance.

[cmake][lit] Follow symlinks when looking for lit tests & reconfigure lldb's tests.
AbandonedPublic

Authored by rupprecht on Nov 22 2019, 3:00 PM.

Details

Summary

The lldb tree contains a symlink directory, lldb/test/API/testcases, which points to the tests in ../../packages/Python/lldbsuite/test. Because the add_lit_testsuites() cmake rule does not follow symlinks, it doesn't find the nested directory tree to create make/ninja rules for.

Also, because the lldb lit config points the source root directly into the testcases tree, the check-lldb-api-testcases rule fails to find the testcases directory, and therefore finds no tests. Changing the source root to the containing lit file, like most lit configs do, fixes this.

After this patch, ninja check-lldb-api-testcases-linux works, and runs only the test cases in lldb/packages/Python/lldbsuite/test/linux.

Diff Detail

Event Timeline

rupprecht created this revision.Nov 22 2019, 3:00 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptNov 22 2019, 3:00 PM

Build result: pass - 60250 tests passed, 0 failed and 732 were skipped.

Log files: console-log.txt, CMakeCache.txt

Thanks for looking into this. This is something I've missed too, but never got around to checking it out.

Jonas, what do you think about this? Should we do this, or move the testcases themselves into the "test/API" folder?

Personally I'd prefer moving the test cases, but maybe there's a good historical reason for the current layout. I'll ask around during out team meeting later today and report back.

No objections to moving the test. Jordan, let me know if you're up for it, otherwise I'm happy to take care of it.

No objections to moving the test. Jordan, let me know if you're up for it, otherwise I'm happy to take care of it.

I tried moving it today. The rabbit hole goes deep :D
The test framework seems pretty tied to the directory layout (because python), e.g. those must be in a directory called "lldbsuite" to be able to "import lldbsuite"
The test infrastructure also seems to assume tests + test framework are in the same tree (e.g. the LLDB_TEST env var is used for both), so moving the individual test directories and leaving just the framework classes in lldbsuite breaks a few things.

I agree it's probably cleaner to move the tests, so I'll keep poking. Suggestions welcome though.

No objections to moving the test. Jordan, let me know if you're up for it, otherwise I'm happy to take care of it.

I tried moving it today. The rabbit hole goes deep :D
The test framework seems pretty tied to the directory layout (because python), e.g. those must be in a directory called "lldbsuite" to be able to "import lldbsuite"
The test infrastructure also seems to assume tests + test framework are in the same tree (e.g. the LLDB_TEST env var is used for both), so moving the individual test directories and leaving just the framework classes in lldbsuite breaks a few things.

I agree it's probably cleaner to move the tests, so I'll keep poking. Suggestions welcome though.

I have it down to ~5 failing tests (some may be preexisting failures), so I'll start pulling apart my change into submittable pieces.

Thanks for looking into this, Jordan.

I'm not sure how hard it is, but I think it would be nice to not have the actual tests intermingled with the test framework stuff.

(Also, another reason for moving the tests is that the symlink trick will just not work on windows.)

rupprecht abandoned this revision.Dec 6 2019, 9:30 AM

Officially abandoning this

rG0d236d8b4f8aecc258e26ad53755a39d9b76032e - fixes makefiles when separated from Makefile.rules
rG03a242bd41ee49e17f8da96af9787d13e7ea2b93 - fixes .categories lookup when tests are moved

I have one more to split up os.environ["LLDB_TEST"] into separate trees for test framework/test source, then the tests can be moved in a very mechanical way. (It will create heavy merge conflicts, I want it to be trivial to apply for downstream users).