aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-03-23 11:32:34 -0700
committerChristian Cunningham <cc@localhost>2022-03-23 11:32:34 -0700
commit48bc61ac76b82b1514ed4bf1d3dc7ba6cb2c991c (patch)
tree6a33cbb49e2677bf0aa05658121c33dc6f9fdcf5
parentf6ff28ad8eb5e88a1985706bfc94657704e9c3f4 (diff)
Qualitative Testing
-rw-r--r--src/sys/schedule.c2
-rw-r--r--src/tests/test.c29
2 files changed, 30 insertions, 1 deletions
diff --git a/src/sys/schedule.c b/src/sys/schedule.c
index f54811d..9b6d46e 100644
--- a/src/sys/schedule.c
+++ b/src/sys/schedule.c
@@ -344,7 +344,7 @@ void c_cleanup(void)
struct Thread* rt = scheduler.rthread;
struct Entry* e = pop_thread_from_queue(THREAD_READY, rt->priority);
// Add to free threads
- prepend_to_queue(e, &scheduler.free_threads);
+ push_to_queue(e, &scheduler.free_threads);
}
void yield(void)
diff --git a/src/tests/test.c b/src/tests/test.c
index 0dad659..d954ade 100644
--- a/src/tests/test.c
+++ b/src/tests/test.c
@@ -431,6 +431,32 @@ void semaphore_test1(void)
sys1(SYS_SEMAPHORE_P, &test_semaphore);
// Semaphore decremented
draw_cletter(x++, y+1, 'P', 0xFF0000);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ draw_cletter(x++, y+1, 'V', 0xFF0000);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
+ // Try to decrement semaphore
+ draw_cletter(x++, y+1, 'T', 0xFF0000);
+ sys1(SYS_SEMAPHORE_P, &test_semaphore);
+ // Semaphore decremented
+ draw_cletter(x++, y+1, 'P', 0xFF0000);
draw_cletter(x++, y+1, 'F', 0xFF0000);
}
@@ -440,6 +466,9 @@ void semaphore_test2(void)
// Increment semaphore
draw_cletter(x++, y+2, 'V', 0xFF00);
sys1(SYS_SEMAPHORE_V, &test_semaphore);
+ // Increment semaphore
+ draw_cletter(x++, y+2, 'V', 0xFF00);
+ sys1(SYS_SEMAPHORE_V, &test_semaphore);
draw_cletter(x++, y+2, 'F', 0xFF00);
}