aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/reports/coverage.txt4
-rw-r--r--test/testqueues.c34
-rw-r--r--test/testsem.c4
3 files changed, 33 insertions, 9 deletions
diff --git a/docs/reports/coverage.txt b/docs/reports/coverage.txt
index e77771ca2..dc63a753e 100644
--- a/docs/reports/coverage.txt
+++ b/docs/reports/coverage.txt
@@ -33,7 +33,7 @@ Lines executed:100.00% of 18
../../os/kernel/src/chregistry.c:creating `chregistry.c.gcov'
File `../../os/kernel/src/chsem.c'
-Lines executed:91.01% of 89
+Lines executed:100.00% of 89
../../os/kernel/src/chsem.c:creating `chsem.c.gcov'
File `../../os/kernel/src/chmtx.c'
@@ -57,7 +57,7 @@ Lines executed:100.00% of 65
../../os/kernel/src/chmboxes.c:creating `chmboxes.c.gcov'
File `../../os/kernel/src/chqueues.c'
-Lines executed:90.16% of 122
+Lines executed:100.00% of 122
../../os/kernel/src/chqueues.c:creating `chqueues.c.gcov'
File `../../os/kernel/src/chmemcore.c'
diff --git a/test/testqueues.c b/test/testqueues.c
index 9d76d7ac7..dd4d00fba 100644
--- a/test/testqueues.c
+++ b/test/testqueues.c
@@ -83,6 +83,13 @@ static void queues1_setup(void) {
chIQInit(&iq, wa[0], TEST_QUEUES_SIZE, notify);
}
+static msg_t thread1(void *p) {
+
+ (void)p;
+ chIQGetTimeout(&iq, MS2ST(200));
+ return 0;
+}
+
static void queues1_execute(void) {
unsigned i;
size_t n;
@@ -125,10 +132,13 @@ static void queues1_execute(void) {
/* Testing reset */
chIQPutI(&iq, 0);
chIQResetI(&iq);
- test_assert(11, chIQIsEmptyI(&iq), "still full");
+ test_assert(11, chIQGetFullI(&iq) == 0, "still full");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread1, NULL);
+ test_assert(12, chIQGetFullI(&iq) == 0, "not empty");
+ test_wait_threads();
/* Timeout */
- test_assert(12, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return");
+ test_assert(13, chIQGetTimeout(&iq, 10) == Q_TIMEOUT, "wrong timeout return");
}
ROMCONST struct testcase testqueues1 = {
@@ -152,6 +162,13 @@ static void queues2_setup(void) {
chOQInit(&oq, wa[0], TEST_QUEUES_SIZE, notify);
}
+static msg_t thread2(void *p) {
+
+ (void)p;
+ chOQPutTimeout(&oq, 0, MS2ST(200));
+ return 0;
+}
+
static void queues2_execute(void) {
unsigned i;
size_t n;
@@ -175,20 +192,23 @@ static void queues2_execute(void) {
n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE * 2, TIME_IMMEDIATE);
test_assert(6, n == TEST_QUEUES_SIZE, "wrong returned size");
test_assert(7, chOQIsFullI(&oq), "not full");
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+1, thread2, NULL);
+ test_assert(8, chOQGetFullI(&oq) == TEST_QUEUES_SIZE, "not empty");
+ test_wait_threads();
/* Testing reset */
chOQResetI(&oq);
- test_assert(8, chOQIsEmptyI(&oq), "still full");
+ test_assert(9, chOQGetFullI(&oq) == 0, "still full");
/* Partial writes */
n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE);
- test_assert(9, n == TEST_QUEUES_SIZE / 2, "wrong returned size");
- n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE);
test_assert(10, n == TEST_QUEUES_SIZE / 2, "wrong returned size");
- test_assert(11, chOQIsFullI(&oq), "not full");
+ n = chOQWriteTimeout(&oq, wa[1], TEST_QUEUES_SIZE / 2, TIME_IMMEDIATE);
+ test_assert(11, n == TEST_QUEUES_SIZE / 2, "wrong returned size");
+ test_assert(12, chOQIsFullI(&oq), "not full");
/* Timeout */
- test_assert(12, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return");
+ test_assert(13, chOQPutTimeout(&oq, 0, 10) == Q_TIMEOUT, "wrong timeout return");
}
ROMCONST struct testcase testqueues2 = {
diff --git a/test/testsem.c b/test/testsem.c
index 46caad56a..25d87f3f1 100644
--- a/test/testsem.c
+++ b/test/testsem.c
@@ -102,6 +102,10 @@ static void sem1_execute(void) {
#else
test_assert_sequence(1, "ABCDE");
#endif
+ threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriority()+5, thread1, "A");
+ chSemSetCounterI(&sem1, 2);
+ test_wait_threads();
+ test_assert(2, chSemGetCounterI(&sem1) == 2, "invalid counter");
}
ROMCONST struct testcase testsem1 = {