Skip to content

Commit 285f45d

Browse files
ye-luorlavaee
authored andcommitted
[libomptarget] Add a test for OMP_TARGET_OFFLOAD=disabled (llvm#146385)
closes llvm#144786
1 parent ae0ff7c commit 285f45d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %libomptarget-compile-generic
2+
// RUN: env OMP_TARGET_OFFLOAD=disabled %libomptarget-run-generic 2>&1 |
3+
// %fcheck-generic
4+
5+
#include <omp.h>
6+
#include <stdio.h>
7+
8+
// Sanity checks to make sure that this works and is thread safe.
9+
int main() {
10+
// CHECK: number of devices 0
11+
printf("number of devices %d\n", omp_get_num_devices());
12+
// CHECK:initial device 0
13+
printf("initial device %d\n", omp_get_initial_device());
14+
// CHECK:default device 0
15+
printf("default device %d\n", omp_get_default_device());
16+
// CHECK: PASS
17+
if (omp_get_initial_device() == omp_get_default_device()) {
18+
printf("PASS\n");
19+
return 0;
20+
}
21+
return 1;
22+
}

0 commit comments

Comments
 (0)