* [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests
@ 2016-10-25 15:34 Nathan Lynch
2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 1/3] babeltrace: use AM_TESTS_ENVIRONMENT for tests Nathan Lynch
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Nathan Lynch @ 2016-10-25 15:34 UTC (permalink / raw)
This is working toward moving from popt to GLib for command-line
parsing. I want to add some tests for at least some of the converter
command-line options in order to prevent regressions.
I found it somewhat tedious to add even simple test scripts, so I
investigated alternatives to doing Autoconf variable substitution, and
this is what I came up with. I think it makes adding a test script
quite a bit easier. It also makes the test harness more flexible at
runtime, which is valuable when transferring a cross-compiled test
suite to a target system for execution there.
I've included the new tests I've written so far in patch #3.
Nathan Lynch (3):
babeltrace: use AM_TESTS_ENVIRONMENT for tests
babeltrace: drop configure-time substitutions in test scripts
babeltrace: add simple tests for converter command line options
.gitignore | 10 -----
configure.ac | 12 ------
tests/Makefile.am | 16 ++++++++
tests/bin/Makefile.am | 3 +-
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_clock_cycles | 41 +++++++++++++++++++
tests/bin/test_clock_date | 47 ++++++++++++++++++++++
tests/bin/test_clock_seconds | 43 ++++++++++++++++++++
tests/bin/{test_formats.in => test_formats} | 9 +----
tests/bin/test_no_delta | 40 ++++++++++++++++++
...{test_packet_seq_num.in => test_packet_seq_num} | 16 +++-----
tests/bin/{test_trace_read.in => test_trace_read} | 9 +----
...st_dwarf_complete.in => test_bin_info_complete} | 4 +-
...writer_complete.in => test_ctf_writer_complete} | 6 +--
...st_bin_info_complete.in => test_dwarf_complete} | 4 +-
...{test_seek_big_trace.in => test_seek_big_trace} | 4 +-
...seek_empty_packet.in => test_seek_empty_packet} | 4 +-
19 files changed, 211 insertions(+), 75 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
create mode 100755 tests/bin/test_clock_cycles
create mode 100755 tests/bin/test_clock_date
create mode 100755 tests/bin/test_clock_seconds
rename tests/bin/{test_formats.in => test_formats} (83%)
mode change 100644 => 100755
create mode 100755 tests/bin/test_no_delta
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%)
--
2.7.4
^ permalink raw reply [flat|nested] 11+ messages in thread* [lttng-dev] [RFC/PATCH 1/3] babeltrace: use AM_TESTS_ENVIRONMENT for tests 2016-10-25 15:34 [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Nathan Lynch @ 2016-10-25 15:34 ` Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 2/3] babeltrace: drop configure-time substitutions in test scripts Nathan Lynch ` (2 subsequent siblings) 3 siblings, 0 replies; 11+ messages in thread From: Nathan Lynch @ 2016-10-25 15:34 UTC (permalink / raw) Export convenient variables from the build system into the runtime environment of the testcases, so that fewer test scripts need to be generated at configure time using Autoconf variable substitutions. This makes it less tedious to add and work on testcases in script form. The user can supplement or override settings in AM_TESTS_ENVIRONMENT by using TESTS_ENVIRONMENT on the command line. Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com> --- tests/Makefile.am | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index eda9f2351310..28cb2eca7770 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,3 +29,15 @@ endif if USE_PYTHON TESTS += bin/intersection/test_multi_trace_intersection.py endif + +AM_TESTS_ENVIRONMENT = \ + abs_top_srcdir='$(abs_top_srcdir)'; export abs_top_srcdir ; \ + abs_top_builddir='$(abs_top_builddir)'; export abs_top_builddir ; \ + TAPLIB='$(abs_top_srcdir)'/tests/utils/tap/tap.sh ; export TAPLIB ; \ + CTF_TRACES='$(abs_top_srcdir)'/tests/ctf-traces ; export CTF_TRACES ; \ + BABELTRACE_BIN='$(abs_top_builddir)'/converter/babeltrace ; \ + export BABELTRACE_BIN ; \ + DEBUG_INFO_DATA='$(abs_top_srcdir)'/tests/debug-info-data ; \ + export DEBUG_INFO_DATA ; \ + GREP='$(GREP)' ; export GREP; \ + SED='$(SED)' ; export SED; -- 2.7.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 2/3] babeltrace: drop configure-time substitutions in test scripts 2016-10-25 15:34 [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 1/3] babeltrace: use AM_TESTS_ENVIRONMENT for tests Nathan Lynch @ 2016-10-25 15:34 ` Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options Nathan Lynch 2016-10-25 15:50 ` [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Jonathan Rajotte Julien 3 siblings, 0 replies; 11+ messages in thread From: Nathan Lynch @ 2016-10-25 15:34 UTC (permalink / raw) 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 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options 2016-10-25 15:34 [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 1/3] babeltrace: use AM_TESTS_ENVIRONMENT for tests Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 2/3] babeltrace: drop configure-time substitutions in test scripts Nathan Lynch @ 2016-10-25 15:34 ` Nathan Lynch 2016-10-26 7:11 ` Sebastien Boisvert 2016-10-25 15:50 ` [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Jonathan Rajotte Julien 3 siblings, 1 reply; 11+ messages in thread From: Nathan Lynch @ 2016-10-25 15:34 UTC (permalink / raw) Add simple tests for the following converter command line options: --no-delta --clock-cycles --clock-seconds --clock-date Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com> --- tests/Makefile.am | 4 ++++ tests/bin/Makefile.am | 3 ++- tests/bin/test_clock_cycles | 41 ++++++++++++++++++++++++++++++++++++++ tests/bin/test_clock_date | 47 ++++++++++++++++++++++++++++++++++++++++++++ tests/bin/test_clock_seconds | 43 ++++++++++++++++++++++++++++++++++++++++ tests/bin/test_no_delta | 40 +++++++++++++++++++++++++++++++++++++ 6 files changed, 177 insertions(+), 1 deletion(-) create mode 100755 tests/bin/test_clock_cycles create mode 100755 tests/bin/test_clock_date create mode 100755 tests/bin/test_clock_seconds create mode 100755 tests/bin/test_no_delta diff --git a/tests/Makefile.am b/tests/Makefile.am index 28cb2eca7770..58d8ac861c4b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -8,6 +8,10 @@ TESTS = bin/test_trace_read \ bin/test_trace_read \ bin/test_packet_seq_num \ bin/test_formats \ + bin/test_no_delta \ + bin/test_clock_cycles \ + bin/test_clock_date \ + bin/test_clock_seconds \ bin/intersection/test_intersection \ lib/test_bitfield \ lib/test_seek_empty_packet \ diff --git a/tests/bin/Makefile.am b/tests/bin/Makefile.am index 57b90ea72d80..00551c53f062 100644 --- a/tests/bin/Makefile.am +++ b/tests/bin/Makefile.am @@ -1,2 +1,3 @@ SUBDIRS = intersection -check_SCRIPTS = test_trace_read test_packet_seq_num test_formats +check_SCRIPTS = test_trace_read test_packet_seq_num test_formats test_no_delta \ + test_clock_cycles test_clock_seconds test_clock_date diff --git a/tests/bin/test_clock_cycles b/tests/bin/test_clock_cycles new file mode 100755 index 000000000000..2d0ca6a0f953 --- /dev/null +++ b/tests/bin/test_clock_cycles @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Author: Nathan Lynch +# Copyright (C) 2016 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +. "$TAPLIB" + +# [cccccccccccccccccccc] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]{20}" +timestamp_fmt+="\]" + +# (+N.nnnnnnnnn) +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" + +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" + +plan_tests 1 + +test_clock_cycles() { + trace="$1" + + count=$($BABELTRACE_BIN --clock-cycles $trace | $GREP -c -E "$pattern") + test $count -eq 19 + ok $? "--clock-cycles prints timestamps in cycles" +} + +test_clock_cycles "$CTF_TRACES/succeed/wk-heartbeat-u" diff --git a/tests/bin/test_clock_date b/tests/bin/test_clock_date new file mode 100755 index 000000000000..0aaab23d5869 --- /dev/null +++ b/tests/bin/test_clock_date @@ -0,0 +1,47 @@ +#!/bin/bash +# +# Author: Nathan Lynch +# Copyright (C) 2016 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +. "$TAPLIB" + +# [YYYY-MM-DD hh:mm:ss.nnnnnnnnn] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]{4}" # YYYY +timestamp_fmt+="-[[:digit:]]{2}" # MM +timestamp_fmt+="-[[:digit:]]{2}" # DD +timestamp_fmt+=" [[:digit:]]{2}" # hh +timestamp_fmt+=":[[:digit:]]{2}" # mm +timestamp_fmt+=":[[:digit:]]{2}" # ss +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn +timestamp_fmt+="\]" + +(+N.nnnnnnnnn) +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" + +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" + +plan_tests 1 + +test_clock_date() { + trace="$1" + + count=$($BABELTRACE_BIN --clock-date $trace | $GREP -c -E "$pattern") + test $count -eq 19 + ok $? "--clock-date displays the date in timestamps" +} + +test_clock_date "$CTF_TRACES/succeed/wk-heartbeat-u" diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds new file mode 100755 index 000000000000..2b5e13c5206d --- /dev/null +++ b/tests/bin/test_clock_seconds @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Author: Nathan Lynch +# Copyright (C) 2016 Mentor Graphics Corporation +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +. "$TAPLIB" + +# [s]+.[nnnnnnnnn] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]+" # [s]+ +timestamp_fmt+="\." +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] +timestamp_fmt+="\]" + +(+N.nnnnnnnnn) +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" + +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" + +plan_tests 1 + +test_clock_seconds() { + trace="$1" + + count=$($BABELTRACE_BIN --clock-seconds $trace | $GREP -c -E "$pattern") + test $count -eq 19 + ok $? "--clock-seconds prints timestamps as [sec.ns]" +} + +test_clock_seconds "$CTF_TRACES/succeed/wk-heartbeat-u" diff --git a/tests/bin/test_no_delta b/tests/bin/test_no_delta new file mode 100755 index 000000000000..37c118d30b8c --- /dev/null +++ b/tests/bin/test_no_delta @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) - 2016 Nathan Lynch <nathan_lynch at mentor.com> +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +. "$TAPLIB" + +# [hh:mm:ss.nnnnnnnnn] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]{2}" # hh +timestamp_fmt+=":[[:digit:]]{2}" # mm +timestamp_fmt+=":[[:digit:]]{2}" # ss +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn +timestamp_fmt+="\]" + +pattern="^$timestamp_fmt wk-heartbeat:" + +plan_tests 1 + +test_no_delta() { + trace="$1" + + count=$($BABELTRACE_BIN --no-delta $trace | $GREP -c -E "$pattern") + test $count -eq 20 + ok $? "--no-delta suppresses delta between events" +} + +test_no_delta "$CTF_TRACES/succeed/wk-heartbeat-u" -- 2.7.4 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options Nathan Lynch @ 2016-10-26 7:11 ` Sebastien Boisvert 2016-10-26 13:36 ` Mathieu Desnoyers 0 siblings, 1 reply; 11+ messages in thread From: Sebastien Boisvert @ 2016-10-26 7:11 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 9130 bytes --] Hi Nathan, > diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds > +# [s]+.[nnnnnnnnn] > +timestamp_fmt="\[" > +timestamp_fmt+="[[:digit:]]+" # [s]+ > +timestamp_fmt+="\." > +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] > +timestamp_fmt+="\]" > + Is the timestamp 0.123456789 possible ? Is there a minimum for the left part, something like Epoch ? On 2016-10-25 05:34 PM, Nathan Lynch wrote: > Add simple tests for the following converter command line options: > > --no-delta > --clock-cycles > --clock-seconds > --clock-date > > Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com> > --- > tests/Makefile.am | 4 ++++ > tests/bin/Makefile.am | 3 ++- > tests/bin/test_clock_cycles | 41 ++++++++++++++++++++++++++++++++++++++ > tests/bin/test_clock_date | 47 ++++++++++++++++++++++++++++++++++++++++++++ > tests/bin/test_clock_seconds | 43 ++++++++++++++++++++++++++++++++++++++++ > tests/bin/test_no_delta | 40 +++++++++++++++++++++++++++++++++++++ > 6 files changed, 177 insertions(+), 1 deletion(-) > create mode 100755 tests/bin/test_clock_cycles > create mode 100755 tests/bin/test_clock_date > create mode 100755 tests/bin/test_clock_seconds > create mode 100755 tests/bin/test_no_delta > > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 28cb2eca7770..58d8ac861c4b 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -8,6 +8,10 @@ TESTS = bin/test_trace_read \ > bin/test_trace_read \ > bin/test_packet_seq_num \ > bin/test_formats \ > + bin/test_no_delta \ > + bin/test_clock_cycles \ > + bin/test_clock_date \ > + bin/test_clock_seconds \ > bin/intersection/test_intersection \ > lib/test_bitfield \ > lib/test_seek_empty_packet \ > diff --git a/tests/bin/Makefile.am b/tests/bin/Makefile.am > index 57b90ea72d80..00551c53f062 100644 > --- a/tests/bin/Makefile.am > +++ b/tests/bin/Makefile.am > @@ -1,2 +1,3 @@ > SUBDIRS = intersection > -check_SCRIPTS = test_trace_read test_packet_seq_num test_formats > +check_SCRIPTS = test_trace_read test_packet_seq_num test_formats test_no_delta \ > + test_clock_cycles test_clock_seconds test_clock_date > diff --git a/tests/bin/test_clock_cycles b/tests/bin/test_clock_cycles > new file mode 100755 > index 000000000000..2d0ca6a0f953 > --- /dev/null > +++ b/tests/bin/test_clock_cycles > @@ -0,0 +1,41 @@ > +#!/bin/bash > +# > +# Author: Nathan Lynch > +# Copyright (C) 2016 Mentor Graphics Corporation > +# > +# This program is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License, version 2 only, as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > +# more details. > +# > +# You should have received a copy of the GNU General Public License along with > +# this program; if not, write to the Free Software Foundation, Inc., 51 > +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + > +. "$TAPLIB" > + > +# [cccccccccccccccccccc] > +timestamp_fmt="\[" > +timestamp_fmt+="[[:digit:]]{20}" > +timestamp_fmt+="\]" > + > +# (+N.nnnnnnnnn) > +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" > + > +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" > + > +plan_tests 1 > + > +test_clock_cycles() { > + trace="$1" > + > + count=$($BABELTRACE_BIN --clock-cycles $trace | $GREP -c -E "$pattern") > + test $count -eq 19 > + ok $? "--clock-cycles prints timestamps in cycles" > +} > + > +test_clock_cycles "$CTF_TRACES/succeed/wk-heartbeat-u" > diff --git a/tests/bin/test_clock_date b/tests/bin/test_clock_date > new file mode 100755 > index 000000000000..0aaab23d5869 > --- /dev/null > +++ b/tests/bin/test_clock_date > @@ -0,0 +1,47 @@ > +#!/bin/bash > +# > +# Author: Nathan Lynch > +# Copyright (C) 2016 Mentor Graphics Corporation > +# > +# This program is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License, version 2 only, as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > +# more details. > +# > +# You should have received a copy of the GNU General Public License along with > +# this program; if not, write to the Free Software Foundation, Inc., 51 > +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + > +. "$TAPLIB" > + > +# [YYYY-MM-DD hh:mm:ss.nnnnnnnnn] > +timestamp_fmt="\[" > +timestamp_fmt+="[[:digit:]]{4}" # YYYY > +timestamp_fmt+="-[[:digit:]]{2}" # MM > +timestamp_fmt+="-[[:digit:]]{2}" # DD > +timestamp_fmt+=" [[:digit:]]{2}" # hh > +timestamp_fmt+=":[[:digit:]]{2}" # mm > +timestamp_fmt+=":[[:digit:]]{2}" # ss > +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn > +timestamp_fmt+="\]" > + > +(+N.nnnnnnnnn) > +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" > + > +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" > + > +plan_tests 1 > + > +test_clock_date() { > + trace="$1" > + > + count=$($BABELTRACE_BIN --clock-date $trace | $GREP -c -E "$pattern") > + test $count -eq 19 > + ok $? "--clock-date displays the date in timestamps" > +} > + > +test_clock_date "$CTF_TRACES/succeed/wk-heartbeat-u" > diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds > new file mode 100755 > index 000000000000..2b5e13c5206d > --- /dev/null > +++ b/tests/bin/test_clock_seconds > @@ -0,0 +1,43 @@ > +#!/bin/bash > +# > +# Author: Nathan Lynch > +# Copyright (C) 2016 Mentor Graphics Corporation > +# > +# This program is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License, version 2 only, as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > +# more details. > +# > +# You should have received a copy of the GNU General Public License along with > +# this program; if not, write to the Free Software Foundation, Inc., 51 > +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + > +. "$TAPLIB" > + > +# [s]+.[nnnnnnnnn] > +timestamp_fmt="\[" > +timestamp_fmt+="[[:digit:]]+" # [s]+ > +timestamp_fmt+="\." > +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] > +timestamp_fmt+="\]" > + > +(+N.nnnnnnnnn) > +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" > + > +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" > + > +plan_tests 1 > + > +test_clock_seconds() { > + trace="$1" > + > + count=$($BABELTRACE_BIN --clock-seconds $trace | $GREP -c -E "$pattern") > + test $count -eq 19 > + ok $? "--clock-seconds prints timestamps as [sec.ns]" > +} > + > +test_clock_seconds "$CTF_TRACES/succeed/wk-heartbeat-u" > diff --git a/tests/bin/test_no_delta b/tests/bin/test_no_delta > new file mode 100755 > index 000000000000..37c118d30b8c > --- /dev/null > +++ b/tests/bin/test_no_delta > @@ -0,0 +1,40 @@ > +#!/bin/bash > +# > +# Copyright (C) - 2016 Nathan Lynch <nathan_lynch at mentor.com> > +# > +# This program is free software; you can redistribute it and/or modify it > +# under the terms of the GNU General Public License, version 2 only, as > +# published by the Free Software Foundation. > +# > +# This program is distributed in the hope that it will be useful, but WITHOUT > +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or > +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for > +# more details. > +# > +# You should have received a copy of the GNU General Public License along with > +# this program; if not, write to the Free Software Foundation, Inc., 51 > +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > + > +. "$TAPLIB" > + > +# [hh:mm:ss.nnnnnnnnn] > +timestamp_fmt="\[" > +timestamp_fmt+="[[:digit:]]{2}" # hh > +timestamp_fmt+=":[[:digit:]]{2}" # mm > +timestamp_fmt+=":[[:digit:]]{2}" # ss > +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn > +timestamp_fmt+="\]" > + > +pattern="^$timestamp_fmt wk-heartbeat:" > + > +plan_tests 1 > + > +test_no_delta() { > + trace="$1" > + > + count=$($BABELTRACE_BIN --no-delta $trace | $GREP -c -E "$pattern") > + test $count -eq 20 > + ok $? "--no-delta suppresses delta between events" > +} > + > +test_no_delta "$CTF_TRACES/succeed/wk-heartbeat-u" > -- Dr. Sébastien BOISVERT, Ph.D. Bioinformatics Software Specialist GYDLE inc. sboisvert at gydle.com +33 6 67 99 71 50 (Mobile, France) +33 4 92 28 02 50 (Fixe, France) +33 9 70 44 44 07 (Skype, France) +1 418 907 9377 # 380 (Gydle Québec Office) +1 581 308 9999 (Mobile, Canada) 101-1332 Av. Chanoine Morel Québec, QC G1S 4B4, Canada http://www.gydle.com signature v.2016-10-10.1 ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options 2016-10-26 7:11 ` Sebastien Boisvert @ 2016-10-26 13:36 ` Mathieu Desnoyers 2016-10-26 16:29 ` Nathan Lynch 0 siblings, 1 reply; 11+ messages in thread From: Mathieu Desnoyers @ 2016-10-26 13:36 UTC (permalink / raw) [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 10215 bytes --] ----- On Oct 26, 2016, at 3:11 AM, Sebastien Boisvert sboisvert at gydle.com wrote: > Hi Nathan, > >> diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds >> +# [s]+.[nnnnnnnnn] >> +timestamp_fmt="\[" >> +timestamp_fmt+="[[:digit:]]+" # [s]+ >> +timestamp_fmt+="\." >> +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] >> +timestamp_fmt+="\]" >> + > > > Is the timestamp 0.123456789 possible ? > > Is there a minimum for the left part, something like Epoch ? We can also have slightly negative timestamps due to support of non-GMT timezones. A timezone with a negative offset from GMT with an offset 0 (a trace which appears to be taken exactly at epoch) ends up at the very end of Dec 31, 1969. It can be represented with a negative timestamp with the s.ns notation. This mainly happen when a system boots without network connectivity and think it is exactly at Epoch. Not that uncommon unfortunately. Thanks, Mathieu > > > > On 2016-10-25 05:34 PM, Nathan Lynch wrote: >> Add simple tests for the following converter command line options: >> >> --no-delta >> --clock-cycles >> --clock-seconds >> --clock-date >> >> Signed-off-by: Nathan Lynch <nathan_lynch at mentor.com> >> --- >> tests/Makefile.am | 4 ++++ >> tests/bin/Makefile.am | 3 ++- >> tests/bin/test_clock_cycles | 41 ++++++++++++++++++++++++++++++++++++++ >> tests/bin/test_clock_date | 47 ++++++++++++++++++++++++++++++++++++++++++++ >> tests/bin/test_clock_seconds | 43 ++++++++++++++++++++++++++++++++++++++++ >> tests/bin/test_no_delta | 40 +++++++++++++++++++++++++++++++++++++ >> 6 files changed, 177 insertions(+), 1 deletion(-) >> create mode 100755 tests/bin/test_clock_cycles >> create mode 100755 tests/bin/test_clock_date >> create mode 100755 tests/bin/test_clock_seconds >> create mode 100755 tests/bin/test_no_delta >> >> diff --git a/tests/Makefile.am b/tests/Makefile.am >> index 28cb2eca7770..58d8ac861c4b 100644 >> --- a/tests/Makefile.am >> +++ b/tests/Makefile.am >> @@ -8,6 +8,10 @@ TESTS = bin/test_trace_read \ >> bin/test_trace_read \ >> bin/test_packet_seq_num \ >> bin/test_formats \ >> + bin/test_no_delta \ >> + bin/test_clock_cycles \ >> + bin/test_clock_date \ >> + bin/test_clock_seconds \ >> bin/intersection/test_intersection \ >> lib/test_bitfield \ >> lib/test_seek_empty_packet \ >> diff --git a/tests/bin/Makefile.am b/tests/bin/Makefile.am >> index 57b90ea72d80..00551c53f062 100644 >> --- a/tests/bin/Makefile.am >> +++ b/tests/bin/Makefile.am >> @@ -1,2 +1,3 @@ >> SUBDIRS = intersection >> -check_SCRIPTS = test_trace_read test_packet_seq_num test_formats >> +check_SCRIPTS = test_trace_read test_packet_seq_num test_formats test_no_delta >> \ >> + test_clock_cycles test_clock_seconds test_clock_date >> diff --git a/tests/bin/test_clock_cycles b/tests/bin/test_clock_cycles >> new file mode 100755 >> index 000000000000..2d0ca6a0f953 >> --- /dev/null >> +++ b/tests/bin/test_clock_cycles >> @@ -0,0 +1,41 @@ >> +#!/bin/bash >> +# >> +# Author: Nathan Lynch >> +# Copyright (C) 2016 Mentor Graphics Corporation >> +# >> +# This program is free software; you can redistribute it and/or modify it >> +# under the terms of the GNU General Public License, version 2 only, as >> +# published by the Free Software Foundation. >> +# >> +# This program is distributed in the hope that it will be useful, but WITHOUT >> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for >> +# more details. >> +# >> +# You should have received a copy of the GNU General Public License along with >> +# this program; if not, write to the Free Software Foundation, Inc., 51 >> +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> + >> +. "$TAPLIB" >> + >> +# [cccccccccccccccccccc] >> +timestamp_fmt="\[" >> +timestamp_fmt+="[[:digit:]]{20}" >> +timestamp_fmt+="\]" >> + >> +# (+N.nnnnnnnnn) >> +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" >> + >> +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" >> + >> +plan_tests 1 >> + >> +test_clock_cycles() { >> + trace="$1" >> + >> + count=$($BABELTRACE_BIN --clock-cycles $trace | $GREP -c -E "$pattern") >> + test $count -eq 19 >> + ok $? "--clock-cycles prints timestamps in cycles" >> +} >> + >> +test_clock_cycles "$CTF_TRACES/succeed/wk-heartbeat-u" >> diff --git a/tests/bin/test_clock_date b/tests/bin/test_clock_date >> new file mode 100755 >> index 000000000000..0aaab23d5869 >> --- /dev/null >> +++ b/tests/bin/test_clock_date >> @@ -0,0 +1,47 @@ >> +#!/bin/bash >> +# >> +# Author: Nathan Lynch >> +# Copyright (C) 2016 Mentor Graphics Corporation >> +# >> +# This program is free software; you can redistribute it and/or modify it >> +# under the terms of the GNU General Public License, version 2 only, as >> +# published by the Free Software Foundation. >> +# >> +# This program is distributed in the hope that it will be useful, but WITHOUT >> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for >> +# more details. >> +# >> +# You should have received a copy of the GNU General Public License along with >> +# this program; if not, write to the Free Software Foundation, Inc., 51 >> +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> + >> +. "$TAPLIB" >> + >> +# [YYYY-MM-DD hh:mm:ss.nnnnnnnnn] >> +timestamp_fmt="\[" >> +timestamp_fmt+="[[:digit:]]{4}" # YYYY >> +timestamp_fmt+="-[[:digit:]]{2}" # MM >> +timestamp_fmt+="-[[:digit:]]{2}" # DD >> +timestamp_fmt+=" [[:digit:]]{2}" # hh >> +timestamp_fmt+=":[[:digit:]]{2}" # mm >> +timestamp_fmt+=":[[:digit:]]{2}" # ss >> +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn >> +timestamp_fmt+="\]" >> + >> +(+N.nnnnnnnnn) >> +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" >> + >> +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" >> + >> +plan_tests 1 >> + >> +test_clock_date() { >> + trace="$1" >> + >> + count=$($BABELTRACE_BIN --clock-date $trace | $GREP -c -E "$pattern") >> + test $count -eq 19 >> + ok $? "--clock-date displays the date in timestamps" >> +} >> + >> +test_clock_date "$CTF_TRACES/succeed/wk-heartbeat-u" >> diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds >> new file mode 100755 >> index 000000000000..2b5e13c5206d >> --- /dev/null >> +++ b/tests/bin/test_clock_seconds >> @@ -0,0 +1,43 @@ >> +#!/bin/bash >> +# >> +# Author: Nathan Lynch >> +# Copyright (C) 2016 Mentor Graphics Corporation >> +# >> +# This program is free software; you can redistribute it and/or modify it >> +# under the terms of the GNU General Public License, version 2 only, as >> +# published by the Free Software Foundation. >> +# >> +# This program is distributed in the hope that it will be useful, but WITHOUT >> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for >> +# more details. >> +# >> +# You should have received a copy of the GNU General Public License along with >> +# this program; if not, write to the Free Software Foundation, Inc., 51 >> +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> + >> +. "$TAPLIB" >> + >> +# [s]+.[nnnnnnnnn] >> +timestamp_fmt="\[" >> +timestamp_fmt+="[[:digit:]]+" # [s]+ >> +timestamp_fmt+="\." >> +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] >> +timestamp_fmt+="\]" >> + >> +(+N.nnnnnnnnn) >> +delta_fmt="\(\+[[:digit:]]+\.[[:digit:]]{9}\)" >> + >> +pattern="^$timestamp_fmt $delta_fmt wk-heartbeat:" >> + >> +plan_tests 1 >> + >> +test_clock_seconds() { >> + trace="$1" >> + >> + count=$($BABELTRACE_BIN --clock-seconds $trace | $GREP -c -E "$pattern") >> + test $count -eq 19 >> + ok $? "--clock-seconds prints timestamps as [sec.ns]" >> +} >> + >> +test_clock_seconds "$CTF_TRACES/succeed/wk-heartbeat-u" >> diff --git a/tests/bin/test_no_delta b/tests/bin/test_no_delta >> new file mode 100755 >> index 000000000000..37c118d30b8c >> --- /dev/null >> +++ b/tests/bin/test_no_delta >> @@ -0,0 +1,40 @@ >> +#!/bin/bash >> +# >> +# Copyright (C) - 2016 Nathan Lynch <nathan_lynch at mentor.com> >> +# >> +# This program is free software; you can redistribute it and/or modify it >> +# under the terms of the GNU General Public License, version 2 only, as >> +# published by the Free Software Foundation. >> +# >> +# This program is distributed in the hope that it will be useful, but WITHOUT >> +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or >> +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for >> +# more details. >> +# >> +# You should have received a copy of the GNU General Public License along with >> +# this program; if not, write to the Free Software Foundation, Inc., 51 >> +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >> + >> +. "$TAPLIB" >> + >> +# [hh:mm:ss.nnnnnnnnn] >> +timestamp_fmt="\[" >> +timestamp_fmt+="[[:digit:]]{2}" # hh >> +timestamp_fmt+=":[[:digit:]]{2}" # mm >> +timestamp_fmt+=":[[:digit:]]{2}" # ss >> +timestamp_fmt+="\.[[:digit:]]{9}" # nnnnnnnnn >> +timestamp_fmt+="\]" >> + >> +pattern="^$timestamp_fmt wk-heartbeat:" >> + >> +plan_tests 1 >> + >> +test_no_delta() { >> + trace="$1" >> + >> + count=$($BABELTRACE_BIN --no-delta $trace | $GREP -c -E "$pattern") >> + test $count -eq 20 >> + ok $? "--no-delta suppresses delta between events" >> +} >> + >> +test_no_delta "$CTF_TRACES/succeed/wk-heartbeat-u" >> > > > -- > Dr. Sébastien BOISVERT, Ph.D. > Bioinformatics Software Specialist > GYDLE inc. > sboisvert at gydle.com > +33 6 67 99 71 50 (Mobile, France) > +33 4 92 28 02 50 (Fixe, France) > +33 9 70 44 44 07 (Skype, France) > +1 418 907 9377 # 380 (Gydle Québec Office) > +1 581 308 9999 (Mobile, Canada) > 101-1332 Av. Chanoine Morel > Québec, QC G1S 4B4, Canada > http://www.gydle.com > > signature v.2016-10-10.1 > _______________________________________________ > lttng-dev mailing list > lttng-dev at lists.lttng.org > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options 2016-10-26 13:36 ` Mathieu Desnoyers @ 2016-10-26 16:29 ` Nathan Lynch 0 siblings, 0 replies; 11+ messages in thread From: Nathan Lynch @ 2016-10-26 16:29 UTC (permalink / raw) On 10/26/2016 08:36 AM, Mathieu Desnoyers wrote: > ----- On Oct 26, 2016, at 3:11 AM, Sebastien Boisvert sboisvert at gydle.com wrote: > >> Hi Nathan, >> >>> diff --git a/tests/bin/test_clock_seconds b/tests/bin/test_clock_seconds >>> +# [s]+.[nnnnnnnnn] >>> +timestamp_fmt="\[" >>> +timestamp_fmt+="[[:digit:]]+" # [s]+ >>> +timestamp_fmt+="\." >>> +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] >>> +timestamp_fmt+="\]" >>> + >> >> >> Is the timestamp 0.123456789 possible ? >> >> Is there a minimum for the left part, something like Epoch ? > > We can also have slightly negative timestamps due to support of > non-GMT timezones. A timezone with a negative offset from GMT with > an offset 0 (a trace which appears to be taken exactly at epoch) > ends up at the very end of Dec 31, 1969. It can be represented > with a negative timestamp with the s.ns notation. > > This mainly happen when a system boots without network connectivity > and think it is exactly at Epoch. Not that uncommon unfortunately. I hadn't really intended to make the regexes in these tests rigorous beyond what was required for the wk-heartbeat-u sample trace but I suppose I could do so. Sample traces for this kind of case would be helpful. Alternatively, I could test verbatim (no regexes) against the output of: $ TZ='' babeltrace --clock-seconds \ tests/ctf-traces/succeed/wk-heartbeat-u Which should be stable across systems, no? ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests 2016-10-25 15:34 [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Nathan Lynch ` (2 preceding siblings ...) 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options Nathan Lynch @ 2016-10-25 15:50 ` Jonathan Rajotte Julien 2016-10-25 16:05 ` Nathan Lynch 3 siblings, 1 reply; 11+ messages in thread From: Jonathan Rajotte Julien @ 2016-10-25 15:50 UTC (permalink / raw) Hi Nathan, Simply curious On 2016-10-25 11:34 AM, Nathan Lynch wrote: > This is working toward moving from popt to GLib for command-line > parsing. What is the motivation behind this ? Cheers > I want to add some tests for at least some of the converter > command-line options in order to prevent regressions. > > I found it somewhat tedious to add even simple test scripts, so I > investigated alternatives to doing Autoconf variable substitution, and > this is what I came up with. I think it makes adding a test script > quite a bit easier. It also makes the test harness more flexible at > runtime, which is valuable when transferring a cross-compiled test > suite to a target system for execution there. > > I've included the new tests I've written so far in patch #3. > > Nathan Lynch (3): > babeltrace: use AM_TESTS_ENVIRONMENT for tests > babeltrace: drop configure-time substitutions in test scripts > babeltrace: add simple tests for converter command line options > > .gitignore | 10 ----- > configure.ac | 12 ------ > tests/Makefile.am | 16 ++++++++ > tests/bin/Makefile.am | 3 +- > 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_clock_cycles | 41 +++++++++++++++++++ > tests/bin/test_clock_date | 47 ++++++++++++++++++++++ > tests/bin/test_clock_seconds | 43 ++++++++++++++++++++ > tests/bin/{test_formats.in => test_formats} | 9 +---- > tests/bin/test_no_delta | 40 ++++++++++++++++++ > ...{test_packet_seq_num.in => test_packet_seq_num} | 16 +++----- > tests/bin/{test_trace_read.in => test_trace_read} | 9 +---- > ...st_dwarf_complete.in => test_bin_info_complete} | 4 +- > ...writer_complete.in => test_ctf_writer_complete} | 6 +-- > ...st_bin_info_complete.in => test_dwarf_complete} | 4 +- > ...{test_seek_big_trace.in => test_seek_big_trace} | 4 +- > ...seek_empty_packet.in => test_seek_empty_packet} | 4 +- > 19 files changed, 211 insertions(+), 75 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 > create mode 100755 tests/bin/test_clock_cycles > create mode 100755 tests/bin/test_clock_date > create mode 100755 tests/bin/test_clock_seconds > rename tests/bin/{test_formats.in => test_formats} (83%) > mode change 100644 => 100755 > create mode 100755 tests/bin/test_no_delta > 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%) > -- Jonathan R. Julien Efficios ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests 2016-10-25 15:50 ` [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Jonathan Rajotte Julien @ 2016-10-25 16:05 ` Nathan Lynch 2016-10-25 17:43 ` Michael Jeanson 0 siblings, 1 reply; 11+ messages in thread From: Nathan Lynch @ 2016-10-25 16:05 UTC (permalink / raw) On 10/25/2016 10:50 AM, Jonathan Rajotte Julien wrote: > > On 2016-10-25 11:34 AM, Nathan Lynch wrote: >> This is working toward moving from popt to GLib for command-line >> parsing. > > What is the motivation behind this ? Babeltrace already uses GLib extensively and, as best I can tell, it doesn't do anything with command-line options that GLib doesn't support. GLib's command-line parsing facility is explicitly intended to be a replacement for popt: https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html#glib-Commandline-option-parser.description I'm also working on improving Babeltrace's MinGW port and removing the popt dependency will make that easier. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests 2016-10-25 16:05 ` Nathan Lynch @ 2016-10-25 17:43 ` Michael Jeanson 2016-10-25 20:48 ` Nathan Lynch 0 siblings, 1 reply; 11+ messages in thread From: Michael Jeanson @ 2016-10-25 17:43 UTC (permalink / raw) On 2016-10-25 12:05, Nathan Lynch wrote: > On 10/25/2016 10:50 AM, Jonathan Rajotte Julien wrote: >> >> On 2016-10-25 11:34 AM, Nathan Lynch wrote: >>> This is working toward moving from popt to GLib for command-line >>> parsing. >> >> What is the motivation behind this ? > > Babeltrace already uses GLib extensively and, as best I can tell, it > doesn't do anything with command-line options that GLib doesn't support. > GLib's command-line parsing facility is explicitly intended to be a > replacement for popt: > > https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html#glib-Commandline-option-parser.description > > I'm also working on improving Babeltrace's MinGW port and removing the > popt dependency will make that easier. You should have a look at https://github.com/mjeanson/babeltrace/commits/mingw64 Cheers, Michael ^ permalink raw reply [flat|nested] 11+ messages in thread
* [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests 2016-10-25 17:43 ` Michael Jeanson @ 2016-10-25 20:48 ` Nathan Lynch 0 siblings, 0 replies; 11+ messages in thread From: Nathan Lynch @ 2016-10-25 20:48 UTC (permalink / raw) On 10/25/2016 12:43 PM, Michael Jeanson wrote: > On 2016-10-25 12:05, Nathan Lynch wrote: >> On 10/25/2016 10:50 AM, Jonathan Rajotte Julien wrote: >>> >>> On 2016-10-25 11:34 AM, Nathan Lynch wrote: >>>> This is working toward moving from popt to GLib for command-line >>>> parsing. >>> >>> What is the motivation behind this ? >> >> Babeltrace already uses GLib extensively and, as best I can tell, it >> doesn't do anything with command-line options that GLib doesn't support. >> GLib's command-line parsing facility is explicitly intended to be a >> replacement for popt: >> >> https://developer.gnome.org/glib/stable/glib-Commandline-option-parser.html#glib-Commandline-option-parser.description >> >> I'm also working on improving Babeltrace's MinGW port and removing the >> popt dependency will make that easier. > > You should have a look at > https://github.com/mjeanson/babeltrace/commits/mingw64 ah, great! I see some overlap with local changes I have already, but it looks like you've gotten further. What can I do to help this effort along? ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-10-26 16:29 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-10-25 15:34 [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 1/3] babeltrace: use AM_TESTS_ENVIRONMENT for tests Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 2/3] babeltrace: drop configure-time substitutions in test scripts Nathan Lynch 2016-10-25 15:34 ` [lttng-dev] [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options Nathan Lynch 2016-10-26 7:11 ` Sebastien Boisvert 2016-10-26 13:36 ` Mathieu Desnoyers 2016-10-26 16:29 ` Nathan Lynch 2016-10-25 15:50 ` [lttng-dev] [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests Jonathan Rajotte Julien 2016-10-25 16:05 ` Nathan Lynch 2016-10-25 17:43 ` Michael Jeanson 2016-10-25 20:48 ` Nathan Lynch
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox