Wiki source code of Thrash Testing

Version 2.1 by Ray Kiddy on 2009/11/03 11:43

Hide last authors
Ray Kiddy 1.1 1 One can test EOF operations in concurrent threads using the "thrash" test built into Wonder. One uses ant to execute the tests.
2
3 See [[ERXThrashTest.java>>http://wonder.svn.sourceforge.net/viewvc/wonder/trunk/Wonder/Frameworks/Core/ERExtensions/Tests/Sources/er/extensions/eof/ERXEOAccessUtilitiesTest.java?view=markup]] in the Wonder sources. One can define inner classes in that class. The "SimpleFetchTest" and "SimpleInsertTest" classes are examples. The thrash test will take a "scheme" that can be specified by the user and execute that scheme.
4
5 {{code}}
6
7 scheme:SimpleInsertTest::0-5,5-10,15-10,20-10
8
9 {{/code}}
10
11 For example, the scheme above will create threads using the "SimpleInsertTest" inner class. There is a string parameter that can be defined after the inner class name, which in this case is "". The ERXThrashTest class will create 5 threads and pass them a "delay" parameter of 0. Then it will create 10 threads and pass them a "delay" parameter of 5. This will cause the thread to start and then sleep for 5 seconds. The scheme above creates a total of 35 threads. There will be 5 that start immediately, 10 that start after 5 seconds, 10 more that start after 15 seconds, and 10 more that start after 20 seconds. The scheme can be arbitrarily long. The inner class can be defined to do some interesting set of operations, whatever is desired.
12
13 There is a target defined in ant which will run a pre-defined set of schemes.
14
15 This set of commands will compile the tests (the ERXThrashTest class compilation is conditional on having "include.tests=true" defined in the ant build of the ERExtensions project) and run the thrash tests:
16
17 {{code}}
18
19 cd Wonder
20 ant tests.all thrash.all
21
22 {{/code}}
23
24 This command will run the same scheme as above, but with 10 times the number of threads.
25
26 {{code}}
27
28 ant thrash -Dthrash.scheme=scheme:SimpleInsertTest::0-50,5-100,15-100,20-100
29
30 {{/code}}