[lttng-dev] [RFC/PATCH 2/3] babeltrace: drop configure-time substitutions in test scripts

Nathan Lynch nathan_lynch at mentor.com
Tue Oct 25 15:34:26 UTC 2016


Perform renames of the form test_foo.in => test_foo and rely on the
environment as defined by the test harness.  Adjust .gitignore
accordingly and remove AC_CONFIG_FILES statements.

Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com>
---
 .gitignore                                               | 10 ----------
 configure.ac                                             | 12 ------------
 tests/bin/intersection/Makefile.am                       |  2 +-
 .../{bt_python_helper.py.in => bt_python_helper.py}      |  9 +++++----
 .../{test_intersection.in => test_intersection}          |  7 +------
 tests/bin/{test_formats.in => test_formats}              |  9 ++-------
 .../bin/{test_packet_seq_num.in => test_packet_seq_num}  | 16 +++++-----------
 tests/bin/{test_trace_read.in => test_trace_read}        |  9 +--------
 .../{test_dwarf_complete.in => test_bin_info_complete}   |  4 +---
 ...t_ctf_writer_complete.in => test_ctf_writer_complete} |  6 +++---
 .../{test_bin_info_complete.in => test_dwarf_complete}   |  4 +---
 .../lib/{test_seek_big_trace.in => test_seek_big_trace}  |  4 +---
 ...{test_seek_empty_packet.in => test_seek_empty_packet} |  4 +---
 13 files changed, 22 insertions(+), 74 deletions(-)
 rename tests/bin/intersection/{bt_python_helper.py.in => bt_python_helper.py} (82%)
 rename tests/bin/intersection/{test_intersection.in => test_intersection} (90%)
 mode change 100644 => 100755
 rename tests/bin/{test_formats.in => test_formats} (83%)
 mode change 100644 => 100755
 rename tests/bin/{test_packet_seq_num.in => test_packet_seq_num} (82%)
 mode change 100644 => 100755
 rename tests/bin/{test_trace_read.in => test_trace_read} (88%)
 mode change 100644 => 100755
 rename tests/lib/{test_dwarf_complete.in => test_bin_info_complete} (86%)
 rename tests/lib/{test_ctf_writer_complete.in => test_ctf_writer_complete} (79%)
 rename tests/lib/{test_bin_info_complete.in => test_dwarf_complete} (85%)
 rename tests/lib/{test_seek_big_trace.in => test_seek_big_trace} (83%)
 rename tests/lib/{test_seek_empty_packet.in => test_seek_empty_packet} (83%)

diff --git a/.gitignore b/.gitignore
index d20c38e30238..a97822644ea0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,4 @@
 *~
-/tests/bin/test_trace_read
-/tests/bin/intersection/test_intersection
-/tests/bin/intersection/bt_python_helper.py
-/tests/bin/test_packet_seq_num
-/tests/bin/test_formats
 /tests/lib/test_bitfield
 /tests/lib/test_seek
 /tests/lib/test_ctf_writer
@@ -11,13 +6,8 @@
 /tests/lib/test_bt_values
 /tests/lib/test_ctf_ir_ref
 /tests/lib/test_bt_ctf_field_type_validation
-/tests/lib/test_seek_big_trace
-/tests/lib/test_seek_empty_packet
 /tests/lib/test_dwarf
 /tests/lib/test_bin_info
-/tests/lib/test_bin_info_complete
-/tests/lib/test_ctf_writer_complete
-/tests/lib/test_dwarf_complete
 *.o
 *.a
 *.la
diff --git a/configure.ac b/configure.ac
index 450e22491a67..1c7f70e5abb4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -370,18 +370,6 @@ AC_CONFIG_FILES([
 	babeltrace-ctf.pc
 ])
 
-AC_CONFIG_FILES([tests/lib/test_ctf_writer_complete], [chmod +x tests/lib/test_ctf_writer_complete])
-AC_CONFIG_FILES([tests/lib/test_seek_big_trace], [chmod +x tests/lib/test_seek_big_trace])
-AC_CONFIG_FILES([tests/lib/test_seek_empty_packet], [chmod +x tests/lib/test_seek_empty_packet])
-AC_CONFIG_FILES([tests/lib/test_dwarf_complete], [chmod +x tests/lib/test_dwarf_complete])
-AC_CONFIG_FILES([tests/lib/test_bin_info_complete], [chmod +x tests/lib/test_bin_info_complete])
-
-AC_CONFIG_FILES([tests/bin/test_trace_read], [chmod +x tests/bin/test_trace_read])
-AC_CONFIG_FILES([tests/bin/intersection/test_intersection], [chmod +x tests/bin/intersection/test_intersection])
-AC_CONFIG_FILES([tests/bin/intersection/bt_python_helper.py])
-AC_CONFIG_FILES([tests/bin/test_packet_seq_num], [chmod +x tests/bin/test_packet_seq_num])
-AC_CONFIG_FILES([tests/bin/test_formats], [chmod +x tests/bin/test_formats])
-
 AC_OUTPUT
 
 #
diff --git a/tests/bin/intersection/Makefile.am b/tests/bin/intersection/Makefile.am
index 6c7330e58fc3..3cbb3aeb5c31 100644
--- a/tests/bin/intersection/Makefile.am
+++ b/tests/bin/intersection/Makefile.am
@@ -3,7 +3,7 @@ check_SCRIPTS = test_intersection \
 		test_multi_trace_intersection.py
 
 dist_noinst_SCRIPTS = test_multi_trace_intersection.py
-EXTRA_DIST=test_multi_trace_intersection.py
+EXTRA_DIST=test_multi_trace_intersection.py bt_python_helper.py
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
diff --git a/tests/bin/intersection/bt_python_helper.py.in b/tests/bin/intersection/bt_python_helper.py
similarity index 82%
rename from tests/bin/intersection/bt_python_helper.py.in
rename to tests/bin/intersection/bt_python_helper.py
index 4b9fcaf72732..a8f67af29027 100644
--- a/tests/bin/intersection/bt_python_helper.py.in
+++ b/tests/bin/intersection/bt_python_helper.py
@@ -23,13 +23,14 @@
 # SOFTWARE.
 
 import sys
+import os
 
 # Point the Python interpreter to the builddir's library and Babeltrace
 # bindings
-bt_module_path = '@abs_top_builddir@/bindings/python'
-bt_lib_py_path = '@abs_top_builddir@/bindings/python/babeltrace/.libs'
-bt_lib_bt_path = '@abs_top_builddir@/lib/.libs'
-bt_lib_ctf_path = '@abs_top_builddir@/format/ctf/.libs'
+bt_module_path = os.getenv('abs_top_builddir') + '/bindings/python'
+bt_lib_py_path = os.getenv('abs_top_builddir') + '/bindings/python/babeltrace/.libs'
+bt_lib_bt_path = os.getenv('abs_top_builddir') + '/lib/.libs'
+bt_lib_ctf_path = os.getenv('abs_top_builddir') + '/format/ctf/.libs'
 
 sys.path.insert(0, bt_module_path)
 sys.path.insert(1, bt_lib_py_path)
diff --git a/tests/bin/intersection/test_intersection.in b/tests/bin/intersection/test_intersection
old mode 100644
new mode 100755
similarity index 90%
rename from tests/bin/intersection/test_intersection.in
rename to tests/bin/intersection/test_intersection
index 689fbc1e644b..15f9b26d0404
--- a/tests/bin/intersection/test_intersection.in
+++ b/tests/bin/intersection/test_intersection
@@ -15,12 +15,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-TESTDIR=@abs_top_srcdir@/tests
-
-BABELTRACE_BIN=@abs_top_builddir@/converter/babeltrace
-CTF_TRACES=@abs_top_srcdir@/tests/ctf-traces
-
-source $TESTDIR/utils/tap/tap.sh
+. "$TAPLIB"
 
 NUM_TESTS=10
 
diff --git a/tests/bin/test_formats.in b/tests/bin/test_formats
old mode 100644
new mode 100755
similarity index 83%
rename from tests/bin/test_formats.in
rename to tests/bin/test_formats
index 0d91898bc2e4..17d03abc595b
--- a/tests/bin/test_formats.in
+++ b/tests/bin/test_formats
@@ -15,18 +15,13 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-CURDIR=$(dirname $0)
-TESTDIR=$CURDIR/..
-
-BABELTRACE_BIN=$CURDIR/../../converter/babeltrace
-
-source $TESTDIR/utils/tap/tap.sh
+. "$TAPLIB"
 
 expected_formats=(text lttng-live dummy ctf-metadata ctf)
 
 plan_tests ${#expected_formats[*]}
 
 for format in "${expected_formats[@]}"; do
-    "$BABELTRACE_BIN" --list | @GREP@ -qw "$format"
+    "$BABELTRACE_BIN" --list | $GREP -qw "$format"
     ok $? "Detect support for format \"$format\""
 done
diff --git a/tests/bin/test_packet_seq_num.in b/tests/bin/test_packet_seq_num
old mode 100644
new mode 100755
similarity index 82%
rename from tests/bin/test_packet_seq_num.in
rename to tests/bin/test_packet_seq_num
index e8e291cb4af8..7861d356d125
--- a/tests/bin/test_packet_seq_num.in
+++ b/tests/bin/test_packet_seq_num
@@ -15,13 +15,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-CURDIR=$(dirname $0)
-TESTDIR=$CURDIR/..
-
-BABELTRACE_BIN=$CURDIR/../../converter/babeltrace
-CTF_TRACES=@abs_top_srcdir@/tests/ctf-traces
-
-source $TESTDIR/utils/tap/tap.sh
+. "$TAPLIB"
 
 NUM_TESTS=10
 
@@ -32,7 +26,7 @@ test_no_lost() {
 
 	$BABELTRACE_BIN $trace >/dev/null 2>&1
 	ok $? "Trace parses"
-	$BABELTRACE_BIN $trace 2>&1 >/dev/null | @GREP@ "\[warning\] Tracer lost"
+	$BABELTRACE_BIN $trace 2>&1 >/dev/null | $GREP "\[warning\] Tracer lost"
 	if test $? = 0; then
 		fail 1 "Should not find any lost events"
 	else
@@ -51,9 +45,9 @@ test_lost() {
 	# [warning] Tracer lost 2 trace packets between ....
 	# [warning] Tracer lost 3 trace packets between ....
 	# into "2,3" and make sure it matches the expected result
-	$BABELTRACE_BIN $trace 2>&1 >/dev/null | @GREP@ "\[warning\] Tracer lost" \
-		| cut -d" " -f4 | tr "\n" "," | @SED@ "s/.$//" | \
-		@GREP@ "$expectedcountstr" >/dev/null
+	$BABELTRACE_BIN $trace 2>&1 >/dev/null | $GREP "\[warning\] Tracer lost" \
+		| cut -d" " -f4 | tr "\n" "," | $SED "s/.$//" | \
+		$GREP "$expectedcountstr" >/dev/null
 	ok $? "Lost events string matches $expectedcountstr"
 
 }
diff --git a/tests/bin/test_trace_read.in b/tests/bin/test_trace_read
old mode 100644
new mode 100755
similarity index 88%
rename from tests/bin/test_trace_read.in
rename to tests/bin/test_trace_read
index 758e8ce9eaf1..cb3765682899
--- a/tests/bin/test_trace_read.in
+++ b/tests/bin/test_trace_read
@@ -15,14 +15,7 @@
 # this program; if not, write to the Free Software Foundation, Inc., 51
 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-CURDIR=$(dirname $0)
-TESTDIR=$CURDIR/..
-
-BABELTRACE_BIN=$CURDIR/../../converter/babeltrace
-
-CTF_TRACES=@abs_top_srcdir@/tests/ctf-traces
-
-source $TESTDIR/utils/tap/tap.sh
+. "$TAPLIB"
 
 SUCCESS_TRACES=(${CTF_TRACES}/succeed/*)
 FAIL_TRACES=(${CTF_TRACES}/fail/*)
diff --git a/tests/lib/test_dwarf_complete.in b/tests/lib/test_bin_info_complete
similarity index 86%
rename from tests/lib/test_dwarf_complete.in
rename to tests/lib/test_bin_info_complete
index a3f026d64924..d77bf29ab31e 100755
--- a/tests/lib/test_dwarf_complete.in
+++ b/tests/lib/test_bin_info_complete
@@ -17,6 +17,4 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-DEBUG_INFO_DATA="@abs_top_srcdir@/tests/debug-info-data"
-
-"@abs_top_builddir@/tests/lib/test_dwarf" "$DEBUG_INFO_DATA"
+"$abs_top_builddir/tests/lib/test_bin_info" "$DEBUG_INFO_DATA"
diff --git a/tests/lib/test_ctf_writer_complete.in b/tests/lib/test_ctf_writer_complete
similarity index 79%
rename from tests/lib/test_ctf_writer_complete.in
rename to tests/lib/test_ctf_writer_complete
index 5bd1c97f24e0..ee25942233b2 100755
--- a/tests/lib/test_ctf_writer_complete.in
+++ b/tests/lib/test_ctf_writer_complete
@@ -17,7 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-CTFPARSERTEST="@abs_top_builddir@/formats/ctf/metadata/ctf-parser-test"
-BTBIN="@abs_top_builddir@/converter/babeltrace"
+CTFPARSERTEST="$abs_top_builddir/formats/ctf/metadata/ctf-parser-test"
+BTBIN="$abs_top_builddir/converter/babeltrace"
 
-"@abs_top_builddir@/tests/lib/test_ctf_writer" "$CTFPARSERTEST" "$BTBIN"
+"$abs_top_builddir/tests/lib/test_ctf_writer" "$CTFPARSERTEST" "$BTBIN"
diff --git a/tests/lib/test_bin_info_complete.in b/tests/lib/test_dwarf_complete
similarity index 85%
rename from tests/lib/test_bin_info_complete.in
rename to tests/lib/test_dwarf_complete
index 3ca7ca23e770..be6e864541b2 100755
--- a/tests/lib/test_bin_info_complete.in
+++ b/tests/lib/test_dwarf_complete
@@ -17,6 +17,4 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-DEBUG_INFO_DATA="@abs_top_srcdir@/tests/debug-info-data"
-
-"@abs_top_builddir@/tests/lib/test_bin_info" "$DEBUG_INFO_DATA"
+"$abs_top_builddir/tests/lib/test_dwarf" "$DEBUG_INFO_DATA"
diff --git a/tests/lib/test_seek_big_trace.in b/tests/lib/test_seek_big_trace
similarity index 83%
rename from tests/lib/test_seek_big_trace.in
rename to tests/lib/test_seek_big_trace
index 394769cb000e..2f7423a438b4 100755
--- a/tests/lib/test_seek_big_trace.in
+++ b/tests/lib/test_seek_big_trace
@@ -18,6 +18,4 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-CTF_TRACES="@abs_top_srcdir@/tests/ctf-traces"
-
-"@abs_top_builddir@/tests/lib/test_seek" "$CTF_TRACES/succeed/lttng-modules-2.0-pre5/" 61334174524234 61336381998396
+"$abs_top_builddir/tests/lib/test_seek" "$CTF_TRACES/succeed/lttng-modules-2.0-pre5/" 61334174524234 61336381998396
diff --git a/tests/lib/test_seek_empty_packet.in b/tests/lib/test_seek_empty_packet
similarity index 83%
rename from tests/lib/test_seek_empty_packet.in
rename to tests/lib/test_seek_empty_packet
index 006938ea4902..1d6105c45ebb 100755
--- a/tests/lib/test_seek_empty_packet.in
+++ b/tests/lib/test_seek_empty_packet
@@ -18,6 +18,4 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
 
-CTF_TRACES="@abs_top_srcdir@/tests/ctf-traces"
-
-"@abs_top_builddir@/tests/lib/test_seek" "$CTF_TRACES/succeed/wk-heartbeat-u/" 1351532897586558519 1351532897591331194
+"$abs_top_builddir/tests/lib/test_seek" "$CTF_TRACES/succeed/wk-heartbeat-u/" 1351532897586558519 1351532897591331194
-- 
2.7.4



More information about the lttng-dev mailing list