[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Compile benchmark programs without assertions
From: |
Bruno Haible |
Subject: |
Compile benchmark programs without assertions |
Date: |
Tue, 25 Jul 2023 23:03:27 +0200 |
It is useful to disable debug assertions when benchmarking.
But not for the entire tests/ directory, of course — we want to know about
assertion failures in the unit tests.
This patch is not perfect, but good enough for the mb*iterf benchmarks.
2023-07-25 Bruno Haible <bruno@clisp.org>
Compile benchmark programs without assertions.
* modules/mbiter-bench-tests (Makefile.am): Compile bench-mbiter with
-DNDEBUG.
* modules/mbiterf-bench-tests (Makefile.am): Compile bench-mbiterf with
-DNDEBUG.
* modules/mbuiter-bench-tests (Makefile.am): Compile bench-mbuiter with
-DNDEBUG.
* modules/mbuiterf-bench-tests (Makefile.am): Compile bench-mbuiterf
with -DNDEBUG.
* modules/mbswidth-bench-tests (Makefile.am): Compile bench-mbswidth
with -DNDEBUG.
* modules/crypto/md5-buffer-tests (Makefile.am): Compile bench-md5 with
-DNDEBUG.
* modules/crypto/sha1-buffer-tests (Makefile.am): Compile bench-sha1
with -DNDEBUG.
* modules/crypto/sha256-buffer-tests (Makefile.am): Compile bench-sha224
and bench-sha256 with -DNDEBUG.
* modules/crypto/sha512-buffer-tests (Makefile.am): Compile bench-sha384
and bench-sha512 with -DNDEBUG.
diff --git a/modules/crypto/md5-buffer-tests b/modules/crypto/md5-buffer-tests
index 312fc4a399..03ba4ebffd 100644
--- a/modules/crypto/md5-buffer-tests
+++ b/modules/crypto/md5-buffer-tests
@@ -16,4 +16,5 @@ TESTS += test-md5-buffer
check_PROGRAMS += test-md5-buffer
noinst_PROGRAMS += bench-md5
test_md5_buffer_LDADD = $(LDADD) @LIB_CRYPTO@
+bench_md5_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_md5_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/crypto/sha1-buffer-tests b/modules/crypto/sha1-buffer-tests
index ec2144f095..7cf1ec385a 100644
--- a/modules/crypto/sha1-buffer-tests
+++ b/modules/crypto/sha1-buffer-tests
@@ -16,4 +16,5 @@ TESTS += test-sha1-buffer
check_PROGRAMS += test-sha1-buffer
noinst_PROGRAMS += bench-sha1
test_sha1_buffer_LDADD = $(LDADD) @LIB_CRYPTO@
+bench_sha1_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_sha1_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/crypto/sha256-buffer-tests
b/modules/crypto/sha256-buffer-tests
index 8e16fd9c83..cf93a8f5fe 100644
--- a/modules/crypto/sha256-buffer-tests
+++ b/modules/crypto/sha256-buffer-tests
@@ -13,5 +13,7 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-sha224 bench-sha256
+bench_sha224_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_sha224_LDADD = $(LDADD) @LIB_CRYPTO@
+bench_sha256_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_sha256_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/crypto/sha512-buffer-tests
b/modules/crypto/sha512-buffer-tests
index 042046a4f8..0b68d5064d 100644
--- a/modules/crypto/sha512-buffer-tests
+++ b/modules/crypto/sha512-buffer-tests
@@ -13,5 +13,7 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-sha384 bench-sha512
+bench_sha384_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_sha384_LDADD = $(LDADD) @LIB_CRYPTO@
+bench_sha512_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_sha512_LDADD = $(LDADD) @LIB_CRYPTO@
diff --git a/modules/mbiter-bench-tests b/modules/mbiter-bench-tests
index 82dcfe1ce3..03ca077470 100644
--- a/modules/mbiter-bench-tests
+++ b/modules/mbiter-bench-tests
@@ -15,4 +15,5 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-mbiter
+bench_mbiter_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_mbiter_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
$(LIBC32CONV)
diff --git a/modules/mbiterf-bench-tests b/modules/mbiterf-bench-tests
index dfd39d2006..52106aad33 100644
--- a/modules/mbiterf-bench-tests
+++ b/modules/mbiterf-bench-tests
@@ -15,4 +15,5 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-mbiterf
+bench_mbiterf_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_mbiterf_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
$(LIBC32CONV)
diff --git a/modules/mbswidth-bench-tests b/modules/mbswidth-bench-tests
index 057fb177ba..2f3e449e99 100644
--- a/modules/mbswidth-bench-tests
+++ b/modules/mbswidth-bench-tests
@@ -15,4 +15,8 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-mbswidth
+# Note: Despite NDEBUG being set here, mbswidth.o is compiled with the
+# global CPPFLAGS. For complete removal of assert() invocations, pass
+# CPPFLAGS="-DNDEBUG" when configuring the package.
+bench_mbswidth_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_mbswidth_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB)
$(MBRTOWC_LIB) $(LIBC32CONV)
diff --git a/modules/mbuiter-bench-tests b/modules/mbuiter-bench-tests
index 1e11c43e5a..ad2d0169df 100644
--- a/modules/mbuiter-bench-tests
+++ b/modules/mbuiter-bench-tests
@@ -15,4 +15,5 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-mbuiter
+bench_mbuiter_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_mbuiter_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB) $(MBRTOWC_LIB)
$(LIBC32CONV)
diff --git a/modules/mbuiterf-bench-tests b/modules/mbuiterf-bench-tests
index 910a4a7bae..d29e19edb5 100644
--- a/modules/mbuiterf-bench-tests
+++ b/modules/mbuiterf-bench-tests
@@ -15,4 +15,5 @@ configure.ac:
Makefile.am:
noinst_PROGRAMS += bench-mbuiterf
+bench_mbuiterf_CPPFLAGS = $(AM_CPPFLAGS) -DNDEBUG
bench_mbuiterf_LDADD = $(LDADD) $(LIBUNISTRING) $(SETLOCALE_LIB)
$(MBRTOWC_LIB) $(LIBC32CONV)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Compile benchmark programs without assertions,
Bruno Haible <=