From 5b980734ed845356ac5a859454ef425667a66526 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Mon, 20 Feb 2023 14:41:03 +0100 Subject: [PATCH] Add unit test cases for thread init --- test/unit/thread.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/test/unit/thread.c b/test/unit/thread.c index 482856f..1bbecc2 100644 --- a/test/unit/thread.c +++ b/test/unit/thread.c @@ -1,8 +1,31 @@ +#include "unittest.h" #include "emu/thread.h" -#include "common.h" +/* Ensure we can load the old trace format */ +static void +test_old_trace(void) +{ + struct thread th; + + OK(thread_init_begin(&th, "loom.0/proc.0/thread.1.obs")); + if (th.tid != 1) + die("wrong tid"); + + OK(thread_init_begin(&th, "loom.0/proc.0/thread.2")); + if (th.tid != 2) + die("wrong tid"); + + ERR(thread_init_begin(&th, "loom.0/proc.0/thread.kk")); + ERR(thread_init_begin(&th, "loom.0/proc.0/thread.")); + ERR(thread_init_begin(&th, "loom.0/proc.0/thread")); + ERR(thread_init_begin(&th, "thread.prv")); + + err("ok"); +} int main(void) { + test_old_trace(); + return 0; }