Skip to content

Commit d927214

Browse files
authored
Cleanup test_asan_no_error test. NFC (#26674)
- Remove unnecessary command line flags - Check for test output - Return 0 from test (otherwise we don't actually detect asan failures). - Restore final checks to before #11578
1 parent 235b169 commit d927214

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

test/core/test_asan_no_error.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <stdlib.h>
22
#include <string.h>
3+
#include <stdio.h>
34

45
int f(char *x) {
56
int z = *x;
@@ -15,5 +16,8 @@ int main() {
1516
memchr("hello", 0, 6);
1617
strchr("hello", 'z');
1718
strlen("hello");
18-
return ((f(x) + y[9]) % 16) + 1;
19+
20+
printf("%d %d\n", f(x), y[9]);
21+
printf("done\n");
22+
return 0;
1923
}

test/core/test_asan_no_error.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdlib.h>
2+
#include <stdio.h>
23

34
int f(int *x) {
45
int z = *x;
@@ -9,5 +10,8 @@ int f(int *x) {
910
int main() {
1011
int *x = new int[10];
1112
static char y[10];
12-
return ((f(x) + y[9]) % 16) + 1;
13+
14+
printf("%d %d\n", f(x), y[9]);
15+
printf("done\n");
16+
return 0;
1317
}

test/test_core.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8958,9 +8958,7 @@ def test_template_class_deduction(self):
89588958
'cpp': ['test_asan_no_error.cpp'],
89598959
})
89608960
def test_asan_no_error(self, name):
8961-
self.set_setting('ALLOW_MEMORY_GROWTH')
8962-
self.set_setting('INITIAL_MEMORY', '300mb')
8963-
self.do_runf('core/' + name, '', assert_returncode=NON_ZERO, cflags=['-fsanitize=address'])
8961+
self.do_runf('core/' + name, 'done\n', cflags=['-fsanitize=address'])
89648962

89658963
# note: these tests have things like -fno-builtin-memset in order to avoid
89668964
# clang optimizing things away. for example, a memset might be optimized into

0 commit comments

Comments
 (0)