From 81d029da32ba3c502bdce6ea56b3603eed77e951 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Thu, 21 Feb 2013 16:29:47 -0500 Subject: [PATCH] Tests: Move unit tests to tests/unit The regression/tools/{test_kernel_data_trace,test_sessions,test_ust_data_trace}.c and regression/tools/streaming/unit_tests.c tests files are really unit tests. In order to have a clear separation between unit tests and integration/system tests, move them to their own folder. Signed-off-by: Christian Babeux --- .gitignore | 7 ++- configure.ac | 1 + tests/Makefile.am | 2 +- tests/regression/tools/Makefile.am | 35 ------------ tests/regression/tools/runall.sh | 3 +- tests/regression/tools/streaming/Makefile.am | 11 +--- tests/unit/Makefile.am | 55 +++++++++++++++++++ .../test_kernel_data.c} | 0 .../test_sessions.c => unit/test_session.c} | 0 .../unit_tests.c => unit/test_uri.c} | 0 .../test_ust_data.c} | 0 11 files changed, 63 insertions(+), 51 deletions(-) create mode 100644 tests/unit/Makefile.am rename tests/{regression/tools/test_kernel_data_trace.c => unit/test_kernel_data.c} (100%) rename tests/{regression/tools/test_sessions.c => unit/test_session.c} (100%) rename tests/{regression/tools/streaming/unit_tests.c => unit/test_uri.c} (100%) rename tests/{regression/tools/test_ust_data_trace.c => unit/test_ust_data.c} (100%) diff --git a/.gitignore b/.gitignore index aa794ae1f..5dc73aec9 100644 --- a/.gitignore +++ b/.gitignore @@ -49,9 +49,10 @@ extras/bindings/swig/python/lttng_wrap.c .checkpatch.conf # Tests -test_sessions -test_kernel_data_trace -test_ust_data_trace +tests/unit/test_kernel_data +tests/unit/test_session +tests/unit/test_uri +tests/unit/test_ust_data kernel_all_events_basic kernel_event_basic ust_global_event_wildcard diff --git a/configure.ac b/configure.ac index 5cb2e90b4..1809df7eb 100644 --- a/configure.ac +++ b/configure.ac @@ -323,6 +323,7 @@ AC_CONFIG_FILES([ tests/regression/ust/multi-session/Makefile tests/regression/ust/overlap/Makefile tests/regression/ust/overlap/demo/Makefile + tests/unit/Makefile ]) AC_OUTPUT diff --git a/tests/Makefile.am b/tests/Makefile.am index 2a4309e01..d8c85bda2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1 +1 @@ -SUBDIRS = . regression +SUBDIRS = regression unit diff --git a/tests/regression/tools/Makefile.am b/tests/regression/tools/Makefile.am index 40f3cc0c1..ccfbd34ac 100644 --- a/tests/regression/tools/Makefile.am +++ b/tests/regression/tools/Makefile.am @@ -4,38 +4,3 @@ AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/tests/ut AM_LDFLAGS = -lurcu EXTRA_DIST = runall.sh - -noinst_PROGRAMS = test_sessions test_kernel_data_trace - -UTILS=$(top_srcdir)/tests/utils/utils.h -SESSIONS=$(top_srcdir)/src/bin/lttng-sessiond/session.c \ - $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ - $(top_srcdir)/src/common/uri.c \ - $(top_srcdir)/src/common/utils.c \ - $(top_srcdir)/src/common/error.c -KERN_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-kernel.c \ - $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ - $(top_srcdir)/src/common/uri.c \ - $(top_srcdir)/src/common/utils.c -COMMON=$(top_builddir)/src/common/libcommon.la -HASHTABLE=$(top_builddir)/src/common/hashtable/libhashtable.la -SESSIOND_COMM=$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la - -# Tracing sessions unit tests -test_sessions_SOURCES = test_sessions.c $(UTILS) $(SESSIONS) -test_sessions_LDADD = $(COMMON) $(HASHTABLE) $(SESSIOND_COMM) - -# Kernel trace data unit tests -test_kernel_data_trace_SOURCES = test_kernel_data_trace.c $(UTILS) $(KERN_DATA_TRACE) -test_kernel_data_trace_LDADD = $(COMMON) $(SESSIOND_COMM) $(HASHTABLE) - -if HAVE_LIBLTTNG_UST_CTL -noinst_PROGRAMS += test_ust_data_trace -UST_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-ust.c \ - $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ - $(top_srcdir)/src/common/uri.c \ - $(top_srcdir)/src/common/utils.c -# UST trace data unit tests -test_ust_data_trace_SOURCES = test_ust_data_trace.c $(UTILS) $(UST_DATA_TRACE) -test_ust_data_trace_LDADD = $(COMMON) $(HASHTABLE) $(SESSIOND_COMM) -endif diff --git a/tests/regression/tools/runall.sh b/tests/regression/tools/runall.sh index b2be91c6c..5d505d9b8 100755 --- a/tests/regression/tools/runall.sh +++ b/tests/regression/tools/runall.sh @@ -2,8 +2,7 @@ DIR=$(dirname $0) -tests=( $DIR/test_kernel_data_trace $DIR/test_sessions $DIR/test_ust_data_trace \ - $DIR/streaming/runall $DIR/health/runall $DIR/filtering/runall) +tests=( $DIR/streaming/runall $DIR/health/runall $DIR/filtering/runall ) exit_code=0 diff --git a/tests/regression/tools/streaming/Makefile.am b/tests/regression/tools/streaming/Makefile.am index 3fab87e9b..ddd092592 100644 --- a/tests/regression/tools/streaming/Makefile.am +++ b/tests/regression/tools/streaming/Makefile.am @@ -8,17 +8,8 @@ if LTTNG_TOOLS_BUILD_WITH_LIBC_DL AM_LDFLAGS += -lc endif -#UTILS=../../utils.h -UTILS= -LIBSESSIOND_COMM=$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la -LIBCOMMON=$(top_builddir)/src/common/libcommon.la - -noinst_PROGRAMS = unit_tests -unit_tests_SOURCES = unit_tests.c $(UTILS) -unit_tests_LDADD = $(LIBCOMMON) - if HAVE_LIBLTTNG_UST_CTL -noinst_PROGRAMS += gen-ust-events +noinst_PROGRAMS = gen-ust-events gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h gen_ust_events_LDADD = -llttng-ust endif diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am new file mode 100644 index 000000000..a277feaac --- /dev/null +++ b/tests/unit/Makefile.am @@ -0,0 +1,55 @@ +AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src -I$(top_srcdir)/tests/utils/ -I$(srcdir) +AM_LDFLAGS = + +if LTTNG_TOOLS_BUILD_WITH_LIBDL +AM_LDFLAGS += -ldl +endif +if LTTNG_TOOLS_BUILD_WITH_LIBC_DL +AM_LDFLAGS += -lc +endif + +LIBCOMMON=$(top_builddir)/src/common/libcommon.la +LIBSESSIOND_COMM=$(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la +LIBHASHTABLE=$(top_builddir)/src/common/hashtable/libhashtable.la + +EXTRA_DIST = run.sh + +if HAVE_LIBLTTNG_UST_CTL +noinst_PROGRAMS = test_uri test_session test_ust_data test_kernel_data +else +noinst_PROGRAMS = test_uri test_session test_kernel_data +endif + +# URI unit tests +test_uri_SOURCES = test_uri.c +test_uri_LDADD = $(LIBCOMMON) + +# Session unit test +SESSIONS=$(top_srcdir)/src/bin/lttng-sessiond/session.c \ + $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ + $(top_srcdir)/src/common/uri.c \ + $(top_srcdir)/src/common/utils.c \ + $(top_srcdir)/src/common/error.c + +test_session_SOURCES = test_session.c $(SESSIONS) +test_session_LDADD = $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) + +# UST data structures unit test +if HAVE_LIBLTTNG_UST_CTL +UST_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-ust.c \ + $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ + $(top_srcdir)/src/common/uri.c \ + $(top_srcdir)/src/common/utils.c + +test_ust_data_SOURCES = test_ust_data.c $(UST_DATA_TRACE) +test_ust_data_LDADD = $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) +endif + +# Kernel data structures unit test +KERN_DATA_TRACE=$(top_srcdir)/src/bin/lttng-sessiond/trace-kernel.c \ + $(top_srcdir)/src/bin/lttng-sessiond/consumer.c \ + $(top_srcdir)/src/common/uri.c \ + $(top_srcdir)/src/common/utils.c + +test_kernel_data_SOURCES = test_kernel_data.c $(KERN_DATA_TRACE) +test_kernel_data_LDADD = $(LIBCOMMON) $(LIBSESSIOND_COMM) $(LIBHASHTABLE) diff --git a/tests/regression/tools/test_kernel_data_trace.c b/tests/unit/test_kernel_data.c similarity index 100% rename from tests/regression/tools/test_kernel_data_trace.c rename to tests/unit/test_kernel_data.c diff --git a/tests/regression/tools/test_sessions.c b/tests/unit/test_session.c similarity index 100% rename from tests/regression/tools/test_sessions.c rename to tests/unit/test_session.c diff --git a/tests/regression/tools/streaming/unit_tests.c b/tests/unit/test_uri.c similarity index 100% rename from tests/regression/tools/streaming/unit_tests.c rename to tests/unit/test_uri.c diff --git a/tests/regression/tools/test_ust_data_trace.c b/tests/unit/test_ust_data.c similarity index 100% rename from tests/regression/tools/test_ust_data_trace.c rename to tests/unit/test_ust_data.c -- 2.34.1