[rtems-schedsim commit] schedsim_priority: Add priority inheritance scenario.

Jennifer Averett jennifer at rtems.org
Tue Jun 3 12:24:15 UTC 2014


Module:    rtems-schedsim
Branch:    master
Commit:    4be3859c6e0bef1b2c8cf25ccdaf1f43e5486153
Changeset: http://git.rtems.org/rtems-schedsim/commit/?id=4be3859c6e0bef1b2c8cf25ccdaf1f43e5486153

Author:    Jennifer Averett <jennifer.averett at oarcorp.com>
Date:      Tue Jun  3 07:23:55 2014 -0500

schedsim_priority: Add priority inheritance scenario.

---

 .../scenarios/inherit_priority.expected            |   59 ++++++++++++++++++++
 .../scenarios/inherit_priority.scen                |   25 ++++++++
 2 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/schedsim/shell/schedsim_priority/scenarios/inherit_priority.expected b/schedsim/shell/schedsim_priority/scenarios/inherit_priority.expected
new file mode 100644
index 0000000..2233d4f
--- /dev/null
+++ b/schedsim/shell/schedsim_priority/scenarios/inherit_priority.expected
@@ -0,0 +1,59 @@
+Script File               : inherit_priority.scen
+verbose                   : 1
+==> 1: #
+==> 2: #  Verify priority inheritance with a priority ceiling mutex
+==> 3: #
+==> 4: echo "*** TEST INHERIT PRIORITY ***"
+*** TEST INHERIT PRIORITY ***
+==> 5: rtems_init
+  CPU 0: Thread Heir: 0x09010001 priority=255
+  CPU 0: Thread Executing: 0x09010001 priority=255
+==> 6: echo "=== Create 0x0a010001 at priority 8 ==="
+=== Create 0x0a010001 at priority 8 ===
+==> 7: task_create smp1 8
+Creating task with:  Preemption: yes Timeslicing: no
+Task (smp1) created: id=0x0a010001, priority=8
+Task (smp1) starting: id=0x0a010001, priority=8
+  CPU 0: Thread Heir: 0x0a010001 priority=8
+  CPU 0: Thread Executing: 0x0a010001 priority=8
+==> 8: cpus smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  8 / 0x0a010001 @  8          false
+=== End of Ready Set of Threads
+==> 9: 
+==> 10: # sem1 is binary semaphore (e.g. mutex) with priority ceiling of 5 
+==> 11: echo "Create mutex with priority ceiling of 5
+Create mutex with priority ceiling of 5
+==> 12: semaphore_create -b -p -C 5 -V 1 sem1
+Semaphore (sem1) created: id=0x1a010001
+==> 13: cpus smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  8 / 0x0a010001 @  8          false
+=== End of Ready Set of Threads
+==> 14: 
+==> 15: semaphore_obtain sem1 0
+Obtain semaphore (0x1a010001) with timeout 0
+==> 16: 
+==> 17: # This should show smp4 has inherited a priority of 5
+==> 18: echo "smp1 should inherit a priority of 5
+smp1 should inherit a priority of 5
+==> 19: cpus smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  5 / 0x0a010001 @  5          false
+=== End of Ready Set of Threads
+==> 20: 
+==> 21: semaphore_release sem1
+Releasing semaphore (0x1a010001)
+==> 22: # This should show smp1 has its original priority of 8
+==> 23: echo "smp1 should return to a priority of 8
+smp1 should return to a priority of 8
+==> 24: cpus smp1
+=== CPU Status
+          EXECUTING      /   HEIR             / SWITCH NEEDED
+  CPU 0: 0x0a010001 @  8 / 0x0a010001 @  8          false
+=== End of Ready Set of Threads
+==> 25: echo "*** END OF TEST INHERIT PRIORITY ***"
+*** END OF TEST INHERIT PRIORITY ***
diff --git a/schedsim/shell/schedsim_priority/scenarios/inherit_priority.scen b/schedsim/shell/schedsim_priority/scenarios/inherit_priority.scen
new file mode 100644
index 0000000..ea1e72b
--- /dev/null
+++ b/schedsim/shell/schedsim_priority/scenarios/inherit_priority.scen
@@ -0,0 +1,25 @@
+#
+#  Verify priority inheritance with a priority ceiling mutex
+#
+echo "*** TEST INHERIT PRIORITY ***"
+rtems_init
+echo "=== Create 0x0a010001 at priority 8 ==="
+task_create smp1 8
+cpus smp1
+
+# sem1 is binary semaphore (e.g. mutex) with priority ceiling of 5 
+echo "Create mutex with priority ceiling of 5
+semaphore_create -b -p -C 5 -V 1 sem1
+cpus smp1
+
+semaphore_obtain sem1 0
+
+# This should show smp4 has inherited a priority of 5
+echo "smp1 should inherit a priority of 5
+cpus smp1
+
+semaphore_release sem1
+# This should show smp1 has its original priority of 8
+echo "smp1 should return to a priority of 8
+cpus smp1
+echo "*** END OF TEST INHERIT PRIORITY ***"




More information about the vc mailing list