Tests: fix make targets using objcopy
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 2 Dec 2015 16:56:41 +0000 (11:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Jan 2016 17:53:21 +0000 (12:53 -0500)
Add detection for objcopy using AC_CHECK_TOOL and use dedicated make
targets for each file.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
.gitignore
configure.ac
tests/regression/ust/Makefile.am
tests/regression/ust/baddr-statedump/Makefile.am
tests/regression/ust/baddr-statedump/test_baddr-statedump.py
tests/regression/ust/ust-dl/Makefile.am
tests/regression/ust/ust-dl/test_ust-dl.py

index 0efccfa9eda3e7c6bdc74cc273b7567208442e4a..ca08d958496802c45960754c4db2715f4381c772 100644 (file)
@@ -95,7 +95,9 @@ health_check
 tests/regression/ust/python-logging/test_python_logging
 /tests/regression/ust/baddr-statedump/prog
 /tests/regression/ust/baddr-statedump/prog.debug
+/tests/regression/ust/baddr-statedump/prog.strip
 /tests/regression/ust/ust-dl/prog
+/tests/regression/ust/ust-dl/libfoo.so.debug
 /tests/utils/testapp/gen-ust-nevents/gen-ust-nevents
 /tests/utils/testapp/gen-ust-tracef/gen-ust-tracef
 /tests/regression/tools/live/live_test
index 5537c154015ebbf3177c430c5163be9656503f60..07b9c4dab97f85339ab42287b74923e06a4dfb0b 100644 (file)
@@ -28,6 +28,13 @@ AC_PROG_SED
 AC_PROG_YACC
 LT_INIT
 
+# Check for objcopy, required by the base address statedump and dynamic linker tests
+AC_CHECK_TOOL([OBJCOPY], objcopy, no)
+AS_IF([test "x$OBJCOPY" = xno],
+       [AC_MSG_WARN([Cannont find objcopy. The base address statedump and dynamic linker tests will be disabled. Install the binutils package to remediate this.])]
+)
+AM_CONDITIONAL([HAVE_OBJCOPY], [test "x$OBJCOPY" != xno])
+
 # Checks for typedefs, structures, and compiler characteristics.
 AC_C_INLINE
 AC_TYPE_INT32_T
index 9fcbda6d93f9d83febe861ca92d8bd10a2025c55..383570f5ae4fd2578c1efcb25745e03f06a9b3a7 100644 (file)
@@ -2,7 +2,11 @@ if HAVE_LIBLTTNG_UST_CTL
 SUBDIRS = nprocesses high-throughput low-throughput before-after multi-session \
                overlap buffers-pid linking daemon exit-fast fork libc-wrapper \
                periodical-metadata-flush java-jul java-log4j python-logging \
-               getcpu-override clock-override baddr-statedump ust-dl
+               getcpu-override clock-override
+
+if HAVE_OBJCOPY
+SUBDIRS += baddr-statedump ust-dl
+endif
 
 EXTRA_DIST = test_event_basic test_event_tracef test_event_perf
 
index f45c5aeeb1555eee324cbd9ae0f168eacd7f0235..7caf457661a38471037d49ede663d9840f297824 100644 (file)
@@ -1,3 +1,7 @@
+objcopy_verbose = $(objcopy_verbose_@AM_V@)
+objcopy_verbose_ = $(objcopy_verbose_@AM_DEFAULT_V@)
+objcopy_verbose_0 = @echo OBJCOPY $@;
+
 AM_CPPFLAGS = -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
@@ -7,15 +11,21 @@ prog_LDADD = -llttng-ust -ldl
 noinst_SCRIPTS = test_baddr-statedump test_baddr-statedump.py
 EXTRA_DIST = test_baddr-statedump test_baddr-statedump.py
 
-all-local: prog$(EXEEXT)
+# Extract debug symbols
+prog.debug: prog
+       $(objcopy_verbose)$(OBJCOPY) --only-keep-debug prog prog.debug
+
+# Strip and add debuglink
+prog.strip: prog.debug
+       @cp -f prog prog.strip
+       $(objcopy_verbose)$(OBJCOPY) --strip-debug --add-gnu-debuglink=prog.debug prog.strip
+
+all-local: prog.strip
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for script in $(EXTRA_DIST); do \
                        cp -f $(srcdir)/$$script $(builddir); \
                done; \
        fi
-       objcopy --only-keep-debug prog prog.debug
-       strip -g prog
-       objcopy --add-gnu-debuglink prog.debug prog
 
 clean-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
@@ -23,4 +33,5 @@ clean-local:
                        rm -f $(builddir)/$$script; \
                done; \
        fi
-       rm -f prog.debug
+
+CLEANFILES = prog.debug prog.strip
index 308eff4296a713dc7c49f791c4b9d7f67d77916a..47ed9d6156b5a61a16e7b2f9730859aa1cb44e49 100644 (file)
@@ -45,7 +45,7 @@ session_info = create_session()
 enable_ust_tracepoint_event(session_info, "*")
 start_session(session_info)
 
-test_process = subprocess.Popen(test_path + "prog", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+test_process = subprocess.Popen(test_path + "prog.strip", stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 if sys.version_info >= (3, 3):
     try:
         test_process.wait(5)
index 4893a97e4793b29cd10dc8a657770ec29054bea0..c12da16d0ad509031e919034f62a28d09307de7e 100644 (file)
@@ -1,3 +1,7 @@
+objcopy_verbose = $(objcopy_verbose_@AM_V@)
+objcopy_verbose_ = $(objcopy_verbose_@AM_DEFAULT_V@)
+objcopy_verbose_0 = @echo OBJCOPY $@;
+
 AM_CPPFLAGS = -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
@@ -12,15 +16,21 @@ libfoo_la_LDFLAGS = -module -shared -avoid-version \
 noinst_SCRIPTS = test_ust-dl test_ust-dl.py
 EXTRA_DIST = test_ust-dl test_ust-dl.py
 
-all-local: libfoo.la
+# Extract debug symbols
+libfoo.so.debug: libfoo.la
+       $(objcopy_verbose)$(OBJCOPY) --only-keep-debug .libs/libfoo.so libfoo.so.debug
+
+# Strip and add debuglink
+libfoo.so: libfoo.so.debug
+       @cp -f .libs/libfoo.so libfoo.so
+       $(objcopy_verbose)$(OBJCOPY) --strip-debug --add-gnu-debuglink=libfoo.so.debug libfoo.so
+
+all-local: libfoo.so
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
                for script in $(EXTRA_DIST); do \
                        cp -f $(srcdir)/$$script $(builddir); \
                done; \
        fi
-       objcopy --only-keep-debug .libs/libfoo.so .libs/libfoo.so.debug
-       strip -g .libs/libfoo.so
-       objcopy --add-gnu-debuglink .libs/libfoo.so.debug .libs/libfoo.so
 
 clean-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
@@ -28,4 +38,5 @@ clean-local:
                        rm -f $(builddir)/$$script; \
                done; \
        fi
-       rm -f .libs/libfoo.so.debug
+
+CLEANFILES = libfoo.so libfoo.so.debug
index 1e5e96bb99bb119238998070fd7b5b1f09ca0f11..dc7327017f6f8d6ddf179ad337b1ef2f6b8f79b0 100644 (file)
@@ -47,7 +47,7 @@ start_session(session_info)
 
 test_env = os.environ.copy()
 test_env["LD_PRELOAD"] = "liblttng-ust-dl.so"
-test_env["LD_LIBRARY_PATH"] = test_path + ".libs/"
+test_env["LD_LIBRARY_PATH"] = test_path
 test_process = subprocess.Popen(test_path + "prog",
                                 stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                                 env=test_env)
This page took 0.040057 seconds and 4 git commands to generate.