Page MenuHomePhabricator

[test] Fix asan dynamic unit tests with per-target runtime dirs
ClosedPublic

Authored by collinbaker on Oct 13 2021, 1:28 PM.

Details

Summary

When LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=on
Asan-i386-calls-Dynamic-Test and Asan-i386-inline-Dynamic-Test fail to
run on a x86_64 host. This is because asan's unit test lit files are
configured once, rather than per target arch as with the non-unit
tests. LD_LIBRARY_PATH ends up incorrect, and the tests try linking
against the x86_64 runtime which fails.

This changes the unit test CMake machinery to configure the default
and dynamic unit tests once per target arch, similar to the other asan
tests. Then the fix from https://reviews.llvm.org/D108859 is adapted
to the unit test Lit files with some modifications.

Fixes PR52158

Diff Detail

Event Timeline

collinbaker created this revision.Oct 13 2021, 1:28 PM
collinbaker requested review of this revision.Oct 13 2021, 1:28 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 13 2021, 1:28 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
collinbaker edited the summary of this revision. (Show Details)Oct 13 2021, 1:31 PM
collinbaker added reviewers: thakis, MaskRay.

Please add llvm-commits to Subscribers for llvm, lld, and compiler-rt changes (and cfe-commits for clang changes) :)

Instead of "Related bug: https://bugs.llvm.org/show_bug.cgi?id=52158" we usually say "Fixes PR52158", and llvm.org/PR52158 works as URL.

@phosek invented the runtimes build as far as I know, so he should probably review this :)

phosek accepted this revision.Oct 14 2021, 1:43 AM

LGTM

compiler-rt/test/asan/Unit/lit.site.cfg.py.in
64

Is this leftover from debugging?

This revision is now accepted and ready to land.Oct 14 2021, 1:43 AM

Remove debuggig line

collinbaker edited the summary of this revision. (Show Details)Oct 14 2021, 9:17 AM
collinbaker marked an inline comment as done.Oct 14 2021, 10:08 AM

LGTM

Could you commit this for me?

compiler-rt/test/asan/Unit/lit.site.cfg.py.in
64

Yup! Removed

MaskRay accepted this revision.Oct 14 2021, 10:23 AM
MaskRay added inline comments.
compiler-rt/lib/asan/tests/CMakeLists.txt
166

Add a comment what this does.

collinbaker marked an inline comment as done.

Add comment to unit test CMake target

collinbaker marked an inline comment as done.Oct 14 2021, 11:21 AM
This revision was automatically updated to reflect the committed changes.