Skip to content

Commit 9a7f674

Browse files
committed
[compiler-rt][asan][tests] Reland: Stabilize wchar tests on Darwin/Android (test-only)
Reland of llvm#161624; depends on revert llvm#162001. - Android: keep %env_asan_opts=log_to_stderr=1. - Darwin: use CHECK-DAG for the pre-crash marker and header; frame line matches function only. - Common: reuse [[ADDR]]. NFC: test-only. Signed-off-by: Yixuan Cao <[email protected]>
1 parent 90d5795 commit 9a7f674

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

compiler-rt/test/asan/TestCases/wcscat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ int main() {
1616
wchar_t badDst[9];
1717
wcscpy(badDst, start);
1818
fprintf(stderr, "Good so far.\n");
19-
// CHECK: Good so far.
19+
// CHECK-DAG: Good so far.
2020
fflush(stderr);
2121
wcscat(badDst, append); // Boom!
22-
// CHECK: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
22+
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
2323
// CHECK: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
2424
// CHECK: #0 {{0x[0-9a-f]+}} in wcscat
2525
printf("Should have failed with ASAN error.\n");

compiler-rt/test/asan/TestCases/wcscpy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ int main() {
1313

1414
wchar_t badDst[7];
1515
fprintf(stderr, "Good so far.\n");
16-
// CHECK: Good so far.
16+
// CHECK-DAG: Good so far.
1717
fflush(stderr);
1818
wcscpy(badDst, src); // Boom!
19-
// CHECK: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
19+
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
2020
// CHECK: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
2121
// CHECK: #0 {{0x[0-9a-f]+}} in wcscpy
2222
printf("Should have failed with ASAN error.\n");

compiler-rt/test/asan/TestCases/wcsncat.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ int main() {
1717
wcscpy(badDst, start);
1818
wcsncat(badDst, append, 1);
1919
fprintf(stderr, "Good so far.\n");
20-
// CHECK: Good so far.
20+
// CHECK-DAG: Good so far.
2121
fflush(stderr);
2222
wcsncat(badDst, append, 3); // Boom!
23-
// CHECK: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
23+
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
2424
// CHECK: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
2525
// CHECK: #0 {{0x[0-9a-f]+}} in wcsncat
2626
printf("Should have failed with ASAN error.\n");

compiler-rt/test/asan/TestCases/wcsncpy.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ int main() {
1414
wchar_t badDst[7];
1515
wcsncpy(badDst, src, 7); // This should still work.
1616
fprintf(stderr, "Good so far.\n");
17-
// CHECK: Good so far.
17+
// CHECK-DAG: Good so far.
1818
fflush(stderr);
1919

2020
wcsncpy(badDst, src, 15); // Boom!
21-
// CHECK: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
21+
// CHECK-DAG: ERROR: AddressSanitizer: stack-buffer-overflow on address [[ADDR:0x[0-9a-f]+]] at pc {{0x[0-9a-f]+}} bp {{0x[0-9a-f]+}} sp {{0x[0-9a-f]+}}
2222
// CHECK: WRITE of size {{[0-9]+}} at [[ADDR]] thread T0
2323
// CHECK: #0 {{0x[0-9a-f]+}} in wcsncpy
2424
printf("Should have failed with ASAN error.\n");

0 commit comments

Comments
 (0)