X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=tests%2Flib%2Ftest_ctf_writer.c;h=9d92aa61c1d9b70db1d8b1c3a328a0b616e11af3;hb=a046cf3cdf5682791b87221bfc7c13c80e96df00;hp=c756c55484a368cccd0fe867407b894ad8f6e875;hpb=a3d8579b8aab73e557495a934c7c00490fda9a2d;p=babeltrace.git diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index c756c554..9d92aa61 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -44,7 +44,7 @@ #include "tap/tap.h" #include #include -#include +#include "common.h" #define METADATA_LINE_SIZE 512 #define SEQUENCE_TEST_LENGTH 10 @@ -59,44 +59,10 @@ #define DEFAULT_CLOCK_TIME 0 #define DEFAULT_CLOCK_VALUE 0 -#define NR_TESTS 605 +#define NR_TESTS 606 static int64_t current_time = 42; -static -void delete_trace(const char *trace_path) -{ - /* Remove all trace files and delete temporary trace directory */ - struct dirent *entry; - DIR *trace_dir = opendir(trace_path); - - if (!trace_dir) { - perror("# opendir"); - return; - } - - while ((entry = readdir(trace_dir))) { - struct stat st; - char filename[PATH_MAX]; - - if (snprintf(filename, sizeof(filename), "%s/%s", - trace_path, entry->d_name) <= 0) { - continue; - } - - if (stat(filename, &st)) { - continue; - } - - if (S_ISREG(st.st_mode)) { - unlinkat(bt_dirfd(trace_dir), entry->d_name, 0); - } - } - - rmdir(trace_path); - closedir(trace_dir); -} - /* Return 1 if uuids match, zero if different. */ static int uuid_match(const unsigned char *uuid_a, const unsigned char *uuid_b) @@ -527,7 +493,8 @@ void append_simple_event(struct bt_ctf_stream_class *stream_class, "bt_ctf_event_class_get_context_type returns the appropriate type"); bt_put(returned_type); - bt_ctf_stream_class_add_event_class(stream_class, simple_event_class); + ok(!bt_ctf_stream_class_add_event_class(stream_class, simple_event_class), + "Adding simple event class to stream class"); /* * bt_ctf_stream_class_add_event_class() copies the field types @@ -2919,7 +2886,7 @@ void test_create_writer_vs_non_writer_mode(void) bt_put(non_writer_clock); bt_put(packet); bt_put(packet2); - delete_trace(trace_path); + recursive_rmdir(trace_path); } static @@ -3307,7 +3274,7 @@ int main(int argc, char **argv) ok(bt_ctf_clock_set_uuid(clock, NULL) < 0, "bt_ctf_clock_set_uuid correctly handles a NULL UUID"); ok(bt_ctf_clock_set_uuid(clock, tmp_uuid) == 0, - "bt_ctf_clock_set_uuid sets a new uuid succesfully"); + "bt_ctf_clock_set_uuid sets a new uuid successfully"); ret_uuid = bt_ctf_clock_get_uuid(clock); ok(ret_uuid, "bt_ctf_clock_get_uuid returns a UUID after setting a new one"); @@ -3637,6 +3604,6 @@ int main(int argc, char **argv) free(metadata_string); bt_put(stream_class); - delete_trace(trace_path); + recursive_rmdir(trace_path); return 0; }