blob: 07fd0ced4267d490bb4d8671fb94fc7c8232112f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
$Id$
This is the readme file for the tests of the concurrency service.
The test program has been changed to use a configuration file instead of
hard coded test procedures. The old test procedures are left in the
program for backwards compatibility, but they will be removed at a later
point in time.
The description of the old tests is in the readme file for the
concurrency service in the directory:
$TAO_ROOT/orbsvcs/Concurrency_Control
please consult this file for a decription of these tests.
The new tests are described by this simle test language:
start: /* empty */
| cmd_list
;
cmd_list: cmd_list cmd
| cmd
;
cmd: start <config_file_name> ;
| create <lock_set_name> ;
| create ;
| lock <lock_set_name> <lock_mode> ;
| lock <lock_mode> ;
| unlock <lock_set_name> <lock_mode> ;
| unlock <lock_mode> ;
| try_lock <lock_set_name> <lock_mode> ;
| try_lock <lock_mode> ;
| change_mode <lock_set_name> <lock_mode> <lock_mode> ;
| change_mode <lock_mode> <lock_mode> ;
| lookup <lock_set_name> ;
| sleep <int> ;
| repeat <int> ;
| wait ;
| wait <prompt> ;
;
lock_mode: read | intention_read | upgrade | write | intention_write
prompt: " string "
If the lock set name is left out the default lock set is used. The
repeat command just sets a global variable in the test, i.e. the last
repeat command is the one that will take effect - the whole script is
run the specified number of times.
An example of a script (assuming it's called 'test.cfg' - comments are
not supported):
// Start a new CC_client with test.txt as script file
start test.txt;
// Create the lock set "ls1" and register it in the naming service
create ls1;
// Lock the read lock in the lock set
lock ls1 read;
// Try the read lock
try_lock ls1 read;
// sleep two seconds
sleep 2;
// Wait for the user to press enter
wait;
// Unlock the read lock in the ls1 lock set
unlock ls1 read;
// Change the mode of the read lock in the ls1 lock set to write mode
change_mode ls1 read write;
The test can be run with the command ./CC_client -c test.cfg.
There are currentlig the following tests in the
$TAO_ROOT/orbsvcs/tests/Concurrency
directory:
basic_tests.cfg The same as running ./CC_client -b
extended_tests.cfg The same as running ./CC_client -e '1;test'
./CC_client -e '2;test'
./CC_client -e '3;test'
test.dinphil Dining philosophers. Uses test.phil[1-5]
----------------------------------------
THE IMPLEMENTATION
The implementation of the concurrency service tests is located in
the $TAO_ROOT/orbsvcs/tests/Concurrency directory and consists of
the following files:
CC_client.{h,cpp} contain initialization and the main function.
CC_tests.{h,cpp} The old tests [-b] and [-e] options to CC_client
CC_command.{h,cpp} The commands that can be used in the scripting
language are implemented in these files. The list of
commands to execute is also implemented here.
CC_command.l The lex file for the script language.
CC_command.y The yacc file for the script language.
CC_command.tab.{h,cpp} and lex.CC_command.cpp Derived files from
the lex and yacc files.
CC_naming_service.{h,cpp} A wrapper class around the necessary
naming service functinallity for the tests.
CC_test_utils.{h,cpp} provides a namespace for utility functions.
test.* Test scripts for the concurrency service.
|