diff --git a/tests/empty_string.c b/tests/empty_string.c index ed19969..5e34a5e 100644 --- a/tests/empty_string.c +++ b/tests/empty_string.c @@ -28,6 +28,12 @@ int main(void) fail_unless(cfg_print(cfg, f) == CFG_SUCCESS); cfg_free(cfg); +#if defined(__has_feature) +# if __has_feature(address_sanitizer) || __has_feature(memory_sanitizer) + /* Skip check since fmemopen(2) is broken with sanitizers, see + * https://github.com/google/sanitizers/issues/628 + */ +# else /* * try to reload the generated temporary config file to check * that the default is indeed overridden by an empty string @@ -36,9 +42,12 @@ int main(void) fail_unless(cfg != NULL); fail_unless(fseek(f, 0L, SEEK_SET) == 0); fail_unless(cfg_parse_fp(cfg, f) == CFG_SUCCESS); - fclose(f); fail_unless(strcmp(cfg_getstr(cfg, "string"), "") == 0); cfg_free(cfg); +# endif +#endif + + fclose(f); return 0; } diff --git a/tests/print_filter.c b/tests/print_filter.c index 8522d7f..eeb2b21 100644 --- a/tests/print_filter.c +++ b/tests/print_filter.c @@ -42,6 +42,12 @@ int main(void) fail_unless(cfg_print(cfg, f) == CFG_SUCCESS); fclose(f); +#if defined(__has_feature) +# if __has_feature(memory_sanitizer) + /* Skip check since fmemopen(2) is broken with sanitizers, see + * https://github.com/google/sanitizers/issues/628 + */ +# else fprintf(stderr, "no_foo filter:\n%s", buf); fail_unless(strstr(buf, "foo-") == NULL); fail_unless(strstr(buf, "bar-") != NULL); @@ -56,6 +62,8 @@ int main(void) fprintf(stderr, "no_bar filter:\n%s", buf); fail_unless(strstr(buf, "foo-") != NULL); fail_unless(strstr(buf, "bar-") == NULL); +# endif +#endif cfg_free(cfg);