LLVM OpenMP 20.0.0git
test_lock.c
Go to the documentation of this file.
1// RUN: %libomp-compile-and-run | FileCheck %s
2// REQUIRES: ompt
3
4#include "callback.h"
5#include <omp.h>
6
7int main()
8{
9 omp_lock_t lock;
10 omp_init_lock(&lock);
12
13 omp_test_lock(&lock);
15 omp_unset_lock(&lock);
17
18 omp_set_lock(&lock);
20 omp_test_lock(&lock);
22 omp_unset_lock(&lock);
24
25 omp_destroy_lock(&lock);
27
28 // Check if libomp supports the callbacks for this test.
29 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquire'
30 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_acquired'
31 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_mutex_released'
32 // CHECK-NOT: {{^}}0: Could not register callback 'ompt_callback_nest_lock'
33
34 // CHECK: 0: NULL_POINTER=[[NULL:.*$]]
35
36 // CHECK: {{^}}[[MASTER_ID:[0-9]+]]: ompt_event_init_lock: wait_id=[[WAIT_ID:[0-9]+]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
37 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
38 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
39 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_test_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
40 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
41 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
42 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
43 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
44 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_acquired_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS]]{{[0-f][0-f]}}
45 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
46 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_wait_test_lock: wait_id=[[WAIT_ID]], hint=0, impl={{[0-9]+}}, codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
47 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
48 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_release_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
49 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
50 // CHECK: {{^}}[[MASTER_ID]]: ompt_event_destroy_lock: wait_id=[[WAIT_ID]], codeptr_ra=[[RETURN_ADDRESS:0x[0-f]+]]{{[0-f][0-f]}}
51 // CHECK-NEXT: {{^}}[[MASTER_ID]]: fuzzy_address={{.*}}[[RETURN_ADDRESS]]
52
53 return 0;
54}
#define print_fuzzy_address(id)
Definition: callback.h:307
static kmp_bootstrap_lock_t lock
Definition: kmp_i18n.cpp:57
int main()
Definition: test_lock.c:7