Fix flaky strtok.c test.
Asserting the result of strtok when we expect delimiter overflow is
flaky, the result depends on the random state of memory right after the
delimiters.
@@ -36,7 +36,6 @@ void test1() {
__asan_poison_memory_region ((char *)&token_delimiter[1], 2);
token = strtok(s, token_delimiter);
// CHECK1:'token_delimiter' <== Memory access at offset {{[0-9]+}} partially overflows this variable
- assert(strcmp(token, "a") == 0);
}
// Check that we find overflows in the delimiters on the second call (str == NULL)
@@ -50,7 +49,6 @@ void test2() {
__asan_poison_memory_region ((char *)&token_delimiter[1], 2);
token = strtok(NULL, token_delimiter);
// CHECK2:'token_delimiter' <== Memory access at offset {{[0-9]+}} partially overflows this variable
- assert(strcmp(token, "c") == 0);
}
// Check that we find overflows in the string (only on the first call) with strict_string_checks.
@@ -61,7 +59,6 @@ void test3() {
__asan_poison_memory_region ((char *)&s[3], 2);
token = strtok(s, token_delimiter);
// CHECK3:'s' <== Memory access at offset {{[0-9]+}} partially overflows this variable
- assert(token == s);
}
// Check that we do not crash when strtok returns NULL with strict_string_checks.
@@ -82,7 +79,6 @@ void test5() {
__asan_poison_memory_region ((char *)&token_delimiter[1], 2);
token = strtok(s, token_delimiter);
// CHECK5:'s' <== Memory access at offset {{[0-9]+}} partially overflows this variable
- assert(token == s);
}
// Check that we find overflows in the delimiters (only on the first call) with !strict_string_checks.
@@ -93,7 +89,6 @@ void test6() {
__asan_poison_memory_region ((char *)&token_delimiter[1], 2);
token = strtok(s, &token_delimiter[1]);
// CHECK6:'token_delimiter' <== Memory access at offset {{[0-9]+}} overflows this variable
- assert(strcmp(token, "abc") == 0);
}
int main(int argc, char **argv) {
