X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;ds=sidebyside;f=tests%2Flib%2Ftest_seek.c;h=3c78e8ad89c471ffdbd07b7edd875bbf4350e8ef;hb=e08b9e07b43b305ee9f31690b5c27e5ae24f0078;hp=b33f80dc2e08455987ecc01b244916371712e417;hpb=6b31ae9ce6bdca8682a6c936c6c20caae378e021;p=babeltrace.git diff --git a/tests/lib/test_seek.c b/tests/lib/test_seek.c index b33f80dc..3c78e8ad 100644 --- a/tests/lib/test_seek.c +++ b/tests/lib/test_seek.c @@ -18,11 +18,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _GNU_SOURCE + #include #include #include #include +#include /* For symbol side-effects */ #include #include @@ -43,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); @@ -91,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); @@ -142,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); @@ -197,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); @@ -273,7 +297,12 @@ int main(int argc, char **argv) uint64_t expected_begin; uint64_t expected_last; - plan_tests(NR_TESTS); + /* + * Side-effects ensuring libs are not optimized away by static + * linking. + */ + 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"); @@ -293,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);