summaryrefslogtreecommitdiff
path: root/libmisc
diff options
context:
space:
mode:
Diffstat (limited to 'libmisc')
-rw-r--r--libmisc/tests/test_assert.c2
-rw-r--r--libmisc/tests/test_log.c2
-rw-r--r--libmisc/tests/test_rand.c6
3 files changed, 10 insertions, 0 deletions
diff --git a/libmisc/tests/test_assert.c b/libmisc/tests/test_assert.c
index 0c51bbd..3c2d6b6 100644
--- a/libmisc/tests/test_assert.c
+++ b/libmisc/tests/test_assert.c
@@ -74,6 +74,7 @@ int __lm_printf(const char *format, ...) {
static_assert(sizeof(char) == 1);
int main() {
+#ifndef NDEBUG
test_should_succeed(assert(true));
test_should_fail(assert(false), "error: ASSERT: "__FILE__":"LM_STR_(__LINE__)":main(): assertion \"false\" failed\n");
@@ -88,5 +89,6 @@ int main() {
free(global_log);
global_log = NULL;
}
+#endif
return 0;
}
diff --git a/libmisc/tests/test_log.c b/libmisc/tests/test_log.c
index e819c09..49a76ca 100644
--- a/libmisc/tests/test_log.c
+++ b/libmisc/tests/test_log.c
@@ -57,6 +57,7 @@ int main() {
errorf("val=%d", 42));
should_print("info : FROBNICATE: val=0\n",
infof("val=%d", 0));
+#ifndef NDEBUG
#define CONFIG_FROBNICATE_DEBUG 1
should_print("debug: FROBNICATE: val=-2\n",
debugf("val=%d", -2));
@@ -64,5 +65,6 @@ int main() {
#define CONFIG_FROBNICATE_DEBUG 0
should_print(NULL,
debugf("val=%d", -2));
+#endif
return 0;
}
diff --git a/libmisc/tests/test_rand.c b/libmisc/tests/test_rand.c
index 282c6a4..8076155 100644
--- a/libmisc/tests/test_rand.c
+++ b/libmisc/tests/test_rand.c
@@ -14,6 +14,7 @@
/* Intercept failures *********************************************************/
+#ifndef NDEBUG
jmp_buf *__catch;
void __lm_abort(void) {
@@ -34,6 +35,7 @@ void __lm_abort(void) {
__catch = old_catch; \
} \
} while (0);
+#endif
/* Actual tests ***************************************************************/
@@ -42,7 +44,11 @@ void __lm_abort(void) {
static void test_n(uint64_t cnt) {
if (cnt == 0 || cnt > UINT64_C(1)<<63) {
+#ifndef NDEBUG
should_abort(rand_uint63n(cnt));
+#else
+ return;
+#endif
} else {
double sum = 0;
bool seen[MAX_SEE_ALL] = {0};