diff options
author | Tim Shen <timshen91@gmail.com> | 2017-05-10 16:07:03 +0000 |
---|---|---|
committer | Tim Shen <timshen91@gmail.com> | 2017-05-10 16:07:03 +0000 |
commit | 1846d403b631a38e8e4429b5c31e2c37132e416e (patch) | |
tree | 7bb1a6ee34cb9a94a91dae14335bde916aa89c8d /test/xray | |
parent | ae4021dc255683b963bb012c7a4be821ea9d145d (diff) |
[XRay] Fix the test func-id-utils.cc on PPC.
Summary:
The test fails on PPC, because the address of a function may vary
depending on whether the "taker" shares the same ToC (roughly, in the
same "module") as the function.
Therefore the addresses of the functions taken in func-id-utils.cc may be
different from the addresses taken in xray runtime.
Change the test to be permissive on address comparison.
Reviewers: dberris, echristo
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33026
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302686 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/xray')
-rw-r--r-- | test/xray/TestCases/Linux/func-id-utils.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/test/xray/TestCases/Linux/func-id-utils.cc b/test/xray/TestCases/Linux/func-id-utils.cc index 82ba34d30..c9a2952c6 100644 --- a/test/xray/TestCases/Linux/func-id-utils.cc +++ b/test/xray/TestCases/Linux/func-id-utils.cc @@ -3,8 +3,6 @@ // // RUN: %clangxx_xray -std=c++11 %s -o %t // RUN: XRAY_OPTIONS="patch_premain=false xray_naive_log=false" %run %t -// FIXME: When we know why this fails in ppc, un-xfail it. -// XFAIL: powerpc64le #include "xray/xray_interface.h" #include <algorithm> @@ -32,13 +30,21 @@ assert(all_instrumented.size() == __xray_max_function_id() && "each function id must be assigned to a unique function"); - std::set<void *> common; - std::set_intersection(all_instrumented.begin(), all_instrumented.end(), - must_be_instrumented.begin(), - must_be_instrumented.end(), - std::inserter(common, common.begin())); + std::set<void *> not_instrumented; + const auto comp = [](void *lhs, void *rhs) { +#ifdef __PPC__ + return reinterpret_cast<uintptr_t>(lhs) + 8 < + reinterpret_cast<uintptr_t>(rhs); +#else + return lhs < rhs; +#endif + }; + std::set_difference(must_be_instrumented.begin(), must_be_instrumented.end(), + all_instrumented.begin(), all_instrumented.end(), + std::inserter(not_instrumented, not_instrumented.begin()), + comp); assert( - common == must_be_instrumented && + not_instrumented.empty() && "we should see all explicitly instrumented functions with function ids"); - return common == must_be_instrumented ? 0 : 1; + return not_instrumented.empty() ? 0 : 1; } |