#ifndef TEST_UTILS_H #define TEST_UTILS_H #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #ifndef PATH_MAX #define PATH_MAX 4096 #endif static inline double time_diff_sec(struct timespec a, struct timespec b) { return (b.tv_sec - a.tv_sec) + (b.tv_nsec - a.tv_nsec) / 1000000000.0; } static inline void make_path(char *out, size_t out_sz, const char *dir, const char *name) { if (dir && dir[0] != 0) { snprintf(out, out_sz, "%s/%s", dir, name); } else { snprintf(out, out_sz, "/tmp/%s", name); } } static inline int report_result(const char *name, int rc) { printf("\n=== %s %s ===\n", name, rc == 0 ? "PASSED" : "FAILED"); return rc; } #endif