[memprof] Upgrade a unit test to MemProf Version 3 (#117063)
[llvm-project.git] / openmp / runtime / test / env / omp_wait_policy.c
blobb260ce408cc3fdc44bb28ed2787268dcd494320a
1 // RUN: %libomp-compile && env OMP_WAIT_POLICY=active %libomp-run active
2 // RUN: %libomp-compile && env OMP_WAIT_POLICY=passive %libomp-run passive
3 //
4 // OMP_WAIT_POLICY=active should imply blocktime == INT_MAX
5 // i.e., threads spin-wait forever
6 // OMP_WAIT_POLICY=passive should imply blocktime == 0
7 // i.e., threads immediately sleep
8 #include <stdio.h>
9 #include <string.h>
10 #include <limits.h>
11 #include "omp_testsuite.h"
13 void usage() {
14 fprintf(stderr, "usage: omp_wait_policy active|passive\n");
17 int main(int argc, char** argv)
19 int blocktime, retval=1;
20 const char* env_var_value;
22 if (argc != 2) {
23 usage();
24 return 1;
27 blocktime = kmp_get_blocktime();
29 env_var_value = argv[1];
30 if (!strcmp(env_var_value, "active")) {
31 retval = (blocktime != INT_MAX);
32 } else if (!strcmp(env_var_value, "passive")) {
33 retval = (blocktime != 0);
34 } else {
35 usage();
36 retval = 1;
39 return retval;