Use runtime options instead of conditional compilation for MLFQS,
[pintos-anon] / grading / threads / priority-donate-multiple.c
index 971caf213b2e6ca3a362532e8207cee39f965a50..db527dea1219507ac12dc9b82cd5aab5787917d6 100644 (file)
@@ -6,10 +6,6 @@
    <gmh@leland.stanford.edu>, Yu Ping Hu <yph@cs.stanford.edu>.
    Modified by arens. */
 
-#ifdef MLFQS
-#error This test not applicable with MLFQS enabled.
-#endif
-
 #include "threads/test.h"
 #include <stdio.h>
 #include "threads/synch.h"
@@ -20,6 +16,9 @@ static void test_donate_multiple (void);
 void
 test (void) 
 {
+  /* This test does not work with the MLFQS. */
+  ASSERT (!enable_mlfqs);
+
   /* Make sure our priority is the default. */
   ASSERT (thread_get_priority () == PRI_DEFAULT);
 
@@ -45,21 +44,21 @@ test_donate_multiple (void)
   lock_acquire (&b);
 
   thread_create ("a", PRI_DEFAULT + 1, a_thread_func, &a);
-  printf (" 1. Main thread should have priority %d.  Actual priority: %d.\n",
+  printf ("Main thread should have priority %d.  Actual priority: %d.\n",
           PRI_DEFAULT + 1, thread_get_priority ());
 
   thread_create ("b", PRI_DEFAULT + 2, b_thread_func, &b);
-  printf (" 2. Main thread should have priority %d.  Actual priority: %d.\n",
+  printf ("Main thread should have priority %d.  Actual priority: %d.\n",
           PRI_DEFAULT + 2, thread_get_priority ());
 
   lock_release (&b);
-  printf (" 5. Thread b should have just finished.\n");
-  printf (" 6. Main thread should have priority %d.  Actual priority: %d.\n",
+  printf ("Thread b should have just finished.\n");
+  printf ("Main thread should have priority %d.  Actual priority: %d.\n",
           PRI_DEFAULT + 1, thread_get_priority ());
 
   lock_release (&a);
-  printf (" 9. Thread a should have just finished.\n");
-  printf ("10. Main thread should have priority %d.  Actual priority: %d.\n",
+  printf ("Thread a should have just finished.\n");
+  printf ("Main thread should have priority %d.  Actual priority: %d.\n",
           PRI_DEFAULT, thread_get_priority ());
   printf ("Multiple priority priority donation test finished.\n");
 }
@@ -70,9 +69,9 @@ a_thread_func (void *lock_)
   struct lock *lock = lock_;
 
   lock_acquire (lock);
-  printf (" 7. Thread a acquired lock a.\n");
+  printf ("Thread a acquired lock a.\n");
   lock_release (lock);
-  printf (" 8. Thread b finished.\n");
+  printf ("Thread a finished.\n");
 }
 
 static void
@@ -81,7 +80,7 @@ b_thread_func (void *lock_)
   struct lock *lock = lock_;
 
   lock_acquire (lock);
-  printf (" 3. Thread b acquired lock b.\n");
+  printf ("Thread b acquired lock b.\n");
   lock_release (lock);
-  printf (" 4. Thread b finished.\n");
+  printf ("Thread b finished.\n");
 }