This is an archive of the discontinued LLVM Phabricator instance.

[ASan] Fix leak tests on 64-bit targets other than x86-64
ClosedPublic

Authored by foad on Nov 10 2014, 1:21 AM.

Details

Summary

This test explicitly sets ASAN_OPTIONS=detect_leaks=1 which is only
supported on x86-64. The test is currently restricted to run only on
64-bit targets, but needs to be restricted further so it only runs on
x86-64.

Diff Detail

Event Timeline

foad updated this revision to Diff 15969.Nov 10 2014, 1:21 AM
foad retitled this revision from to [ASan] Fix leak test on 64-bit targets other than x86-64.
foad updated this object.
foad edited the test plan for this revision. (Show Details)
foad added reviewers: kcc, samsonov, eugenis.
foad added a subscriber: Unknown Object (MLST).
earthdok added inline comments.
test/asan/lit.cfg
125–126

Where does this mention x86_64? Looks like all this patch does is restrict the test to 64-bit Linux, which is already the case.

earthdok removed a subscriber: earthdok.
foad added inline comments.Nov 11 2014, 6:04 AM
test/asan/lit.cfg
125–126

Good point. I assumed that the existing test for enabling detect_leaks=1 was correct, but it wasn't:

# Turn on leak detection on 64-bit Linux.
if config.host_os == 'Linux' and config.bits == '64':
  config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'

test/asan/Unit/lit.site.cfg.in has a better test:

# Enable leak detection in ASan unit tests on x86_64-linux.
if config.host_os == 'Linux' and config.host_arch == 'x86_64':
  config.environment['ASAN_OPTIONS'] = 'detect_leaks=1'
earthdok added inline comments.Nov 11 2014, 6:56 AM
test/asan/lit.cfg
125–126

You're right. This code needs to be deduplicated. Alexey wrote those configs so he's in a better position to help.

foad updated this revision to Diff 16046.Nov 11 2014, 7:09 AM

Fix test for leak detection support.
Include another test case that requires leak detection.

foad retitled this revision from [ASan] Fix leak test on 64-bit targets other than x86-64 to [ASan] Fix leak tests on 64-bit targets other than x86-64.Nov 11 2014, 7:10 AM
earthdok added inline comments.Nov 14 2014, 9:12 AM
test/asan/lit.cfg
126

Sorry, I thought Alexey had taken over this review.

Is there any way we could get rid of the code duplication between test/asan/lit.cfg and test/asan/Unit/lit.site.cfg.in?

samsonov accepted this revision.Nov 14 2014, 10:38 AM
samsonov edited edge metadata.

LGTM. Let's proceed with this small change for now.

This revision is now accepted and ready to land.Nov 14 2014, 10:38 AM
foad closed this revision.Nov 15 2014, 3:00 PM
foad added inline comments.Nov 15 2014, 3:04 PM
test/asan/lit.cfg
126

I agree it would be nice to get rid of the duplication, but I don't feel confident enough with lit configuration to do it myself. Maybe it belongs in test/lit.common.cfg?

earthdok added inline comments.Nov 19 2014, 6:43 AM
test/asan/lit.cfg
126

That makes sense to me. Alexey?

samsonov added inline comments.Nov 19 2014, 1:22 PM
test/asan/lit.cfg
126

Hm? Doesn't "leak-detection" feature make sense only for ASan tests? Unfortunately, configs for lit-tests and unit tests are different. I'd submit the change as-is.

earthdok added inline comments.Nov 19 2014, 1:40 PM
test/asan/lit.cfg
126

MSan as well, eventually. Any tool that does not support it will simply not have any tests that depend on this feature.

samsonov added inline comments.Nov 19 2014, 3:12 PM
test/asan/lit.cfg
126

Alright, let's define "leak-detection" feature in test/lit.common.cfg and then setup ASAN_OPTIONS here if this feature is enabled.

foad added a comment.Nov 24 2014, 3:26 PM

I committed this but had to revert it, because it broke the asan testsuite's 32bitConfig on x86_64. I've had another go in D6396.