From 906ac65fc09fe01ebd878b8883dcb5823e1458af Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 8 Jul 2019 16:27:19 -0400 Subject: [PATCH] Tests: move `test_bitfield` outside lib tests, add `check-no-bitfield` target While the bitfield test (`test_bitfield`) is very valuable, it is also very slow with a typical Babeltrace developer configuration, that is: BABELTRACE_DEV_MODE=1 BABELTRACE_DEBUG_MODE=1 \ BABELTRACE_MINIMAL_LOG_LEVEL=TRACE \ CFLAGS='-O0 -g3 -Werror -Wall -Wno-error=unused-function' On my system and with the build configuration above, `test_bitfield` takes 3:10 to run, while all the other tests, including the Python bindings tests, but excluding `test_bitfield`, take 0:16. Because `test_bitfield` exclusively tests the functions in the `bitfield.h` header, and because they almost never change, I never run the `test_bitfield` test, removing the line in `tests/Makefile.am` every time. The CI runs all the tests anyway, so for a first pass, I believe it's not worth the wait. This patch moves `test_bitfield` into its own `tests/bitfield` directory: `bitfield.h` is not part of the library anyway, so I don't know why it's in `tests/lib` in the first place. In `tests/Makefile.am`, a new `check-bitfield` target is added to run just this test, as well as a new `check-no-bitfield` target which runs all the tests but `test_bitfield`. Signed-off-by: Philippe Proulx Change-Id: Ib9f6a8e7cb9d01e7ef117b1a4d9c84788a4a68d2 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1655 Tested-by: jenkins --- .gitignore | 2 +- configure.ac | 1 + tests/Makefile.am | 21 +++++++++++++++++---- tests/bitfield/Makefile.am | 8 ++++++++ tests/{lib => bitfield}/test_bitfield.c | 0 tests/lib/Makefile.am | 10 +--------- 6 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 tests/bitfield/Makefile.am rename tests/{lib => bitfield}/test_bitfield.c (100%) diff --git a/.gitignore b/.gitignore index 572ac7a9..12826fe2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ +/tests/bitfield/test_bitfield /tests/ctf-writer/ctf_writer /tests/lib/plugin -/tests/lib/test_bitfield /tests/lib/test_bt_uuid /tests/lib/test_bt_values /tests/lib/test_graph_topo diff --git a/configure.ac b/configure.ac index 4077a039..5d224371 100644 --- a/configure.ac +++ b/configure.ac @@ -726,6 +726,7 @@ AC_CONFIG_FILES([ src/plugins/utils/trimmer/Makefile src/py-common/Makefile src/python-plugin-provider/Makefile + tests/bitfield/Makefile tests/ctf-writer/Makefile tests/lib/Makefile tests/lib/test-plugin-plugins/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index 877ec1c7..aef19a60 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = utils lib ctf-writer plugins +SUBDIRS = utils lib bitfield ctf-writer plugins # Directories added to EXTRA_DIST will be recursively copied to the distribution. EXTRA_DIST = $(srcdir)/data \ @@ -55,12 +55,14 @@ TESTS_CLI = \ cli/test_trimmer TESTS_LIB = \ - lib/test_bitfield \ lib/test_bt_values \ lib/test_bt_uuid \ lib/test_graph_topo \ lib/test_trace_ir_ref +TESTS_BITFIELD = \ + bitfield/test_bitfield + TESTS_CTF_WRITER = \ ctf-writer/test_ctf_writer @@ -116,8 +118,15 @@ LOG_DRIVER = env AM_TAP_AWK='$(AWK)' \ BT_TESTS_SED_BIN="$(SED)" \ $(SHELL) $(top_srcdir)/config/tap-driver.sh -TESTS = $(TESTS_BINDINGS) $(TESTS_CLI) $(TESTS_CTF_WRITER) $(TESTS_LIB) \ - $(TESTS_PLUGINS) $(TESTS_PYTHON_PLUGIN_PROVIDER) +TESTS_NO_BITFIELD = \ + $(TESTS_BINDINGS) \ + $(TESTS_CLI) \ + $(TESTS_CTF_WRITER) \ + $(TESTS_LIB) \ + $(TESTS_PLUGINS) \ + $(TESTS_PYTHON_PLUGIN_PROVIDER) + +TESTS = $(TESTS_NO_BITFIELD) $(TESTS_BITFIELD) define check_target check-$(1): @@ -125,8 +134,12 @@ check-$(1): endef $(eval $(call check_target,bindings,$(TESTS_BINDINGS))) +$(eval $(call check_target,bitfield,$(TESTS_BITFIELD))) $(eval $(call check_target,cli,$(TESTS_CLI))) $(eval $(call check_target,ctf-writer,$(TESTS_CTF_WRITER))) $(eval $(call check_target,lib,$(TESTS_LIB))) $(eval $(call check_target,plugins,$(TESTS_PLUGINS))) $(eval $(call check_target,python-plugin-provider,$(TESTS_PYTHON_PLUGIN_PROVIDER))) + +check-no-bitfield: + $(MAKE) $(AM_MAKEFLAGS) TESTS="$(TESTS_NO_BITFIELD)" check diff --git a/tests/bitfield/Makefile.am b/tests/bitfield/Makefile.am new file mode 100644 index 00000000..5f46f28b --- /dev/null +++ b/tests/bitfield/Makefile.am @@ -0,0 +1,8 @@ +AM_CPPFLAGS += -I$(top_srcdir)/tests/utils + +test_bitfield_SOURCES = test_bitfield.c +test_bitfield_LDADD = \ + $(top_builddir)/tests/utils/tap/libtap.la \ + $(top_builddir)/tests/utils/libtestcommon.la + +noinst_PROGRAMS = test_bitfield diff --git a/tests/lib/test_bitfield.c b/tests/bitfield/test_bitfield.c similarity index 100% rename from tests/lib/test_bitfield.c rename to tests/bitfield/test_bitfield.c diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index ce8d17a7..8974725c 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -6,8 +6,6 @@ COMMON_TEST_LDADD = \ $(top_builddir)/tests/utils/tap/libtap.la \ $(top_builddir)/tests/utils/libtestcommon.la -test_bitfield_LDADD = $(COMMON_TEST_LDADD) - test_bt_values_LDADD = $(COMMON_TEST_LDADD) \ $(top_builddir)/src/lib/libbabeltrace2.la @@ -22,14 +20,8 @@ test_trace_ir_ref_LDADD = $(COMMON_TEST_LDADD) \ test_graph_topo_LDADD = $(COMMON_TEST_LDADD) \ $(top_builddir)/src/lib/libbabeltrace2.la -noinst_PROGRAMS = \ - test_bitfield \ - test_bt_values \ - test_bt_uuid \ - test_trace_ir_ref \ - test_graph_topo +noinst_PROGRAMS = test_bt_values test_bt_uuid test_trace_ir_ref test_graph_topo -test_bitfield_SOURCES = test_bitfield.c test_bt_values_SOURCES = test_bt_values.c test_bt_uuid_SOURCES = test_bt_uuid.c test_trace_ir_ref_SOURCES = test_trace_ir_ref.c -- 2.34.1