[compiler-rt] r247325 - CFI: Run the tests only on supported architectures/OSs.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 12:18:09 PDT 2015


Author: pcc
Date: Thu Sep 10 14:18:08 2015
New Revision: 247325

URL: http://llvm.org/viewvc/llvm-project?rev=247325&view=rev
Log:
CFI: Run the tests only on supported architectures/OSs.

Specifically, only run the cfi-icall tests on x86/x86_64, and add
an XFAIL for darwin.

Added:
    compiler-rt/trunk/test/cfi/icall/
    compiler-rt/trunk/test/cfi/icall/bad-signature.c
      - copied, changed from r247239, compiler-rt/trunk/test/cfi/bad-signature.c
    compiler-rt/trunk/test/cfi/icall/external-call.c
      - copied, changed from r247239, compiler-rt/trunk/test/cfi/external-call.c
    compiler-rt/trunk/test/cfi/icall/lit.local.cfg
Removed:
    compiler-rt/trunk/test/cfi/bad-signature.c
    compiler-rt/trunk/test/cfi/external-call.c

Removed: compiler-rt/trunk/test/cfi/bad-signature.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/bad-signature.c?rev=247324&view=auto
==============================================================================
--- compiler-rt/trunk/test/cfi/bad-signature.c (original)
+++ compiler-rt/trunk/test/cfi/bad-signature.c (removed)
@@ -1,27 +0,0 @@
-// RUN: %clangxx -o %t1 %s
-// RUN: %t1 2>&1 | FileCheck --check-prefix=NCFI %s
-
-// RUN: %clangxx_cfi -o %t2 %s
-// RUN: %expect_crash %t2 2>&1 | FileCheck --check-prefix=CFI %s
-
-// RUN: %clangxx_cfi_diag -g -o %t3 %s
-// RUN: %t3 2>&1 | FileCheck --check-prefix=CFI-DIAG %s
-
-#include <stdio.h>
-
-void f() {
-}
-
-int main() {
-  // CFI: 1
-  // NCFI: 1
-  fprintf(stderr, "1\n");
-
-  // CFI-DIAG: runtime error: control flow integrity check for type 'void (int)' failed during indirect function call
-  // CFI-DIAG: f() defined here
-  ((void (*)(int))f)(42); // UB here
-
-  // CFI-NOT: 2
-  // NCFI: 2
-  fprintf(stderr, "2\n");
-}

Removed: compiler-rt/trunk/test/cfi/external-call.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/external-call.c?rev=247324&view=auto
==============================================================================
--- compiler-rt/trunk/test/cfi/external-call.c (original)
+++ compiler-rt/trunk/test/cfi/external-call.c (removed)
@@ -1,23 +0,0 @@
-// RUN: %clangxx_cfi -o %t1 %s
-// RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s
-// RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-
-int main(int argc, char **argv) {
-  // CFI: 1
-  fprintf(stderr, "1\n");
-
-  double (*fn)(double);
-  if (argv[1][0] == 's')
-    fn = sin;
-  else
-    fn = cos;
-
-  fn(atof(argv[2]));
-
-  // CFI: 2
-  fprintf(stderr, "2\n");
-}

Copied: compiler-rt/trunk/test/cfi/icall/bad-signature.c (from r247239, compiler-rt/trunk/test/cfi/bad-signature.c)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/icall/bad-signature.c?p2=compiler-rt/trunk/test/cfi/icall/bad-signature.c&p1=compiler-rt/trunk/test/cfi/bad-signature.c&r1=247239&r2=247325&rev=247325&view=diff
==============================================================================
    (empty)

Copied: compiler-rt/trunk/test/cfi/icall/external-call.c (from r247239, compiler-rt/trunk/test/cfi/external-call.c)
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/icall/external-call.c?p2=compiler-rt/trunk/test/cfi/icall/external-call.c&p1=compiler-rt/trunk/test/cfi/external-call.c&r1=247239&r2=247325&rev=247325&view=diff
==============================================================================
--- compiler-rt/trunk/test/cfi/external-call.c (original)
+++ compiler-rt/trunk/test/cfi/icall/external-call.c Thu Sep 10 14:18:08 2015
@@ -2,6 +2,10 @@
 // RUN: %t1 c 1 2>&1 | FileCheck --check-prefix=CFI %s
 // RUN: %t1 s 2 2>&1 | FileCheck --check-prefix=CFI %s
 
+// This test uses jump tables containing PC-relative references to external
+// symbols, which the Mach-O object writer does not currently support.
+// XFAIL: darwin
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>

Added: compiler-rt/trunk/test/cfi/icall/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/cfi/icall/lit.local.cfg?rev=247325&view=auto
==============================================================================
--- compiler-rt/trunk/test/cfi/icall/lit.local.cfg (added)
+++ compiler-rt/trunk/test/cfi/icall/lit.local.cfg Thu Sep 10 14:18:08 2015
@@ -0,0 +1,3 @@
+# The cfi-icall checker is only supported on x86 and x86_64 for now.
+if config.root.host_arch not in ['x86', 'x86_64']:
+  config.unsupported = True




More information about the llvm-commits mailing list