summaryrefslogtreecommitdiff
path: root/test/xray
diff options
context:
space:
mode:
authorDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
committerDean Michael Berris <dberris@google.com>2017-11-10 05:50:13 +0000
commitac4508cf5b04a7e52c4f565b55f6787a9ea47bc0 (patch)
tree8964f9f48eafc3b98df645930e0aa66dcccdb23e /test/xray
parent6b924b53feb27108a9b7a3f3705e58d5b3980756 (diff)
[XRay][darwin] Initial XRay in Darwin Support
Summary: This change implements the changes required in both clang and compiler-rt to allow building XRay-instrumented binaries in Darwin. For now we limit this to x86_64. We also start building the XRay runtime library in compiler-rt for osx. A caveat to this is that we don't have the tests set up and running yet, which we'll do in a set of follow-on changes. This patch uses the monorepo layout for the coordinated change across multiple projects. Reviewers: kubamracek Subscribers: mgorny, cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D39114 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@317875 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/xray')
-rw-r--r--test/xray/TestCases/Darwin/always-never-instrument.cc23
-rw-r--r--test/xray/TestCases/Darwin/lit.local.cfg9
-rw-r--r--test/xray/TestCases/Linux/lit.local.cfg9
-rw-r--r--test/xray/lit.cfg2
4 files changed, 42 insertions, 1 deletions
diff --git a/test/xray/TestCases/Darwin/always-never-instrument.cc b/test/xray/TestCases/Darwin/always-never-instrument.cc
new file mode 100644
index 000000000..4e196859b
--- /dev/null
+++ b/test/xray/TestCases/Darwin/always-never-instrument.cc
@@ -0,0 +1,23 @@
+// Test that the always/never instrument lists apply.
+// RUN: echo "fun:main" > %tmp-always.txt
+// RUN: echo "fun:__xray*" > %tmp-never.txt
+// RUN: %clangxx_xray \
+// RUN: -fxray-never-instrument=%tmp-never.txt \
+// RUN: -fxray-always-instrument=%tmp-always.txt \
+// RUN: %s -o %t
+// RUN: %llvm_xray extract -symbolize %t | \
+// RUN: FileCheck %s --check-prefix NOINSTR
+// RUN: %llvm_xray extract -symbolize %t | \
+// RUN: FileCheck %s --check-prefix ALWAYSINSTR
+// REQUIRES: x86_64-linux
+// REQUIRES: built-in-llvm-tree
+
+// NOINSTR-NOT: {{.*__xray_NeverInstrumented.*}}
+int __xray_NeverInstrumented() {
+ return 0;
+}
+
+// ALWAYSINSTR: {{.*function-name:.*main.*}}
+int main(int argc, char *argv[]) {
+ return __xray_NeverInstrumented();
+}
diff --git a/test/xray/TestCases/Darwin/lit.local.cfg b/test/xray/TestCases/Darwin/lit.local.cfg
new file mode 100644
index 000000000..a85dfcd24
--- /dev/null
+++ b/test/xray/TestCases/Darwin/lit.local.cfg
@@ -0,0 +1,9 @@
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+if root.host_os not in ['Darwin']:
+ config.unsupported = True
diff --git a/test/xray/TestCases/Linux/lit.local.cfg b/test/xray/TestCases/Linux/lit.local.cfg
new file mode 100644
index 000000000..57271b807
--- /dev/null
+++ b/test/xray/TestCases/Linux/lit.local.cfg
@@ -0,0 +1,9 @@
+def getRoot(config):
+ if not config.parent:
+ return config
+ return getRoot(config.parent)
+
+root = getRoot(config)
+
+if root.host_os not in ['Linux']:
+ config.unsupported = True
diff --git a/test/xray/lit.cfg b/test/xray/lit.cfg
index d5e40975d..c6bea52b1 100644
--- a/test/xray/lit.cfg
+++ b/test/xray/lit.cfg
@@ -40,7 +40,7 @@ config.substitutions.append(
# Default test suffixes.
config.suffixes = ['.c', '.cc', '.cpp']
-if config.host_os not in ['Linux']:
+if config.host_os not in ['Linux', 'Darwin']:
config.unsupported = True
elif '64' not in config.host_arch:
if 'arm' in config.host_arch: