#include "tap/tap.h"
#include <math.h>
#include <float.h>
-#include <sys/stat.h>
+#include "common.h"
#define METADATA_LINE_SIZE 512
#define SEQUENCE_TEST_LENGTH 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)
"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
bt_put(non_writer_clock);
bt_put(packet);
bt_put(packet2);
- delete_trace(trace_path);
+ recursive_rmdir(trace_path);
}
static
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");
free(metadata_string);
bt_put(stream_class);
- delete_trace(trace_path);
+ recursive_rmdir(trace_path);
return 0;
}