From ba62513682b61f3eadb1ec82c7aa0beee6d58836 Mon Sep 17 00:00:00 2001 From: Robert Konicar Date: Thu, 1 Aug 2024 13:15:10 +0200 Subject: [PATCH] test: Enable objectfile tests only when %cc is set to clang. --- test/lit.cfg.py | 3 +++ test/vast/Compile/ObjectFiles/call-struct-float-a.c | 1 + test/vast/Compile/ObjectFiles/call-struct-float-b.c | 1 + test/vast/Compile/ObjectFiles/float-a.c | 1 + test/vast/Compile/ObjectFiles/identity-a.c | 1 + test/vast/Compile/ObjectFiles/struct-a.c | 1 + test/vast/Compile/ObjectFiles/struct-b.c | 1 + test/vast/Compile/ObjectFiles/void-return-a.c | 1 + test/vast/Compile/ObjectFiles/x86_64/call-array-a.c | 1 + test/vast/Compile/ObjectFiles/x86_64/call-array-b.c | 1 + test/vast/Compile/ObjectFiles/x86_64/call-array-c.c | 1 + test/vast/Compile/ObjectFiles/x86_64/call-array-d.c | 1 + test/vast/Compile/ObjectFiles/x86_64/one-element-array-a.c | 1 + test/vast/Compile/ObjectFiles/x86_64/one-element-array-b.c | 1 + 14 files changed, 16 insertions(+) diff --git a/test/lit.cfg.py b/test/lit.cfg.py index ed95e25ebc..96758a441a 100644 --- a/test/lit.cfg.py +++ b/test/lit.cfg.py @@ -143,6 +143,9 @@ tool.command = os.path.join(*path, tool.command) llvm_config.add_tool_substitutions([tool]) +if config.host_cc.find('clang') != -1: + config.available_features.add("clang") + stdbit_test = subprocess.run(["cc", "-x", "c", "-", "-o", "/dev/null"], input=b'#include \n int main() {}', capture_output=True) diff --git a/test/vast/Compile/ObjectFiles/call-struct-float-a.c b/test/vast/Compile/ObjectFiles/call-struct-float-a.c index fd5493c500..7eda57a09a 100644 --- a/test/vast/Compile/ObjectFiles/call-struct-float-a.c +++ b/test/vast/Compile/ObjectFiles/call-struct-float-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && %t | %file-check %s.driver +// REQUIRES: clang struct d_data { diff --git a/test/vast/Compile/ObjectFiles/call-struct-float-b.c b/test/vast/Compile/ObjectFiles/call-struct-float-b.c index afb94520ba..898726e3e3 100644 --- a/test/vast/Compile/ObjectFiles/call-struct-float-b.c +++ b/test/vast/Compile/ObjectFiles/call-struct-float-b.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && %t | %file-check %s.driver +// REQUIRES: clang struct wrap { diff --git a/test/vast/Compile/ObjectFiles/float-a.c b/test/vast/Compile/ObjectFiles/float-a.c index 2170e81c47..489d895b44 100644 --- a/test/vast/Compile/ObjectFiles/float-a.c +++ b/test/vast/Compile/ObjectFiles/float-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && (%t; test $? -eq 0) +// REQUIRES: clang float float_sum(float a, float b) { diff --git a/test/vast/Compile/ObjectFiles/identity-a.c b/test/vast/Compile/ObjectFiles/identity-a.c index fd394ce58c..35fc6f9494 100644 --- a/test/vast/Compile/ObjectFiles/identity-a.c +++ b/test/vast/Compile/ObjectFiles/identity-a.c @@ -1,3 +1,4 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && (%t; test $? -eq 0) +// REQUIRES: clang int identity(int a) { return a; } diff --git a/test/vast/Compile/ObjectFiles/struct-a.c b/test/vast/Compile/ObjectFiles/struct-a.c index ed6215bb51..c167a40c05 100644 --- a/test/vast/Compile/ObjectFiles/struct-a.c +++ b/test/vast/Compile/ObjectFiles/struct-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct Data { diff --git a/test/vast/Compile/ObjectFiles/struct-b.c b/test/vast/Compile/ObjectFiles/struct-b.c index 071997b774..6c2d1de541 100644 --- a/test/vast/Compile/ObjectFiles/struct-b.c +++ b/test/vast/Compile/ObjectFiles/struct-b.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct W_i16 { diff --git a/test/vast/Compile/ObjectFiles/void-return-a.c b/test/vast/Compile/ObjectFiles/void-return-a.c index d8a39e1430..7941958b29 100644 --- a/test/vast/Compile/ObjectFiles/void-return-a.c +++ b/test/vast/Compile/ObjectFiles/void-return-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -c -vast-pipeline=with-abi -o %t.vast.o %s && %cc -c -xc %s.driver -o %t.clang.o && %cc %t.vast.o %t.clang.o -o %t && (%t; test $? -eq 0) +// REQUIRES: clang void nothing(int a) {} diff --git a/test/vast/Compile/ObjectFiles/x86_64/call-array-a.c b/test/vast/Compile/ObjectFiles/x86_64/call-array-a.c index a06403d2d2..8c430617d7 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/call-array-a.c +++ b/test/vast/Compile/ObjectFiles/x86_64/call-array-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -vast-pipeline=with-abi -S -emit-llvm -o %t.vast.ll %s && %cc -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang int sum(int array[2]) { diff --git a/test/vast/Compile/ObjectFiles/x86_64/call-array-b.c b/test/vast/Compile/ObjectFiles/x86_64/call-array-b.c index 4885676302..8eb0af13cd 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/call-array-b.c +++ b/test/vast/Compile/ObjectFiles/x86_64/call-array-b.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -S -emit-llvm -o %t.vast.ll %s && %cc -target x86_64 -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct data { int array[4]; diff --git a/test/vast/Compile/ObjectFiles/x86_64/call-array-c.c b/test/vast/Compile/ObjectFiles/x86_64/call-array-c.c index 0d25979aff..ea5d591a4f 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/call-array-c.c +++ b/test/vast/Compile/ObjectFiles/x86_64/call-array-c.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -S -emit-llvm -o %t.vast.ll %s && %cc -target x86_64 -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct data { short a; diff --git a/test/vast/Compile/ObjectFiles/x86_64/call-array-d.c b/test/vast/Compile/ObjectFiles/x86_64/call-array-d.c index fe98e33b1f..0c68a1a810 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/call-array-d.c +++ b/test/vast/Compile/ObjectFiles/x86_64/call-array-d.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -S -emit-llvm -o %t.vast.ll %s && %cc -target x86_64 -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang // Issue #605 // REQUIRES: abi-float-vectors diff --git a/test/vast/Compile/ObjectFiles/x86_64/one-element-array-a.c b/test/vast/Compile/ObjectFiles/x86_64/one-element-array-a.c index c35b27730e..3cd51dade3 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/one-element-array-a.c +++ b/test/vast/Compile/ObjectFiles/x86_64/one-element-array-a.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -S -emit-llvm -o %t.vast.ll %s && %cc -target x86_64 -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct data { int array[1]; diff --git a/test/vast/Compile/ObjectFiles/x86_64/one-element-array-b.c b/test/vast/Compile/ObjectFiles/x86_64/one-element-array-b.c index 6fd44e91bf..7cfb9fac2e 100644 --- a/test/vast/Compile/ObjectFiles/x86_64/one-element-array-b.c +++ b/test/vast/Compile/ObjectFiles/x86_64/one-element-array-b.c @@ -1,4 +1,5 @@ // RUN: %vast-front -target x86_64 -c -S -emit-llvm -o %t.vast.ll %s && %cc -target x86_64 -c -S -emit-llvm -xc %s.driver -o %t.clang.ll && %cc %t.vast.ll %t.clang.ll -o %t && (%t; test $? -eq 0) +// REQUIRES: clang struct data { float array[1];