aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2006-06-27 05:54:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:47 -0400
commit61a87122869b6340a63b6f9f84097d3688604b90 (patch)
tree11d60d29763a42abd66453a920cc06bebc852427 /scripts
parente7eebaf6a81b956c989f184ee4b27277c88f8afe (diff)
[PATCH] pi-futex: rt mutex tester
RT-mutex tester: scriptable tester for rt mutexes, which allows userspace scripting of mutex unit-tests (and dynamic tests as well), using the actual rt-mutex implementation of the kernel. [akpm@osdl.org: fixlet] Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/rt-tester/check-all.sh21
-rw-r--r--scripts/rt-tester/rt-tester.py222
-rw-r--r--scripts/rt-tester/t2-l1-2rt-sameprio.tst101
-rw-r--r--scripts/rt-tester/t2-l1-pi.tst84
-rw-r--r--scripts/rt-tester/t2-l1-signal.tst79
-rw-r--r--scripts/rt-tester/t2-l2-2rt-deadlock.tst91
-rw-r--r--scripts/rt-tester/t3-l1-pi-1rt.tst95
-rw-r--r--scripts/rt-tester/t3-l1-pi-2rt.tst96
-rw-r--r--scripts/rt-tester/t3-l1-pi-3rt.tst95
-rw-r--r--scripts/rt-tester/t3-l1-pi-signal.tst101
-rw-r--r--scripts/rt-tester/t3-l1-pi-steal.tst99
-rw-r--r--scripts/rt-tester/t3-l2-pi.tst95
-rw-r--r--scripts/rt-tester/t4-l2-pi-deboost.tst127
-rw-r--r--scripts/rt-tester/t5-l4-pi-boost-deboost.tst148
14 files changed, 1454 insertions, 0 deletions
diff --git a/scripts/rt-tester/check-all.sh b/scripts/rt-tester/check-all.sh
new file mode 100644
index 000000000000..ac45c3e65a35
--- /dev/null
+++ b/scripts/rt-tester/check-all.sh
@@ -0,0 +1,21 @@
1
2
3function testit ()
4{
5 printf "%-30s: " $1
6 ./rt-tester.py $1 | grep Pass
7}
8
9testit t2-l1-2rt-sameprio.tst
10testit t2-l1-pi.tst
11testit t2-l1-signal.tst
12#testit t2-l2-2rt-deadlock.tst
13testit t3-l1-pi-1rt.tst
14testit t3-l1-pi-2rt.tst
15testit t3-l1-pi-3rt.tst
16testit t3-l1-pi-signal.tst
17testit t3-l1-pi-steal.tst
18testit t3-l2-pi.tst
19testit t4-l2-pi-deboost.tst
20testit t5-l4-pi-boost-deboost.tst
21
diff --git a/scripts/rt-tester/rt-tester.py b/scripts/rt-tester/rt-tester.py
new file mode 100644
index 000000000000..4c79660793cf
--- /dev/null
+++ b/scripts/rt-tester/rt-tester.py
@@ -0,0 +1,222 @@
1#!/usr/bin/env python
2#
3# rt-mutex tester
4#
5# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11import os
12import sys
13import getopt
14import shutil
15import string
16
17# Globals
18quiet = 0
19test = 0
20comments = 0
21
22sysfsprefix = "/sys/devices/system/rttest/rttest"
23statusfile = "/status"
24commandfile = "/command"
25
26# Command opcodes
27cmd_opcodes = {
28 "schedother" : "1",
29 "schedfifo" : "2",
30 "lock" : "3",
31 "locknowait" : "4",
32 "lockint" : "5",
33 "lockintnowait" : "6",
34 "lockcont" : "7",
35 "unlock" : "8",
36 "lockbkl" : "9",
37 "unlockbkl" : "10",
38 "signal" : "11",
39 "resetevent" : "98",
40 "reset" : "99",
41 }
42
43test_opcodes = {
44 "prioeq" : ["P" , "eq" , None],
45 "priolt" : ["P" , "lt" , None],
46 "priogt" : ["P" , "gt" , None],
47 "nprioeq" : ["N" , "eq" , None],
48 "npriolt" : ["N" , "lt" , None],
49 "npriogt" : ["N" , "gt" , None],
50 "unlocked" : ["M" , "eq" , 0],
51 "trylock" : ["M" , "eq" , 1],
52 "blocked" : ["M" , "eq" , 2],
53 "blockedwake" : ["M" , "eq" , 3],
54 "locked" : ["M" , "eq" , 4],
55 "opcodeeq" : ["O" , "eq" , None],
56 "opcodelt" : ["O" , "lt" , None],
57 "opcodegt" : ["O" , "gt" , None],
58 "eventeq" : ["E" , "eq" , None],
59 "eventlt" : ["E" , "lt" , None],
60 "eventgt" : ["E" , "gt" , None],
61 }
62
63# Print usage information
64def usage():
65 print "rt-tester.py <-c -h -q -t> <testfile>"
66 print " -c display comments after first command"
67 print " -h help"
68 print " -q quiet mode"
69 print " -t test mode (syntax check)"
70 print " testfile: read test specification from testfile"
71 print " otherwise from stdin"
72 return
73
74# Print progress when not in quiet mode
75def progress(str):
76 if not quiet:
77 print str
78
79# Analyse a status value
80def analyse(val, top, arg):
81
82 intval = int(val)
83
84 if top[0] == "M":
85 intval = intval / (10 ** int(arg))
86 intval = intval % 10
87 argval = top[2]
88 elif top[0] == "O":
89 argval = int(cmd_opcodes.get(arg, arg))
90 else:
91 argval = int(arg)
92
93 # progress("%d %s %d" %(intval, top[1], argval))
94
95 if top[1] == "eq" and intval == argval:
96 return 1
97 if top[1] == "lt" and intval < argval:
98 return 1
99 if top[1] == "gt" and intval > argval:
100 return 1
101 return 0
102
103# Parse the commandline
104try:
105 (options, arguments) = getopt.getopt(sys.argv[1:],'chqt')
106except getopt.GetoptError, ex:
107 usage()
108 sys.exit(1)
109
110# Parse commandline options
111for option, value in options:
112 if option == "-c":
113 comments = 1
114 elif option == "-q":
115 quiet = 1
116 elif option == "-t":
117 test = 1
118 elif option == '-h':
119 usage()
120 sys.exit(0)
121
122# Select the input source
123if arguments:
124 try:
125 fd = open(arguments[0])
126 except Exception,ex:
127 sys.stderr.write("File not found %s\n" %(arguments[0]))
128 sys.exit(1)
129else:
130 fd = sys.stdin
131
132linenr = 0
133
134# Read the test patterns
135while 1:
136
137 linenr = linenr + 1
138 line = fd.readline()
139 if not len(line):
140 break
141
142 line = line.strip()
143 parts = line.split(":")
144
145 if not parts or len(parts) < 1:
146 continue
147
148 if len(parts[0]) == 0:
149 continue
150
151 if parts[0].startswith("#"):
152 if comments > 1:
153 progress(line)
154 continue
155
156 if comments == 1:
157 comments = 2
158
159 progress(line)
160
161 cmd = parts[0].strip().lower()
162 opc = parts[1].strip().lower()
163 tid = parts[2].strip()
164 dat = parts[3].strip()
165
166 try:
167 # Test or wait for a status value
168 if cmd == "t" or cmd == "w":
169 testop = test_opcodes[opc]
170
171 fname = "%s%s%s" %(sysfsprefix, tid, statusfile)
172 if test:
173 print fname
174 continue
175
176 while 1:
177 query = 1
178 fsta = open(fname, 'r')
179 status = fsta.readline().strip()
180 fsta.close()
181 stat = status.split(",")
182 for s in stat:
183 s = s.strip()
184 if s.startswith(testop[0]):
185 # Seperate status value
186 val = s[2:].strip()
187 query = analyse(val, testop, dat)
188 break
189 if query or cmd == "t":
190 break
191
192 progress(" " + status)
193
194 if not query:
195 sys.stderr.write("Test failed in line %d\n" %(linenr))
196 sys.exit(1)
197
198 # Issue a command to the tester
199 elif cmd == "c":
200 cmdnr = cmd_opcodes[opc]
201 # Build command string and sys filename
202 cmdstr = "%s:%s" %(cmdnr, dat)
203 fname = "%s%s%s" %(sysfsprefix, tid, commandfile)
204 if test:
205 print fname
206 continue
207 fcmd = open(fname, 'w')
208 fcmd.write(cmdstr)
209 fcmd.close()
210
211 except Exception,ex:
212 sys.stderr.write(str(ex))
213 sys.stderr.write("\nSyntax error in line %d\n" %(linenr))
214 if not test:
215 fd.close()
216 sys.exit(1)
217
218# Normal exit pass
219print "Pass"
220sys.exit(0)
221
222
diff --git a/scripts/rt-tester/t2-l1-2rt-sameprio.tst b/scripts/rt-tester/t2-l1-2rt-sameprio.tst
new file mode 100644
index 000000000000..a2b6f2aae755
--- /dev/null
+++ b/scripts/rt-tester/t2-l1-2rt-sameprio.tst
@@ -0,0 +1,101 @@
1#
2# RT-Mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal 0
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 2 threads 1 lock
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedfifo: 0: 80
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 80
62W: opcodeeq: 1: 0
63
64# T0 lock L0
65C: locknowait: 0: 0
66C: locknowait: 1: 0
67W: locked: 0: 0
68W: blocked: 1: 0
69T: prioeq: 0: 80
70
71# T0 unlock L0
72C: unlock: 0: 0
73W: locked: 1: 0
74
75# Verify T0
76W: unlocked: 0: 0
77T: prioeq: 0: 80
78
79# Unlock
80C: unlock: 1: 0
81W: unlocked: 1: 0
82
83# T1,T0 lock L0
84C: locknowait: 1: 0
85C: locknowait: 0: 0
86W: locked: 1: 0
87W: blocked: 0: 0
88T: prioeq: 1: 80
89
90# T1 unlock L0
91C: unlock: 1: 0
92W: locked: 0: 0
93
94# Verify T1
95W: unlocked: 1: 0
96T: prioeq: 1: 80
97
98# Unlock and exit
99C: unlock: 0: 0
100W: unlocked: 0: 0
101
diff --git a/scripts/rt-tester/t2-l1-pi.tst b/scripts/rt-tester/t2-l1-pi.tst
new file mode 100644
index 000000000000..aa4c8940acd6
--- /dev/null
+++ b/scripts/rt-tester/t2-l1-pi.tst
@@ -0,0 +1,84 @@
1#
2# RT-Mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal 0
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 2 threads 1 lock with priority inversion
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 80
62W: opcodeeq: 1: 0
63
64# T0 lock L0
65C: locknowait: 0: 0
66W: locked: 0: 0
67
68# T1 lock L0
69C: locknowait: 1: 0
70W: blocked: 1: 0
71T: prioeq: 0: 80
72
73# T0 unlock L0
74C: unlock: 0: 0
75W: locked: 1: 0
76
77# Verify T1
78W: unlocked: 0: 0
79T: priolt: 0: 1
80
81# Unlock and exit
82C: unlock: 1: 0
83W: unlocked: 1: 0
84
diff --git a/scripts/rt-tester/t2-l1-signal.tst b/scripts/rt-tester/t2-l1-signal.tst
new file mode 100644
index 000000000000..c47ba06af209
--- /dev/null
+++ b/scripts/rt-tester/t2-l1-signal.tst
@@ -0,0 +1,79 @@
1#
2# RT-Mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal 0
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 2 threads 1 lock with priority inversion
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedother: 1: 0
62W: opcodeeq: 1: 0
63
64# T0 lock L0
65C: locknowait: 0: 0
66W: locked: 0: 0
67
68# T1 lock L0
69C: lockintnowait: 1: 0
70W: blocked: 1: 0
71
72# Interrupt T1
73C: signal: 1: 0
74W: unlocked: 1: 0
75T: opcodeeq: 1: -4
76
77# Unlock and exit
78C: unlock: 0: 0
79W: unlocked: 0: 0
diff --git a/scripts/rt-tester/t2-l2-2rt-deadlock.tst b/scripts/rt-tester/t2-l2-2rt-deadlock.tst
new file mode 100644
index 000000000000..0cee476b206e
--- /dev/null
+++ b/scripts/rt-tester/t2-l2-2rt-deadlock.tst
@@ -0,0 +1,91 @@
1#
2# RT-Mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal 0
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 2 threads 2 lock
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedfifo: 0: 80
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 80
62W: opcodeeq: 1: 0
63
64# T0 lock L0
65C: locknowait: 0: 0
66W: locked: 0: 0
67
68# T1 lock L1
69C: locknowait: 1: 1
70W: locked: 1: 1
71
72# T0 lock L1
73C: lockintnowait: 0: 1
74W: blocked: 0: 1
75
76# T1 lock L0
77C: lockintnowait: 1: 0
78W: blocked: 1: 0
79
80# Make deadlock go away
81C: signal: 1: 0
82W: unlocked: 1: 0
83C: signal: 0: 0
84W: unlocked: 0: 1
85
86# Unlock and exit
87C: unlock: 0: 0
88W: unlocked: 0: 0
89C: unlock: 1: 1
90W: unlocked: 1: 1
91
diff --git a/scripts/rt-tester/t3-l1-pi-1rt.tst b/scripts/rt-tester/t3-l1-pi-1rt.tst
new file mode 100644
index 000000000000..a5eaf7ed5d54
--- /dev/null
+++ b/scripts/rt-tester/t3-l1-pi-1rt.tst
@@ -0,0 +1,95 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 3 threads 1 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedother: 1: 0
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65
66# T0 lock L0
67C: locknowait: 0: 0
68W: locked: 0: 0
69
70# T1 lock L0
71C: locknowait: 1: 0
72W: blocked: 1: 0
73T: priolt: 0: 1
74
75# T2 lock L0
76C: locknowait: 2: 0
77W: blocked: 2: 0
78T: prioeq: 0: 82
79
80# T0 unlock L0
81C: unlock: 0: 0
82
83# Wait until T2 got the lock
84W: locked: 2: 0
85W: unlocked: 0: 0
86T: priolt: 0: 1
87
88# T2 unlock L0
89C: unlock: 2: 0
90
91W: unlocked: 2: 0
92W: locked: 1: 0
93
94C: unlock: 1: 0
95W: unlocked: 1: 0
diff --git a/scripts/rt-tester/t3-l1-pi-2rt.tst b/scripts/rt-tester/t3-l1-pi-2rt.tst
new file mode 100644
index 000000000000..c622391a8afe
--- /dev/null
+++ b/scripts/rt-tester/t3-l1-pi-2rt.tst
@@ -0,0 +1,96 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 3 threads 1 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 81
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65
66# T0 lock L0
67C: locknowait: 0: 0
68W: locked: 0: 0
69
70# T1 lock L0
71C: locknowait: 1: 0
72W: blocked: 1: 0
73T: prioeq: 0: 81
74
75# T2 lock L0
76C: locknowait: 2: 0
77W: blocked: 2: 0
78T: prioeq: 0: 82
79T: prioeq: 1: 81
80
81# T0 unlock L0
82C: unlock: 0: 0
83
84# Wait until T2 got the lock
85W: locked: 2: 0
86W: unlocked: 0: 0
87T: priolt: 0: 1
88
89# T2 unlock L0
90C: unlock: 2: 0
91
92W: unlocked: 2: 0
93W: locked: 1: 0
94
95C: unlock: 1: 0
96W: unlocked: 1: 0
diff --git a/scripts/rt-tester/t3-l1-pi-3rt.tst b/scripts/rt-tester/t3-l1-pi-3rt.tst
new file mode 100644
index 000000000000..b5057fb13e09
--- /dev/null
+++ b/scripts/rt-tester/t3-l1-pi-3rt.tst
@@ -0,0 +1,95 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 3 threads 1 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedfifo: 0: 80
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 81
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65
66# T0 lock L0
67C: locknowait: 0: 0
68W: locked: 0: 0
69
70# T1 lock L0
71C: locknowait: 1: 0
72W: blocked: 1: 0
73T: prioeq: 0: 81
74
75# T2 lock L0
76C: locknowait: 2: 0
77W: blocked: 2: 0
78T: prioeq: 0: 82
79
80# T0 unlock L0
81C: unlock: 0: 0
82
83# Wait until T2 got the lock
84W: locked: 2: 0
85W: unlocked: 0: 0
86T: prioeq: 0: 80
87
88# T2 unlock L0
89C: unlock: 2: 0
90
91W: locked: 1: 0
92W: unlocked: 2: 0
93
94C: unlock: 1: 0
95W: unlocked: 1: 0
diff --git a/scripts/rt-tester/t3-l1-pi-signal.tst b/scripts/rt-tester/t3-l1-pi-signal.tst
new file mode 100644
index 000000000000..3e427daa33ff
--- /dev/null
+++ b/scripts/rt-tester/t3-l1-pi-signal.tst
@@ -0,0 +1,101 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52# Reset event counter
53C: resetevent: 0: 0
54W: opcodeeq: 0: 0
55
56# Set priorities
57C: schedother: 0: 0
58W: opcodeeq: 0: 0
59C: schedfifo: 1: 80
60W: opcodeeq: 1: 0
61C: schedfifo: 2: 81
62W: opcodeeq: 2: 0
63
64# T0 lock L0
65C: lock: 0: 0
66W: locked: 0: 0
67
68# T1 lock L0, no wait in the wakeup path
69C: locknowait: 1: 0
70W: blocked: 1: 0
71T: prioeq: 0: 80
72T: prioeq: 1: 80
73
74# T2 lock L0 interruptible, no wait in the wakeup path
75C: lockintnowait: 2: 0
76W: blocked: 2: 0
77T: prioeq: 0: 81
78T: prioeq: 1: 80
79
80# Interrupt T2
81C: signal: 2: 2
82W: unlocked: 2: 0
83T: prioeq: 1: 80
84T: prioeq: 0: 80
85
86T: locked: 0: 0
87T: blocked: 1: 0
88
89# T0 unlock L0
90C: unlock: 0: 0
91
92# Wait until T1 has locked L0 and exit
93W: locked: 1: 0
94W: unlocked: 0: 0
95T: priolt: 0: 1
96
97C: unlock: 1: 0
98W: unlocked: 1: 0
99
100
101
diff --git a/scripts/rt-tester/t3-l1-pi-steal.tst b/scripts/rt-tester/t3-l1-pi-steal.tst
new file mode 100644
index 000000000000..72c24a9e4be4
--- /dev/null
+++ b/scripts/rt-tester/t3-l1-pi-steal.tst
@@ -0,0 +1,99 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 3 threads 1 lock PI steal pending ownership
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 80
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 81
64W: opcodeeq: 2: 0
65
66# T0 lock L0
67C: lock: 0: 0
68W: locked: 0: 0
69
70# T1 lock L0
71C: lock: 1: 0
72W: blocked: 1: 0
73T: prioeq: 0: 80
74
75# T0 unlock L0
76C: unlock: 0: 0
77
78# Wait until T1 is in the wakeup loop
79W: blockedwake: 1: 0
80T: priolt: 0: 1
81
82# T2 lock L0
83C: lock: 2: 0
84# T1 leave wakeup loop
85C: lockcont: 1: 0
86
87# T2 must have the lock and T1 must be blocked
88W: locked: 2: 0
89W: blocked: 1: 0
90
91# T2 unlock L0
92C: unlock: 2: 0
93
94# Wait until T1 is in the wakeup loop and let it run
95W: blockedwake: 1: 0
96C: lockcont: 1: 0
97W: locked: 1: 0
98C: unlock: 1: 0
99W: unlocked: 1: 0
diff --git a/scripts/rt-tester/t3-l2-pi.tst b/scripts/rt-tester/t3-l2-pi.tst
new file mode 100644
index 000000000000..2ba0dced48fa
--- /dev/null
+++ b/scripts/rt-tester/t3-l2-pi.tst
@@ -0,0 +1,95 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 3 threads 2 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedother: 1: 0
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65
66# T0 lock L0
67C: locknowait: 0: 0
68W: locked: 0: 0
69
70# T1 lock L0
71C: locknowait: 1: 0
72W: blocked: 1: 0
73T: priolt: 0: 1
74
75# T2 lock L0
76C: locknowait: 2: 0
77W: blocked: 2: 0
78T: prioeq: 0: 82
79
80# T0 unlock L0
81C: unlock: 0: 0
82
83# Wait until T2 got the lock
84W: locked: 2: 0
85W: unlocked: 0: 0
86T: priolt: 0: 1
87
88# T2 unlock L0
89C: unlock: 2: 0
90
91W: unlocked: 2: 0
92W: locked: 1: 0
93
94C: unlock: 1: 0
95W: unlocked: 1: 0
diff --git a/scripts/rt-tester/t4-l2-pi-deboost.tst b/scripts/rt-tester/t4-l2-pi-deboost.tst
new file mode 100644
index 000000000000..01f1a80fa02a
--- /dev/null
+++ b/scripts/rt-tester/t4-l2-pi-deboost.tst
@@ -0,0 +1,127 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 4 threads 2 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedother: 1: 0
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65C: schedfifo: 3: 83
66W: opcodeeq: 3: 0
67
68# T0 lock L0
69C: locknowait: 0: 0
70W: locked: 0: 0
71
72# T1 lock L1
73C: locknowait: 1: 1
74W: locked: 1: 1
75
76# T3 lock L0
77C: lockintnowait: 3: 0
78W: blocked: 3: 0
79T: prioeq: 0: 83
80
81# T0 lock L1
82C: lock: 0: 1
83W: blocked: 0: 1
84T: prioeq: 1: 83
85
86# T1 unlock L1
87C: unlock: 1: 1
88
89# Wait until T0 is in the wakeup code
90W: blockedwake: 0: 1
91
92# Verify that T1 is unboosted
93W: unlocked: 1: 1
94T: priolt: 1: 1
95
96# T2 lock L1 (T0 is boosted and pending owner !)
97C: locknowait: 2: 1
98W: blocked: 2: 1
99T: prioeq: 0: 83
100
101# Interrupt T3 and wait until T3 returned
102C: signal: 3: 0
103W: unlocked: 3: 0
104
105# Verify prio of T0 (still pending owner,
106# but T2 is enqueued due to the previous boost by T3
107T: prioeq: 0: 82
108
109# Let T0 continue
110C: lockcont: 0: 1
111W: locked: 0: 1
112
113# Unlock L1 and let T2 get L1
114C: unlock: 0: 1
115W: locked: 2: 1
116
117# Verify that T0 is unboosted
118W: unlocked: 0: 1
119T: priolt: 0: 1
120
121# Unlock everything and exit
122C: unlock: 2: 1
123W: unlocked: 2: 1
124
125C: unlock: 0: 0
126W: unlocked: 0: 0
127
diff --git a/scripts/rt-tester/t5-l4-pi-boost-deboost.tst b/scripts/rt-tester/t5-l4-pi-boost-deboost.tst
new file mode 100644
index 000000000000..efa0788c1189
--- /dev/null
+++ b/scripts/rt-tester/t5-l4-pi-boost-deboost.tst
@@ -0,0 +1,148 @@
1#
2# rt-mutex test
3#
4# Op: C(ommand)/T(est)/W(ait)
5# | opcode
6# | | threadid: 0-7
7# | | | opcode argument
8# | | | |
9# C: lock: 0: 0
10#
11# Commands
12#
13# opcode opcode argument
14# schedother nice value
15# schedfifo priority
16# lock lock nr (0-7)
17# locknowait lock nr (0-7)
18# lockint lock nr (0-7)
19# lockintnowait lock nr (0-7)
20# lockcont lock nr (0-7)
21# unlock lock nr (0-7)
22# lockbkl lock nr (0-7)
23# unlockbkl lock nr (0-7)
24# signal thread to signal (0-7)
25# reset 0
26# resetevent 0
27#
28# Tests / Wait
29#
30# opcode opcode argument
31#
32# prioeq priority
33# priolt priority
34# priogt priority
35# nprioeq normal priority
36# npriolt normal priority
37# npriogt normal priority
38# locked lock nr (0-7)
39# blocked lock nr (0-7)
40# blockedwake lock nr (0-7)
41# unlocked lock nr (0-7)
42# lockedbkl dont care
43# blockedbkl dont care
44# unlockedbkl dont care
45# opcodeeq command opcode or number
46# opcodelt number
47# opcodegt number
48# eventeq number
49# eventgt number
50# eventlt number
51
52#
53# 5 threads 4 lock PI
54#
55C: resetevent: 0: 0
56W: opcodeeq: 0: 0
57
58# Set schedulers
59C: schedother: 0: 0
60W: opcodeeq: 0: 0
61C: schedfifo: 1: 81
62W: opcodeeq: 1: 0
63C: schedfifo: 2: 82
64W: opcodeeq: 2: 0
65C: schedfifo: 3: 83
66W: opcodeeq: 3: 0
67C: schedfifo: 4: 84
68W: opcodeeq: 4: 0
69
70# T0 lock L0
71C: locknowait: 0: 0
72W: locked: 0: 0
73
74# T1 lock L1
75C: locknowait: 1: 1
76W: locked: 1: 1
77
78# T1 lock L0
79C: lockintnowait: 1: 0
80W: blocked: 1: 0
81T: prioeq: 0: 81
82
83# T2 lock L2
84C: locknowait: 2: 2
85W: locked: 2: 2
86
87# T2 lock L1
88C: lockintnowait: 2: 1
89W: blocked: 2: 1
90T: prioeq: 0: 82
91T: prioeq: 1: 82
92
93# T3 lock L3
94C: locknowait: 3: 3
95W: locked: 3: 3
96
97# T3 lock L2
98C: lockintnowait: 3: 2
99W: blocked: 3: 2
100T: prioeq: 0: 83
101T: prioeq: 1: 83
102T: prioeq: 2: 83
103
104# T4 lock L3
105C: lockintnowait: 4: 3
106W: blocked: 4: 3
107T: prioeq: 0: 84
108T: prioeq: 1: 84
109T: prioeq: 2: 84
110T: prioeq: 3: 84
111
112# Signal T4
113C: signal: 4: 0
114W: unlocked: 4: 3
115T: prioeq: 0: 83
116T: prioeq: 1: 83
117T: prioeq: 2: 83
118T: prioeq: 3: 83
119
120# Signal T3
121C: signal: 3: 0
122W: unlocked: 3: 2
123T: prioeq: 0: 82
124T: prioeq: 1: 82
125T: prioeq: 2: 82
126
127# Signal T2
128C: signal: 2: 0
129W: unlocked: 2: 1
130T: prioeq: 0: 81
131T: prioeq: 1: 81
132
133# Signal T1
134C: signal: 1: 0
135W: unlocked: 1: 0
136T: priolt: 0: 1
137
138# Unlock and exit
139C: unlock: 3: 3
140C: unlock: 2: 2
141C: unlock: 1: 1
142C: unlock: 0: 0
143
144W: unlocked: 3: 3
145W: unlocked: 2: 2
146W: unlocked: 1: 1
147W: unlocked: 0: 0
148