This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt] [test] Disable sunrpc tests when rpc/xdr.h is missing
ClosedPublic

Authored by mgorny on Jun 6 2018, 3:55 AM.

Details

Summary

Disable tests requiring sunrpc when the relevant headers are missing.
In order to accommodate that, move the header check
from sanitizer_common to base-config-ix, and define the check result
as a global variable there. Use it afterwards both for definition
needed by sanitizer_common, and to control 'sunrpc' test feature.

While at it, remove the append_have_file_definition macro that was used
only once, and no longer fits the split check-definition.

Diff Detail

Event Timeline

mgorny created this revision.Jun 6 2018, 3:55 AM
Herald added subscribers: Restricted Project, llvm-commits, kubamracek. · View Herald TranscriptJun 6 2018, 3:55 AM

Gentle ping.

Ping. This is necessary to resolve https://github.com/google/sanitizers/issues/974 and fix tests on systems which don't enable all the backwards compatibility cruft (Arch, Gentoo). See also D47817 as necessary dependency.

mgorny updated this revision to Diff 171647.Oct 30 2018, 2:08 AM

Rebased.

mgorny updated this revision to Diff 179454.Dec 23 2018, 2:59 PM
mgorny retitled this revision from [test] Support using libtirpc on Linux to [compiler-rt] [test] Support using libtirpc on Linux.
mgorny edited the summary of this revision. (Show Details)
mgorny added a reviewer: Lekensteyn.
mgorny set the repository for this revision to rCRT Compiler Runtime.

Updated to use find_package().

mgorny updated this revision to Diff 179455.Dec 23 2018, 3:25 PM

Fix bug in previous patch.

mgorny planned changes to this revision.Jan 9 2019, 7:31 PM

Need to update this for the new idea of not using libtirpc at all.

mgorny updated this revision to Diff 181133.Jan 10 2019, 12:45 PM
mgorny retitled this revision from [compiler-rt] [test] Support using libtirpc on Linux to [compiler-rt] [test] Disable sunrpc tests when rpc/xdr.h is missing.
mgorny edited the summary of this revision. (Show Details)
mgorny added a reviewer: vitalybuka.

Following the changes to D47817, updated this one to disable relevant tests when sunrpc headers are not available.

Ping. I'd really like to merge this before the branch.

The direction of this patch looks reasonable to me. Is it worth mentioning the issue (https://github.com/google/sanitizers/issues/974) in the commit message?

What environment have you tested this in, could you verify that the tests are indeed skipped on a system without these headers, and passed otherwise?

lib/sanitizer_common/CMakeLists.txt
196

The old code defined HAVE_xxx to 0 or 1, but in general wouldn't it be preferable to define it to 1 if available, and not define it at all if unavailable? This would match most other HAVE_xxx checks.

In order to make the lit config work in this case, you have to use something like pythonize_bool(HAVE_RPC_XDR_H).

test/lit.common.configured.in
39

This becomes 0 or 1 instead of True or False, not sure if that will cause issues later.

mgorny marked 2 inline comments as done.Jan 14 2019, 10:05 AM

The direction of this patch looks reasonable to me. Is it worth mentioning the issue (https://github.com/google/sanitizers/issues/974) in the commit message?

Yes, makes sense. I'll add it when committing.

What environment have you tested this in, could you verify that the tests are indeed skipped on a system without these headers, and passed otherwise?

I have only tests without those headers. I'll try to rebuild glibc with them enabled if it's still supported but it'd be preferable if somebody else tested it on 'natural' environment.

lib/sanitizer_common/CMakeLists.txt
196

Well, I suppose I could do that but given that the old code did it like this, the 0/1 definition seems to be a common practice in compiler-rt, and there is no apparent benefit from doing it the other way, I don't think it a good thing to do.

test/lit.common.configured.in
39

It shouldn't. 0/1 evaluates the same in boolean context, and other LLVM tests are relying on 0/1 being passed to lit already.

PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_bytes.cc (2932 of 6195)
PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_string.cc (2935 of 6195)
PASS: MemorySanitizer-X86_64 :: Linux/sunrpc.cc (2974 of 6195)
PASS: ThreadSanitizer-x86_64 :: sunrpc.cc (5110 of 6195)

So yep, it works. Tested both ways now.

Lekensteyn accepted this revision.Jan 14 2019, 10:41 AM
PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_bytes.cc (2932 of 6195)
PASS: MemorySanitizer-X86_64 :: Linux/sunrpc_string.cc (2935 of 6195)
PASS: MemorySanitizer-X86_64 :: Linux/sunrpc.cc (2974 of 6195)
PASS: ThreadSanitizer-x86_64 :: sunrpc.cc (5110 of 6195)

So yep, it works. Tested both ways now.

Thanks for testing! It looks good to me.

This revision is now accepted and ready to land.Jan 14 2019, 10:41 AM
This revision was automatically updated to reflect the committed changes.