All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH babeltrace] Fix: test_seek should only output one TAP plan
       [not found] <1377540914-17523-1-git-send-email-christian.babeux@efficios.com>
@ 2013-08-26 18:37 ` Mathieu Desnoyers
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2013-08-26 18:37 UTC (permalink / raw)
  To: Christian Babeux; +Cc: lttng-dev

* Christian Babeux (christian.babeux@efficios.com) wrote:
> On critical failure paths, the test_seek test was outputting multiple TAP plans,
> which according to the specification [1] is invalid. This causes parsing
> issues on very strict TAP parsers.

Merged, but please cut your changelog to 72 columns in the future.

Thanks,

Mathieu

> 
> [1] - http://podwiki.hexten.net/TAP/TAP.html?page=TAP
> 
> Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
> ---
>  tests/lib/test_seek.c | 43 +++++++++++++++++++++++++++++++++----------
>  1 file changed, 33 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/lib/test_seek.c b/tests/lib/test_seek.c
> index 170c830..4e1a823 100644
> --- a/tests/lib/test_seek.c
> +++ b/tests/lib/test_seek.c
> @@ -44,17 +44,22 @@ void run_seek_begin(char *path, uint64_t expected_begin)
>  	int ret;
>  	uint64_t timestamp_begin;
>  	uint64_t timestamp_seek_begin;
> +	unsigned int nr_seek_begin_test;
> +
> +	nr_seek_begin_test = 5;
>  
>  	/* Open the trace */
>  	ctx = create_context_with_path(path);
>  	if (!ctx) {
> -		plan_skip_all("Cannot create valid context");
> +		skip(nr_seek_begin_test, "Cannot create valid context");
> +		return;
>  	}
>  
>  	/* Create iterator with null begin and end */
>  	iter = bt_ctf_iter_create(ctx, NULL, NULL);
>  	if (!iter) {
> -		plan_skip_all("Cannot create valid iterator");
> +		skip(nr_seek_begin_test, "Cannot create valid iterator");
> +		return;
>  	}
>  
>  	event = bt_ctf_iter_read_event(iter);
> @@ -92,17 +97,22 @@ void run_seek_last(char *path, uint64_t expected_last)
>  	struct bt_iter_pos newpos;
>  	int ret;
>  	uint64_t timestamp_last;
> +	unsigned int nr_seek_last_tests;
> +
> +	nr_seek_last_tests = 6;
>  
>  	/* Open the trace */
>  	ctx = create_context_with_path(path);
>  	if (!ctx) {
> -		plan_skip_all("Cannot create valid context");
> +		skip(nr_seek_last_tests, "Cannot create valid context");
> +		return;
>  	}
>  
>  	/* Create iterator with null last and end */
>  	iter = bt_ctf_iter_create(ctx, NULL, NULL);
>  	if (!iter) {
> -		plan_skip_all("Cannot create valid iterator");
> +		skip(nr_seek_last_tests, "Cannot create valid iterator");
> +		return;
>  	}
>  
>  	event = bt_ctf_iter_read_event(iter);
> @@ -143,17 +153,24 @@ void run_seek_time_at_last(char *path, uint64_t expected_last)
>  	struct bt_iter_pos newpos;
>  	int ret;
>  	uint64_t timestamp_last;
> +	unsigned int nr_seek_time_at_last_tests;
> +
> +	nr_seek_time_at_last_tests = 6;
>  
>  	/* Open the trace */
>  	ctx = create_context_with_path(path);
>  	if (!ctx) {
> -		plan_skip_all("Cannot create valid context");
> +		skip(nr_seek_time_at_last_tests,
> +		     "Cannot create valid context");
> +		return;
>  	}
>  
>  	/* Create iterator with null last and end */
>  	iter = bt_ctf_iter_create(ctx, NULL, NULL);
>  	if (!iter) {
> -		plan_skip_all("Cannot create valid iterator");
> +		skip(nr_seek_time_at_last_tests,
> +		     "Cannot create valid iterator");
> +		return;
>  	}
>  
>  	event = bt_ctf_iter_read_event(iter);
> @@ -198,16 +215,22 @@ void run_seek_cycles(char *path,
>  	int ret;
>  	uint64_t timestamp;
>  
> +	unsigned int nr_seek_cycles_tests;
> +
> +	nr_seek_cycles_tests = 12;
> +
>  	/* Open the trace */
>  	ctx = create_context_with_path(path);
>  	if (!ctx) {
> -		plan_skip_all("Cannot create valid context");
> +		skip(nr_seek_cycles_tests, "Cannot create valid context");
> +		return;
>  	}
>  
>  	/* Create iterator with null last and end */
>  	iter = bt_ctf_iter_create(ctx, NULL, NULL);
>  	if (!iter) {
> -		plan_skip_all("Cannot create valid iterator");
> +		skip(nr_seek_cycles_tests, "Cannot create valid iterator");
> +		return;
>  	}
>  
>  	event = bt_ctf_iter_read_event(iter);
> @@ -281,8 +304,6 @@ int main(int argc, char **argv)
>  	babeltrace_debug = 0;	/* libbabeltrace.la */
>  	opt_clock_offset = 0;	/* libbabeltrace-ctf.la */
>  
> -	plan_tests(NR_TESTS);
> -
>  	if (argc < 4) {
>  		plan_skip_all("Invalid arguments: need a trace path and the start and last timestamp");
>  
> @@ -301,6 +322,8 @@ int main(int argc, char **argv)
>  		plan_skip_all("Invalid value for last timestamp");
>  	}
>  
> +	plan_tests(NR_TESTS);
> +
>  	run_seek_begin(path, expected_begin);
>  	run_seek_time_at_last(path, expected_last);
>  	run_seek_last(path, expected_last);
> -- 
> 1.8.3.4
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

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

* [PATCH babeltrace] Fix: test_seek should only output one TAP plan
@ 2013-08-26 18:15 Christian Babeux
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Babeux @ 2013-08-26 18:15 UTC (permalink / raw)
  To: mathieu.desnoyers; +Cc: lttng-dev

On critical failure paths, the test_seek test was outputting multiple TAP plans,
which according to the specification [1] is invalid. This causes parsing
issues on very strict TAP parsers.

[1] - http://podwiki.hexten.net/TAP/TAP.html?page=TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
---
 tests/lib/test_seek.c | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/tests/lib/test_seek.c b/tests/lib/test_seek.c
index 170c830..4e1a823 100644
--- a/tests/lib/test_seek.c
+++ b/tests/lib/test_seek.c
@@ -44,17 +44,22 @@ void run_seek_begin(char *path, uint64_t expected_begin)
 	int ret;
 	uint64_t timestamp_begin;
 	uint64_t timestamp_seek_begin;
+	unsigned int nr_seek_begin_test;
+
+	nr_seek_begin_test = 5;
 
 	/* Open the trace */
 	ctx = create_context_with_path(path);
 	if (!ctx) {
-		plan_skip_all("Cannot create valid context");
+		skip(nr_seek_begin_test, "Cannot create valid context");
+		return;
 	}
 
 	/* Create iterator with null begin and end */
 	iter = bt_ctf_iter_create(ctx, NULL, NULL);
 	if (!iter) {
-		plan_skip_all("Cannot create valid iterator");
+		skip(nr_seek_begin_test, "Cannot create valid iterator");
+		return;
 	}
 
 	event = bt_ctf_iter_read_event(iter);
@@ -92,17 +97,22 @@ void run_seek_last(char *path, uint64_t expected_last)
 	struct bt_iter_pos newpos;
 	int ret;
 	uint64_t timestamp_last;
+	unsigned int nr_seek_last_tests;
+
+	nr_seek_last_tests = 6;
 
 	/* Open the trace */
 	ctx = create_context_with_path(path);
 	if (!ctx) {
-		plan_skip_all("Cannot create valid context");
+		skip(nr_seek_last_tests, "Cannot create valid context");
+		return;
 	}
 
 	/* Create iterator with null last and end */
 	iter = bt_ctf_iter_create(ctx, NULL, NULL);
 	if (!iter) {
-		plan_skip_all("Cannot create valid iterator");
+		skip(nr_seek_last_tests, "Cannot create valid iterator");
+		return;
 	}
 
 	event = bt_ctf_iter_read_event(iter);
@@ -143,17 +153,24 @@ void run_seek_time_at_last(char *path, uint64_t expected_last)
 	struct bt_iter_pos newpos;
 	int ret;
 	uint64_t timestamp_last;
+	unsigned int nr_seek_time_at_last_tests;
+
+	nr_seek_time_at_last_tests = 6;
 
 	/* Open the trace */
 	ctx = create_context_with_path(path);
 	if (!ctx) {
-		plan_skip_all("Cannot create valid context");
+		skip(nr_seek_time_at_last_tests,
+		     "Cannot create valid context");
+		return;
 	}
 
 	/* Create iterator with null last and end */
 	iter = bt_ctf_iter_create(ctx, NULL, NULL);
 	if (!iter) {
-		plan_skip_all("Cannot create valid iterator");
+		skip(nr_seek_time_at_last_tests,
+		     "Cannot create valid iterator");
+		return;
 	}
 
 	event = bt_ctf_iter_read_event(iter);
@@ -198,16 +215,22 @@ void run_seek_cycles(char *path,
 	int ret;
 	uint64_t timestamp;
 
+	unsigned int nr_seek_cycles_tests;
+
+	nr_seek_cycles_tests = 12;
+
 	/* Open the trace */
 	ctx = create_context_with_path(path);
 	if (!ctx) {
-		plan_skip_all("Cannot create valid context");
+		skip(nr_seek_cycles_tests, "Cannot create valid context");
+		return;
 	}
 
 	/* Create iterator with null last and end */
 	iter = bt_ctf_iter_create(ctx, NULL, NULL);
 	if (!iter) {
-		plan_skip_all("Cannot create valid iterator");
+		skip(nr_seek_cycles_tests, "Cannot create valid iterator");
+		return;
 	}
 
 	event = bt_ctf_iter_read_event(iter);
@@ -281,8 +304,6 @@ int main(int argc, char **argv)
 	babeltrace_debug = 0;	/* libbabeltrace.la */
 	opt_clock_offset = 0;	/* libbabeltrace-ctf.la */
 
-	plan_tests(NR_TESTS);
-
 	if (argc < 4) {
 		plan_skip_all("Invalid arguments: need a trace path and the start and last timestamp");
 
@@ -301,6 +322,8 @@ int main(int argc, char **argv)
 		plan_skip_all("Invalid value for last timestamp");
 	}
 
+	plan_tests(NR_TESTS);
+
 	run_seek_begin(path, expected_begin);
 	run_seek_time_at_last(path, expected_last);
 	run_seek_last(path, expected_last);
-- 
1.8.3.4

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

end of thread, other threads:[~2013-08-26 18:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1377540914-17523-1-git-send-email-christian.babeux@efficios.com>
2013-08-26 18:37 ` [PATCH babeltrace] Fix: test_seek should only output one TAP plan Mathieu Desnoyers
2013-08-26 18:15 Christian Babeux

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.