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