22 sysfsprefix =
"/sys/devices/system/rttest/rttest"
23 statusfile =
"/status"
24 commandfile =
"/command"
33 "lockintnowait" :
"6",
42 "prioeq" : [
"P" ,
"eq" ,
None],
43 "priolt" : [
"P" ,
"lt" ,
None],
44 "priogt" : [
"P" ,
"gt" ,
None],
45 "nprioeq" : [
"N" ,
"eq" ,
None],
46 "npriolt" : [
"N" ,
"lt" ,
None],
47 "npriogt" : [
"N" ,
"gt" ,
None],
48 "unlocked" : [
"M" ,
"eq" , 0],
49 "trylock" : [
"M" ,
"eq" , 1],
50 "blocked" : [
"M" ,
"eq" , 2],
51 "blockedwake" : [
"M" ,
"eq" , 3],
52 "locked" : [
"M" ,
"eq" , 4],
53 "opcodeeq" : [
"O" ,
"eq" ,
None],
54 "opcodelt" : [
"O" ,
"lt" ,
None],
55 "opcodegt" : [
"O" ,
"gt" ,
None],
56 "eventeq" : [
"E" ,
"eq" ,
None],
57 "eventlt" : [
"E" ,
"lt" ,
None],
58 "eventgt" : [
"E" ,
"gt" ,
None],
63 print "rt-tester.py <-c -h -q -t> <testfile>"
64 print " -c display comments after first command"
66 print " -q quiet mode"
67 print " -t test mode (syntax check)"
68 print " testfile: read test specification from testfile"
69 print " otherwise from stdin"
83 intval = intval / (10 **
int(arg))
87 argval =
int(cmd_opcodes.get(arg, arg))
93 if top[1] ==
"eq" and intval == argval:
95 if top[1] ==
"lt" and intval < argval:
97 if top[1] ==
"gt" and intval > argval:
103 (options, arguments) = getopt.getopt(sys.argv[1:],
'chqt')
104 except getopt.GetoptError, ex:
109 for option, value
in options:
125 sys.stderr.write(
"File not found %s\n" %(arguments[0]))
141 parts = line.split(
":")
143 if not parts
or len(parts) < 1:
146 if len(parts[0]) == 0:
149 if parts[0].startswith(
"#"):
166 if cmd ==
"t" or cmd ==
"w":
167 testop = test_opcodes[opc]
169 fname =
"%s%s%s" %(sysfsprefix, tid, statusfile)
179 stat = status.split(",")
182 if s.startswith(testop[0]):
185 query =
analyse(val, testop, dat)
187 if query
or cmd ==
"t":
193 sys.stderr.write(
"Test failed in line %d\n" %(linenr))
198 cmdnr = cmd_opcodes[opc]
200 cmdstr =
"%s:%s" %(cmdnr, dat)
201 fname =
"%s%s%s" %(sysfsprefix, tid, commandfile)
210 sys.stderr.write(
str(ex))
211 sys.stderr.write(
"\nSyntax error in line %d\n" %(linenr))