[Openmp-commits] [openmp] 970e745 - [Libomptarget] Add a test for the `libc` implementation of assert (#69518)
via Openmp-commits
openmp-commits at lists.llvm.org
Thu Oct 19 05:55:49 PDT 2023
Author: Joseph Huber
Date: 2023-10-19T08:55:45-04:00
New Revision: 970e7456e0346f078962fa88bdc1b86fd9828d6f
URL: https://github.com/llvm/llvm-project/commit/970e7456e0346f078962fa88bdc1b86fd9828d6f
DIFF: https://github.com/llvm/llvm-project/commit/970e7456e0346f078962fa88bdc1b86fd9828d6f.diff
LOG: [Libomptarget] Add a test for the `libc` implementation of assert (#69518)
Summary:
The `libcgpu.a` file provides its own implementation of `__assert_fail`.
This adds a test to make sure it's usable in OpenMP offloading as
expected. Currently this requires linking `libcgpu.a` before the OpenMP
device RTL however. We also disable the test on the CPU as the format of
the string will be different.
Added:
openmp/libomptarget/test/libc/assert.c
Modified:
Removed:
################################################################################
diff --git a/openmp/libomptarget/test/libc/assert.c b/openmp/libomptarget/test/libc/assert.c
new file mode 100644
index 000000000000000..9a10032f481893d
--- /dev/null
+++ b/openmp/libomptarget/test/libc/assert.c
@@ -0,0 +1,21 @@
+// RUN: %libomptarget-compile-generic && %libomptarget-run-fail-generic 2>&1 | \
+// RUN: %fcheck-generic --check-prefix=CHECK
+
+// REQUIRES: libc
+
+// UNSUPPORTED: powerpc64-ibm-linux-gnu
+// UNSUPPORTED: powerpc64-ibm-linux-gnu-LTO
+// UNSUPPORTED: aarch64-unknown-linux-gnu
+// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
+// UNSUPPORTED: x86_64-pc-linux-gnu
+// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
+
+#include <assert.h>
+
+int main() {
+ // CHECK: Assertion failed: '0 && "Trivial failure"' in function: 'int main()'
+ // CHECK-NOT: Assertion failed:
+#pragma omp target
+#pragma omp parallel
+ { assert(0 && "Trivial failure"); }
+}
More information about the Openmp-commits
mailing list