Fix unitintialized msgtype in threadqueue test

This commit is contained in:
Nils O. Selåsdal
2012-11-18 13:45:02 +01:00
parent 3d982a580a
commit 9547730c9e
+7
View File
@@ -20,6 +20,7 @@ START_TEST (test_thread_queue_length)
for(i = 0; i < 51; i++) { for(i = 0; i < 51; i++) {
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->msg.msgtype = 1;
fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0);
} }
@@ -36,6 +37,7 @@ START_TEST (test_thread_queue_one_thread)
for(i = 0; i < 51; i++) { for(i = 0; i < 51; i++) {
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->msg.msgtype = 0;
msg->a = i; msg->a = i;
fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0);
} }
@@ -72,6 +74,7 @@ START_TEST (test_thread_queue_walk)
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->a = i; msg->a = i;
msg->msg.msgtype = 0;
fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0);
} }
@@ -114,6 +117,7 @@ START_TEST (test_thread_queue_reader_writer)
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->a = i; msg->a = i;
msg->msg.msgtype = 0;
fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0);
} }
@@ -137,6 +141,7 @@ START_TEST (test_thread_queue_reader_writer_len_1)
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->a = i; msg->a = i;
msg->msg.msgtype = 0;
fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(&queue, &msg->msg) != 0);
} }
@@ -161,6 +166,7 @@ void *test_thread_queue_multiple_writers_func(void *arg)
struct thr_msg *msg = malloc(sizeof *msg); struct thr_msg *msg = malloc(sizeof *msg);
fail_if(msg == NULL); fail_if(msg == NULL);
msg->a = i; msg->a = i;
msg->msg.msgtype = 0;
fail_if(uc_thread_queue_add(queue, &msg->msg) != 0); fail_if(uc_thread_queue_add(queue, &msg->msg) != 0);
} }
@@ -237,6 +243,7 @@ START_TEST (test_thread_queue_timeout2)
fail_if(uc_thread_queue_init(&queue, 10) != 0); fail_if(uc_thread_queue_init(&queue, 10) != 0);
fail_if(pthread_create(&tid1, NULL, thread_test_thread_queue_timeout2, &queue) != 0); fail_if(pthread_create(&tid1, NULL, thread_test_thread_queue_timeout2, &queue) != 0);
my_msg.b = 12345; my_msg.b = 12345;
my_msg.msg.msgtype = 0;
fail_if(uc_thread_queue_add(&queue, &my_msg.msg) != 0); fail_if(uc_thread_queue_add(&queue, &my_msg.msg) != 0);