Use fixed count test plans in all tests and make sure we do not skip
some tests on initialisation failures.
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
/tests/lib/test_ctf_writer
/tests/lib/test_bt_objects
/tests/lib/test_bt_values
/tests/lib/test_ctf_writer
/tests/lib/test_bt_objects
/tests/lib/test_bt_values
+/tests/lib/test_ctf_ir_ref
#include <string.h>
#include "tap/tap.h"
#include <string.h>
#include "tap/tap.h"
static
void test_null(void)
{
static
void test_null(void)
{
test_macros();
test_freeze();
test_macros();
test_freeze();
#include <babeltrace/object-internal.h>
#include <assert.h>
#include <babeltrace/object-internal.h>
#include <assert.h>
struct user {
struct bt_ctf_trace *tc;
struct bt_ctf_stream_class *sc;
struct user {
struct bt_ctf_trace *tc;
struct bt_ctf_stream_class *sc;
*weak_ec3 = NULL;
struct user user_a = { 0 }, user_b = { 0 }, user_c = { 0 };
*weak_ec3 = NULL;
struct user user_a = { 0 }, user_b = { 0 }, user_c = { 0 };
+ /* Initialize tap harness before any tests */
+ plan_tests(NR_TESTS);
+
/* The only reference which exists at this point is on TC1. */
tc1 = create_tc1();
ok(tc1, "Initialize trace");
/* The only reference which exists at this point is on TC1. */
tc1 = create_tc1();
ok(tc1, "Initialize trace");
init_weak_refs(tc1, &weak_tc1, &weak_sc1, &weak_sc2, &weak_ec1,
&weak_ec2, &weak_ec3);
init_weak_refs(tc1, &weak_tc1, &weak_sc1, &weak_sc2, &weak_ec1,
&weak_ec2, &weak_ec3);
ok(bt_object_get_ref_count(weak_sc1) == 0,
"Initial SC1 reference count is 0");
ok(bt_object_get_ref_count(weak_sc1) == 0,
"Initial SC1 reference count is 0");
#define DEFAULT_CLOCK_IS_ABSOLUTE 0
#define DEFAULT_CLOCK_TIME 0
#define DEFAULT_CLOCK_IS_ABSOLUTE 0
#define DEFAULT_CLOCK_TIME 0
static uint64_t current_time = 42;
/* Return 1 if uuids match, zero if different. */
static uint64_t current_time = 42;
/* Return 1 if uuids match, zero if different. */
if (!bt_mkdtemp(trace_path)) {
perror("# perror");
if (!bt_mkdtemp(trace_path)) {
perror("# perror");
int ret;
uint64_t timestamp_begin;
uint64_t timestamp_seek_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) {
/* Open the trace */
ctx = create_context_with_path(path);
if (!ctx) {
- skip(nr_seek_begin_test, "Cannot create valid context");
+ diag("Cannot create valid context");
return;
}
/* Create iterator with null begin and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
return;
}
/* Create iterator with null begin and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
- skip(nr_seek_begin_test, "Cannot create valid iterator");
+ diag("Cannot create valid iterator");
struct bt_iter_pos newpos;
int ret;
uint64_t timestamp_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) {
/* Open the trace */
ctx = create_context_with_path(path);
if (!ctx) {
- skip(nr_seek_last_tests, "Cannot create valid context");
+ diag("Cannot create valid context");
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
- skip(nr_seek_last_tests, "Cannot create valid iterator");
+ diag("Cannot create valid iterator");
struct bt_iter_pos newpos;
int ret;
uint64_t timestamp_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) {
/* Open the trace */
ctx = create_context_with_path(path);
if (!ctx) {
- skip(nr_seek_time_at_last_tests,
- "Cannot create valid context");
+ diag("Cannot create valid context");
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
- skip(nr_seek_time_at_last_tests,
- "Cannot create valid iterator");
+ diag("Cannot create valid iterator");
int ret;
uint64_t timestamp;
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) {
/* Open the trace */
ctx = create_context_with_path(path);
if (!ctx) {
- skip(nr_seek_cycles_tests, "Cannot create valid context");
+ diag("Cannot create valid context");
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
return;
}
/* Create iterator with null last and end */
iter = bt_ctf_iter_create(ctx, NULL, NULL);
if (!iter) {
- skip(nr_seek_cycles_tests, "Cannot create valid iterator");
+ diag("Cannot create valid iterator");
babeltrace_debug = 0; /* libbabeltrace.la */
opt_clock_offset = 0; /* libbabeltrace-ctf.la */
babeltrace_debug = 0; /* libbabeltrace.la */
opt_clock_offset = 0; /* libbabeltrace-ctf.la */
- if (argc < 4) {
- plan_skip_all("Invalid arguments: need a trace path and the start and last timestamp");
+ if (argc < 4) {
+ diag("Invalid arguments: need a trace path and the start and last timestamp");
+ exit(1);
}
/* Parse arguments (Trace, begin timestamp) */
}
/* Parse arguments (Trace, begin timestamp) */
expected_begin = strtoull(argv[2], NULL, 0);
if (ULLONG_MAX == expected_begin && errno == ERANGE) {
expected_begin = strtoull(argv[2], NULL, 0);
if (ULLONG_MAX == expected_begin && errno == ERANGE) {
- plan_skip_all("Invalid value for begin timestamp");
+ diag("Invalid value for begin timestamp");
+ exit(1);
}
expected_last = strtoull(argv[3], NULL, 0);
if (ULLONG_MAX == expected_last && errno == ERANGE) {
}
expected_last = strtoull(argv[3], NULL, 0);
if (ULLONG_MAX == expected_last && errno == ERANGE) {
- plan_skip_all("Invalid value for last timestamp");
+ diag("Invalid value for last timestamp");
+ exit(1);
- plan_tests(NR_TESTS);
-
run_seek_begin(path, expected_begin);
run_seek_time_at_last(path, expected_last);
run_seek_last(path, expected_last);
run_seek_begin(path, expected_begin);
run_seek_time_at_last(path, expected_last);
run_seek_last(path, expected_last);