File tree 5 files changed +50
-19
lines changed
5 files changed +50
-19
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,13 @@ endif()
60
60
foreach (arch ${RTSAN_TEST_ARCH} )
61
61
set (RtsanTestObjects)
62
62
63
- # TODO: Re-enable once -fsanitize=realtime exists in clang driver
64
- #generate_compiler_rt_tests(RtsanTestObjects
65
- # RtsanUnitTests "Rtsan-${arch}-Test" ${arch}
66
- # COMPILE_DEPS ${RTSAN_UNITTEST_HEADERS}
67
- # SOURCES ${RTSAN_INST_TEST_SOURCES} ${COMPILER_RT_GOOGLETEST_SOURCES}
68
- # DEPS rtsan
69
- # CFLAGS ${RTSAN_UNITTEST_CFLAGS} -fsanitize=realtime
70
- # LINK_FLAGS ${RTSAN_UNITTEST_LINK_FLAGS} -fsanitize=realtime)
63
+ generate_compiler_rt_tests(RtsanTestObjects
64
+ RtsanUnitTests "Rtsan-${arch} -Test" ${arch}
65
+ COMPILE_DEPS ${RTSAN_UNITTEST_HEADERS}
66
+ SOURCES ${RTSAN_INST_TEST_SOURCES} ${COMPILER_RT_GOOGLETEST_SOURCES}
67
+ DEPS rtsan
68
+ CFLAGS ${RTSAN_UNITTEST_CFLAGS} -fsanitize=realtime
69
+ LINK_FLAGS ${RTSAN_UNITTEST_LINK_FLAGS} -fsanitize=realtime)
71
70
72
71
set (RTSAN_TEST_RUNTIME RTRtsanTest.${arch} )
73
72
if (APPLE )
Original file line number Diff line number Diff line change 1
-
2
-
3
-
4
-
5
- ######
6
- # TODO: Full lit tests coming in a future review when we introduce the codegen
7
- ######
8
-
9
-
10
-
11
-
12
1
set (RTSAN_LIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
13
2
14
3
set (RTSAN_TESTSUITES)
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx -fsanitize=realtime %s -o %t
2
+ // RUN: not %run %t 2>&1 | FileCheck %s
3
+ // UNSUPPORTED: ios
4
+
5
+ // Intent: Ensure that an intercepted call in a [[clang::nonblocking]] function
6
+ // is flagged as an error. Basic smoke test.
7
+
8
+ #include < stdlib.h>
9
+
10
+ void violation () [[clang::nonblocking]] { void *Ptr = malloc (2 ); }
11
+
12
+ int main () {
13
+ violation ();
14
+ return 0 ;
15
+ // CHECK: {{.*Real-time violation.*}}
16
+ // CHECK: {{.*malloc*}}
17
+ }
Original file line number Diff line number Diff line change
1
+ // RUN: %clangxx %s -o %t
2
+ // RUN: %run %t 2>&1 | FileCheck %s
3
+ // UNSUPPORTED: ios
4
+
5
+ // Intent: Ensure [[clang::nonblocking]] has no impact if -fsanitize=realtime is not used
6
+
7
+ #include < stdio.h>
8
+ #include < stdlib.h>
9
+
10
+ // In this test, we don't use the -fsanitize=realtime flag, so nothing
11
+ // should happen here
12
+ void violation () [[clang::nonblocking]] { void *Ptr = malloc (2 ); }
13
+
14
+ int main () {
15
+ printf (" Starting run\n " );
16
+ violation ();
17
+ printf (" No violations ended the program\n " );
18
+ return 0 ;
19
+ // CHECK: {{.*Starting run.*}}
20
+ // CHECK NOT: {{.*Real-time violation.*}}
21
+ // CHECK NOT: {{.*malloc*}}
22
+ // CHECK: {{.*No violations ended the program.*}}
23
+ }
Original file line number Diff line number Diff line change 18
18
tool_options = "HWASAN_OPTIONS"
19
19
if not config .has_lld :
20
20
config .unsupported = True
21
+ elif config .tool_name == "rtsan" :
22
+ tool_cflags = ["-fsanitize=realtime" ]
23
+ tool_options = "RTSAN_OPTIONS"
21
24
elif config .tool_name == "tsan" :
22
25
tool_cflags = ["-fsanitize=thread" ]
23
26
tool_options = "TSAN_OPTIONS"
You can’t perform that action at this time.
0 commit comments