Add basic cconv test
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/cconv.c b/cconv.c
index f16e0d6..3a1c6a2 100644
--- a/cconv.c
+++ b/cconv.c
@@ -1,3 +1,5 @@
+#include <string.h>
+
#include "thread_options.h"
static void string_to_cpu(char **dst, const uint8_t *src)
@@ -372,3 +374,23 @@
}
+/*
+ * Basic conversion test. We'd really need to fill in more of the options
+ * to have a thorough test. Even better, we should auto-generate the
+ * converter functions...
+ */
+int fio_test_cconv(struct thread_options *__o)
+{
+ struct thread_options o;
+ struct thread_options_pack top1, top2;
+
+ memset(&top1, 0, sizeof(top1));
+ memset(&top2, 0, sizeof(top2));
+
+ convert_thread_options_to_net(&top1, __o);
+ memset(&o, 0, sizeof(o));
+ convert_thread_options_to_cpu(&o, &top1);
+ convert_thread_options_to_net(&top2, &o);
+
+ return memcmp(&top1, &top2, sizeof(top1));
+}