babeltrace: use AM_TESTS_ENVIRONMENT for tests
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 babeltrace: use AM_TESTS_ENVIRONMENT for tests
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.
--- tests/Makefile.am | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tests/Makefile.am +12 -0
@@ -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;
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
PATCH 2/3 babeltrace: drop configure-time substitutions in test scripts
In reply to a message not in the archivePerform 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.
---
.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%).gitignore +0 -10
@@ -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
configure.ac +0 -12
@@ -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 #
tests/bin/intersection/Makefile.am +1 -1
@@ -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 \
tests/bin/intersection/bt_python_helper.py renamed from tests/bin/intersection/bt_python_helper.py.in +5 -4
@@ -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)
tests/bin/intersection/test_intersection renamed from tests/bin/intersection/test_intersection.in +1 -6
@@ -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
tests/bin/test_formats renamed from tests/bin/test_formats.in +2 -7
@@ -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
tests/bin/test_packet_seq_num renamed from tests/bin/test_packet_seq_num.in +5 -11
@@ -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" }
tests/bin/test_trace_read renamed from tests/bin/test_trace_read.in +1 -8
@@ -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/*)
tests/lib/test_bin_info_complete renamed from tests/lib/test_dwarf_complete.in +1 -3
@@ -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"
tests/lib/test_ctf_writer_complete renamed from tests/lib/test_ctf_writer_complete.in +3 -3
@@ -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"
tests/lib/test_dwarf_complete renamed from tests/lib/test_bin_info_complete.in +1 -3
@@ -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"
tests/lib/test_seek_big_trace renamed from tests/lib/test_seek_big_trace.in +1 -3
@@ -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
tests/lib/test_seek_empty_packet renamed from tests/lib/test_seek_empty_packet.in +1 -3
@@ -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
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
PATCH 3/3 babeltrace: add simple tests for converter command line options
In reply to a message not in the archiveAdd simple tests for the following converter command line options:
--no-delta
--clock-cycles
--clock-seconds
--clock-date
--- 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
tests/Makefile.am +4 -0
@@ -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 \
tests/bin/Makefile.am +2 -1
@@ -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
tests/bin/test_clock_cycles new file +41 -0
41 lines not on this page · raw message
tests/bin/test_clock_date new file +47 -0
47 lines not on this page · raw message
tests/bin/test_clock_seconds new file +43 -0
43 lines not on this page · raw message
tests/bin/test_no_delta new file +40 -0
@@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) - 2016 Nathan Lynch <[email protected]> +# +# 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"
Signature · 6 lines
2.7.4 _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Re: [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests
In reply to a message not in the archiveHi Nathan,
Simply curious
Quoted 2 lines · Nathan Lynch
This is working toward moving from popt to GLib for command-line parsing.
What is the motivation behind this ?
Cheers
Quoted 56 lines
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: useAM_TESTS_ENVIRONMENTfor 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%)
Signature · 7 lines
Jonathan R. Julien Efficios _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests
Quoted 6 lines · Jonathan Rajotte Julien
Quoted 2 lines · Nathan Lynch
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:
I'm also working on improving Babeltrace's MinGW port and removing the popt dependency will make that easier.
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests
Quoted 13 lines · Nathan Lynch
Quoted 6 lines · Jonathan Rajotte Julien
Quoted 2 lines · Nathan Lynch
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:
Quoted 4 lines
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
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 0/3] babeltrace: test harness improvements + new tests
Quoted 14 lines · Michael Jeanson
Quoted 13 lines · Nathan Lynch
Quoted 6 lines · Jonathan Rajotte Julien
Quoted 2 lines · Nathan Lynch
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:
Quoted 7 lines
Quoted 4 lines
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?
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options
Hi Nathan,
tests/bin/test_clock_seconds
Quoted 8 lines
tests/bin/test_clock_seconds +7
-0+# [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 ?
Quoted 241 lines · Nathan Lynch
Add simple tests for the following converter command line options:
--no-delta
--clock-cycles
--clock-seconds
--clock-dateSigned-off-by Nathan Lynch <[email protected]>--- 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_deltatests/Makefile.am +4
-0@@ -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 \tests/bin/Makefile.am +2
-1@@ -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_datetests/bin/test_clock_cycles new file +41
-0@@ -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"tests/bin/test_clock_date new file +47
-0@@ -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"tests/bin/test_clock_seconds new file +43
-0@@ -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"tests/bin/test_no_delta new file +40
-0@@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) - 2016 Nathan Lynch <[email protected]> +# +# 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"
Signature · 18 lines
Dr. Sébastien BOISVERT, Ph.D. Bioinformatics Software Specialist GYDLE inc. [email protected] +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 [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options
Quoted 14 lines · ----- On Oct 26, 2016, at 3:11 AM, Sebastien Boisvert [email protected] wrote:
Hi Nathan,
tests/bin/test_clock_seconds
Quoted 8 lines
tests/bin/test_clock_seconds +7
-0+# [s]+.[nnnnnnnnn] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]+" # [s]+ +timestamp_fmt+="\." +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] +timestamp_fmt+="\]" +Is the timestamp 0.123456789 possible ?
Quoted 1 line
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
Quoted 267 lines · Nathan Lynch
Quoted 232 lines
Add simple tests for the following converter command line options:
--no-delta
--clock-cycles
--clock-seconds
--clock-dateSigned-off-by Nathan Lynch <[email protected]>--- 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_deltatests/Makefile.am +4
-0@@ -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 \tests/bin/Makefile.am +1
-1@@ -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\
tests/bin/Makefile.am +1
-0+ test_clock_cycles test_clock_seconds test_clock_datetests/bin/test_clock_cycles new file +41
-0@@ -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"tests/bin/test_clock_date new file +47
-0@@ -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"tests/bin/test_clock_seconds new file +43
-0@@ -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"tests/bin/test_no_delta new file +30
-0@@ -0,0 +1,40 @@ +#!/bin/bash +# +# Copyright (C) - 2016 Nathan Lynch <[email protected]> +# +# 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 1tests/bin/test_no_delta line 40
Quoted 10 lines
tests/bin/test_no_delta new file +10
-0+ +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.
[email protected]
+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.comsignature v.2016-10-10.1
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
Signature · 7 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [RFC/PATCH 3/3] babeltrace: add simple tests for converter command line options
Quoted 18 lines · Mathieu Desnoyers
Quoted 14 lines · ----- On Oct 26, 2016, at 3:11 AM, Sebastien Boisvert [email protected] wrote:
Hi Nathan,
tests/bin/test_clock_seconds
Quoted 8 lines
tests/bin/test_clock_seconds +7
-0+# [s]+.[nnnnnnnnn] +timestamp_fmt="\[" +timestamp_fmt+="[[:digit:]]+" # [s]+ +timestamp_fmt+="\." +timestamp_fmt+="[[:digit:]]{9}" # [nnnnnnnnn] +timestamp_fmt+="\]" +Is the timestamp 0.123456789 possible ?
Quoted 1 line
Is there a minimum for the left part, something like Epoch ?
Quoted 8 lines
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?
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev