X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=cconv.c;h=3a1c6a201704d6a26ef0cccea43919f267905873;hb=c148daed3da130062a7575d5667ca0e044927153;hp=f16e0d6a90b80dc7c5cabde2f1baeab03fee68e4;hpb=2dc1cbb52f73303d479a72e99930a2838c4b0fa4;p=fio.git diff --git a/cconv.c b/cconv.c index f16e0d6a..3a1c6a20 100644 --- a/cconv.c +++ b/cconv.c @@ -1,3 +1,5 @@ +#include + #include "thread_options.h" static void string_to_cpu(char **dst, const uint8_t *src) @@ -372,3 +374,23 @@ void convert_thread_options_to_net(struct thread_options_pack *top, } +/* + * 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)); +}