All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH lttng-tools] Fix: support for older versions of Babeltrace in test script
@ 2016-12-20 21:31 Francis Deslauriers
  0 siblings, 0 replies; 2+ messages in thread
From: Francis Deslauriers @ 2016-12-20 21:31 UTC (permalink / raw)
  To: lttng-dev; +Cc: Philippe Proulx, jgalar

A new context field was introduced in version LTTng 2.8 that is printed
by Babeltrace prior to v1.2.5. This regex thus fails to match the
output. Since the context fields are not used by the script, we create a
non-capturing group for these fields that matches on both old and new
Babeltrace.
This is causing problems on Ubuntu 14.04 Trusty when building
lttng-tools from source and using the Babeltrace package from the
official repository (v1.2.1) to run the test suite.

Also, this patch removes commented and used code in the function but
keeps the names of non-capturing groups for readability.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
CC: Philippe Proulx <pproulx@efficios.com>
---
 tests/utils/babelstats.pl | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/tests/utils/babelstats.pl b/tests/utils/babelstats.pl
index 37a9b06..16766ba 100755
--- a/tests/utils/babelstats.pl
+++ b/tests/utils/babelstats.pl
@@ -141,31 +141,18 @@ my @events;
 
 while (<>)
 {
-	my $timestamp   = '\[(.*)\]';
-	my $elapsed     = '\((.*)\)';
-	my $hostname    = '.*';
-	my $pname       = '.*';
-	my $pinfo       = '.*';
-	my $pid         = '\d+';
-	my $tp_event    = '.*';
-	my $cpu_info    = '{\scpu_id\s=\s(\d+)\s\}';
-	my $fields      = '{(.*)}';
+	my $timestamp   = '\[(?:.*)\]';
+	my $elapsed     = '\((?:.*)\)';
+	my $hostname    = '(?:.*)';
+	my $tp_event    = '(.*)';
+	my $pkt_context = '(?:\{[^}]*\},\s)*';
+	my $fields      = '\{(.*)\}$';
 
 	# Parse babeltrace text output format
-	if (/$timestamp\s$elapsed\s($pinfo)\s($tp_event):\s$cpu_info,\s$fields/) {
+	if (/$timestamp\s$elapsed\s$hostname\s$tp_event:\s$pkt_context$fields/) {
 		my %event_hash;
-		$event_hash{'timestamp'}   = $1;
-		$event_hash{'elapsed'}     = $2;
-		$event_hash{'pinfo'}       = $3;
-
-#		my @split_pinfo = split(':', $3);
-#		$event_hash{'hostname'}    = $split_pinfo[0];
-#		$event_hash{'pname'}       = defined($split_pinfo[1]) ? $split_pinfo[1] : undef;
-#		$event_hash{'pid'}         = defined($split_pinfo[2]) ? $split_pinfo[2] : undef;
-
-		$event_hash{'tp_event'}    = $4;
-		$event_hash{'cpu_id'}      = $5;
-		$event_hash{'fields'}      = parse_fields($6);
+		$event_hash{'tp_event'}    = $1;
+		$event_hash{'fields'}      = parse_fields($2);
 
 		push @events, \%event_hash;
 	}
-- 
2.7.4

_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH lttng-tools] Fix: support for older versions of Babeltrace in test script
       [not found] <1482269486-20433-1-git-send-email-francis.deslauriers@efficios.com>
@ 2017-01-09 19:11 ` Jérémie Galarneau
  0 siblings, 0 replies; 2+ messages in thread
From: Jérémie Galarneau @ 2017-01-09 19:11 UTC (permalink / raw)
  To: Francis Deslauriers; +Cc: Philippe Proulx, lttng-dev, Jeremie Galarneau

Merged, thanks!

Jérémie

On 20 December 2016 at 16:31, Francis Deslauriers
<francis.deslauriers@efficios.com> wrote:
> A new context field was introduced in version LTTng 2.8 that is printed
> by Babeltrace prior to v1.2.5. This regex thus fails to match the
> output. Since the context fields are not used by the script, we create a
> non-capturing group for these fields that matches on both old and new
> Babeltrace.
> This is causing problems on Ubuntu 14.04 Trusty when building
> lttng-tools from source and using the Babeltrace package from the
> official repository (v1.2.1) to run the test suite.
>
> Also, this patch removes commented and used code in the function but
> keeps the names of non-capturing groups for readability.
>
> Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
> CC: Philippe Proulx <pproulx@efficios.com>
> ---
>  tests/utils/babelstats.pl | 31 +++++++++----------------------
>  1 file changed, 9 insertions(+), 22 deletions(-)
>
> diff --git a/tests/utils/babelstats.pl b/tests/utils/babelstats.pl
> index 37a9b06..16766ba 100755
> --- a/tests/utils/babelstats.pl
> +++ b/tests/utils/babelstats.pl
> @@ -141,31 +141,18 @@ my @events;
>
>  while (<>)
>  {
> -       my $timestamp   = '\[(.*)\]';
> -       my $elapsed     = '\((.*)\)';
> -       my $hostname    = '.*';
> -       my $pname       = '.*';
> -       my $pinfo       = '.*';
> -       my $pid         = '\d+';
> -       my $tp_event    = '.*';
> -       my $cpu_info    = '{\scpu_id\s=\s(\d+)\s\}';
> -       my $fields      = '{(.*)}';
> +       my $timestamp   = '\[(?:.*)\]';
> +       my $elapsed     = '\((?:.*)\)';
> +       my $hostname    = '(?:.*)';
> +       my $tp_event    = '(.*)';
> +       my $pkt_context = '(?:\{[^}]*\},\s)*';
> +       my $fields      = '\{(.*)\}$';
>
>         # Parse babeltrace text output format
> -       if (/$timestamp\s$elapsed\s($pinfo)\s($tp_event):\s$cpu_info,\s$fields/) {
> +       if (/$timestamp\s$elapsed\s$hostname\s$tp_event:\s$pkt_context$fields/) {
>                 my %event_hash;
> -               $event_hash{'timestamp'}   = $1;
> -               $event_hash{'elapsed'}     = $2;
> -               $event_hash{'pinfo'}       = $3;
> -
> -#              my @split_pinfo = split(':', $3);
> -#              $event_hash{'hostname'}    = $split_pinfo[0];
> -#              $event_hash{'pname'}       = defined($split_pinfo[1]) ? $split_pinfo[1] : undef;
> -#              $event_hash{'pid'}         = defined($split_pinfo[2]) ? $split_pinfo[2] : undef;
> -
> -               $event_hash{'tp_event'}    = $4;
> -               $event_hash{'cpu_id'}      = $5;
> -               $event_hash{'fields'}      = parse_fields($6);
> +               $event_hash{'tp_event'}    = $1;
> +               $event_hash{'fields'}      = parse_fields($2);
>
>                 push @events, \%event_hash;
>         }
> --
> 2.7.4
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-09 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 21:31 [PATCH lttng-tools] Fix: support for older versions of Babeltrace in test script Francis Deslauriers
     [not found] <1482269486-20433-1-git-send-email-francis.deslauriers@efficios.com>
2017-01-09 19:11 ` Jérémie Galarneau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.