summaryrefslogtreecommitdiff
path: root/tests/modules
diff options
context:
space:
mode:
authorkamil <kamil@NetBSD.org>2019-02-24 21:14:43 +0000
committerkamil <kamil@NetBSD.org>2019-02-24 21:14:43 +0000
commit04877f486c3133e9005a58c9102295b4cf563fdb (patch)
tree1e9eeeed7d6dc30cd66f80bfc55aabeb3bf175da /tests/modules
parent247cc71a38c9693a364fa139c9852d5f992e5849 (diff)
Add KCOV_LOAD() and KCOV_STORE() - new helper macros
New macros prefer 64-bit atomic operations whenever accessible. As a fallback they use volatile move operations that are not known to have negative effect in KCOV even if interrupted in the middle of operation. Enable kcov_basic and kcov_thread tests on targets without __HAVE_ATOMIC64_OPS.
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/t_kcov.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/modules/t_kcov.c b/tests/modules/t_kcov.c
index 5b9663d48c7..bcd92e7eb6d 100644
--- a/tests/modules/t_kcov.c
+++ b/tests/modules/t_kcov.c
@@ -254,10 +254,10 @@ ATF_TC_BODY(kcov_basic, tc)
ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_ENABLE) == 0,
"Unable to enable kcov ");
- __atomic_store_n(&buf[0], 0 , __ATOMIC_RELAXED);
+ KCOV_STORE(&buf[0], 0);
sleep(0);
- ATF_REQUIRE_MSG(__atomic_load_n(&buf[0], __ATOMIC_RELAXED) != 0, "No records found");
+ ATF_REQUIRE_MSG(KCOV_LOAD(&buf[0]) != 0, "No records found");
ATF_REQUIRE_MSG(ioctl(fd, KCOV_IOC_DISABLE) == 0,
"Unable to disable kcov");
@@ -270,9 +270,9 @@ thread_test_helper(void *ptr)
{
kcov_int_t *buf = ptr;
- __atomic_store_n(&buf[0], 0, __ATOMIC_RELAXED);
+ KCOV_STORE(&buf[0], 0);
sleep(0);
- ATF_REQUIRE_MSG(__atomic_load_n(&buf[0], __ATOMIC_RELAXED) == 0,
+ ATF_REQUIRE_MSG(KCOV_LOAD(&buf[0]) == 0,
"Records changed in blocked thread");
return NULL;
@@ -311,9 +311,7 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, kcov_enable_no_disable);
ATF_TP_ADD_TC(tp, kcov_enable_no_disable_no_close);
ATF_TP_ADD_TC(tp, kcov_mmap_enable_thread_close);
-#ifdef __HAVE_ATOMIC64_OPS
ATF_TP_ADD_TC(tp, kcov_basic);
ATF_TP_ADD_TC(tp, kcov_thread);
-#endif
return atf_no_error();
}