1Real Time NPTL(rt-nptl) test suite README 2========================================= 3 4The document describes what rt-nptl tests are, how they are created, 5how to make and run the tests and how to analysis the result. 6 7rt-nptl tests include two parts, one is robust mutex tests, the other 8is priority inheritance(pi) mutex tests. 9 10In the document, <rtnptl-tests> stands for the directory where 11rtnptl-tests was extracted. 12 13 14Building the tests 15------------------- 16If you use the build method outlined in INSTALL-rtnptl, then just 17change the top Makefile and the two Makefile under pi_test and 18robust_test to include the Makefile.inc generated by INSTALL-rtnptl. 19 20Otherwise, you need to set the CFLAGS and LDFLAGS of the Makefile to 21point to where your copy of glibc+RTNPTL is built. 22 23Run the tests 24---------------- 25Use ./run.sh to run the tests; this makes sure there is a basic 26watchdog timer to kill the pi mutex tests if they fail. 27 28For different tests, there are different result analysis methods. The 29following two sections will describe this in detail. 30 31Priority Inheritance Mutex Tests 32-------------------------- 33The tests are under <rtnptl-tests>/pi_test directory. 34 35rt-nptl supports priority inheritance, if task TL with priority P(TL) 36held a mutex, task TB with priority P(TB) claims the mutex and becomes 37a waiter, P(TB)>P(TL), TL will boost to TB's priority until it 38releases the lock. The pi mutex tests create several scenarios to test 39this functionality. Please refer to the description in the tests for 40the detailed information. 41 42Currently pi mutex tests don't provide automatic PASS or FAIL result 43display. Although users can use run.sh under <rtnptl-tests>/pi_test to 44run the pi mutex tests, they need to analyze the output to get the 45PASS or FAIL test result manually. After executing run.sh, the output 46files will be generated with the name output.<testcasename>, such as 47output.pitest-1. 48 49If users use run.sh from ssh, to avoid the priority inversion 50problem happened occasionally, users can use "chrt -p -f $PRIORITY 51$$PPID" to increase the priority of sshd, if use run.sh from console, 52users can use "chrt -p -f $PRIORITY $$" to increase the shell priority 53before executing run.sh. 54 55A sampling thread will sample the progress of working threads (TL, TPs 56and TFs) at a specified interval and print out an integer value. 57Progress of TL and TP is measured by how many times they execute a 58busy loop; the output of this count indicates how far they progress 59with respect to each other. 60 61The first column of the output is the time when sampling happens. The 62second column indicates the progress of TL thread at that time. The 63third column indicates the progress of TP at that time. For pitest-2 64and pitest-3, the second column is TP1 and the third column is TP2. 65The remaining columns indicate the progress of TF (if any). 66 67If the priority of TL is higher than (or equal to) the priority of TP, 68TP will make not progress (the output of TP will not increase, since 69it will not be scheduled to execute). Otherwise, TP and TL will both 70make progress. As a result, Users can observe the priority change of 71TL by the progress of TP. 72 73Users can also use 'do-plot' utility under <rtnptl-tests>/pi_test to 74generate a diagram using the output of test case. To do so: 75 761. Redirect the output of test case into a file, e.g: 77 pitest-1 > output.pitest-1 78 792. Under X term, run: 80 do-plot output.pitest-1 81 82do-plot will invoke 'gnuplot' to generate a diagram showing the 83progress of TL and TP. ('gnuplot has to be installed in the system'). 84 85Given pitest-1 as an example: 86If the pi function works, TF's progress should be a straight line 87constantly going up; TP's progress should start at about 10 seconds 88and should be parallel to TF's until ten seconds later (20 seconds) 89when TL is created; at this time TP's slope should go down a wee bit 90and TL's slope should not be zero. After 10 seconds (30 seconds), TB 91is created and TL boosted. At this moment, TP's slope should go down 92to zero and TL's should be parallel to TF's. After TB timeouts on 93waiting the mutex (50 seconds), TL and TP's slope will change back to 94the original trend during 20~30 seconds. 95 96You can refer to 97http://developer.osdl.org/dev/robustmutexes/pitest-1-0.5.png for the 98diagram generated by do-plot for pitest-1. 99