File tree Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Expand file tree Collapse file tree 4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ if (sys != 'FreeBSD') and (sys != 'Windows') and not (sys == 'Linux' and config.
1414 if ' tsan' in config.enabled_rt_libs:
1515 config.available_features.add(' TSan' )
1616
17+ # Windows currently does not have real-time sanitizer support
18+ if sys != ' Windows' :
19+ if ' rtsan' in config.enabled_rt_libs:
20+ config.available_features.add(' RTSan' )
21+
1722# FreeBSD ASan and MSan don't cope well with ASLR (might do with FreeBSD 14 according to https://github.com/llvm/llvm-project/pull/73439)
1823if sys != ' FreeBSD' :
1924 if ' asan' in config.enabled_rt_libs:
Original file line number Diff line number Diff line change 1+ // Test druntime real-time violations
2+
3+ // REQUIRES: RTSan
4+
5+ // RUN: %ldc -g -O2 -fsanitize=realtime %s -of=%t%exe
6+ // RUN: not %t%exe 2>&1 | FileCheck %s
7+ import ldc.attributes;
8+
9+ // CHECK: ERROR: RealtimeSanitizer: blocking-call
10+ void main ()
11+ {
12+ // CHECK-NEXT: Call to blocking function `rt_init`
13+ }
Original file line number Diff line number Diff line change 1+ // Test simple realtime violations (marked blocking)
2+
3+ // REQUIRES: RTSan
4+
5+ // RUN: %ldc -g -O0 -fsanitize=realtime %s -of=%t%exe
6+ // RUN: not %t%exe 2>&1 | FileCheck %s
7+ import ldc.attributes;
8+
9+ // CHECK: ERROR: RealtimeSanitizer: blocking-call
10+ @realTimeUnsafe
11+ int blocking_function ()
12+ {
13+ return 42 ;
14+ }
15+
16+ extern (C ) int main(int argc, char ** argv)
17+ {
18+ // CHECK: Call to blocking function `_D21rtsan_marked_blocking17blocking_functionFZi`
19+ return blocking_function ();
20+ }
Original file line number Diff line number Diff line change 1+ // Test simple realtime violations
2+
3+ // REQUIRES: RTSan
4+
5+ // RUN: %ldc -g -O0 -fsanitize=realtime %s -of=%t%exe
6+ // RUN: not %t%exe 2>&1 | FileCheck %s
7+
8+ extern (C ) uint sleep(uint seconds);
9+
10+ // CHECK: ERROR: RealtimeSanitizer: unsafe-library-call
11+ void blocking_function ()
12+ {
13+ cast (void ) sleep (3 );
14+ }
15+
16+ extern (C ) int main(int argc, char ** argv)
17+ {
18+ blocking_function();
19+ return 0 ;
20+ }
You can’t perform that action at this time.
0 commit comments