-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmakelitmustests.sh
229 lines (221 loc) · 6.36 KB
/
makelitmustests.sh
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#! /bin/sh
#
# Generate a suitable set of litmus tests for analysis.
#
# Usage:
# sh makelitmustests.sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you can access it online at
# http://www.gnu.org/licenses/gpl-2.0.html.
#
# Copyright (C) IBM Corporation, 2015
#
# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
# RCU-related tests
{
# Load-buffering RCU tests, and with added ordering.
sh gendir.sh "RW-G RW-R" 8
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R/RW-RB/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rr RW-Ra/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rr RW-RC/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rs RW-RD/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rs RW-RCD/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rrd RW-D/p'
sh gendir.sh "RW-G RW-R" 8 |
sed -n -e 's/RW-R RW-R/RW-Rrd RW-CD/p'
echo "RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
echo "RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R RW-G RW-R"
# Load-buffering RCU tests with partial or multiple critical sections
sh gendir.sh "RW-G RW-R1" 4 | grep -e -R
sh gendir.sh "RW-G RW-R2" 4 | grep -e -R
sh gendir.sh "RW-G RW-R3" 4 | grep -e -R
sh gendir.sh "RW-G RW-R1I" 4 | grep -e -R
sh gendir.sh "RW-G RW-R2I" 4 | grep -e -R
sh gendir.sh "RW-G RW-R3I" 4 | grep -e -R
# A few larger load-buffering RCU tests.
sh gendir.sh "RW-G+RW-G+RW-R+RW-R+RW-R+RW-R+RW-G+RW-G RW-G RW-R" 5 |
tr '+' ' ' |
awk '{ if (NF < 20) print }'
sh gendir.sh "RW-R+RW-R+RW-G+RW-G+RW-G+RW-G+RW-R+RW-R RW-G RW-R" 5 |
tr '+' ' ' |
awk '{ if (NF < 20) print }'
# Load-buffering tests involving RCU grace periods and full barriers.
sh gendir.sh "RW-G RW-B" 8
sh gendir.sh "RW-G RW-B" 8 |
sed -n -e 's/RW-B RW-B/RW-r RW-a/p'
sh gendir.sh "RW-G RW-B" 8 |
sed -n -e 's/RW-B RW-B/RW-r RW-C/p'
# Non-load-buffering RCU tests.
sh gendir.sh "RW-G RW-RI" 8
sh gendir.sh "RR-G RR-R" 8
sh gendir.sh "WR-G WR-R" 8
sh gendir.sh "WW-G WW-R" 8
sh gendir.sh "WW-G WW-R" 8 |
sed -n -e 's/WW-R/WW-B/p'
# Combinations of grace periods and critical sections on one thread
for i in RR RW WR WW
do
echo $i-GR $i-R
echo $i-GR1 $i-R
echo $i-GR2 $i-R
echo $i-GR3 $i-R
echo $i-GR $i-R $i-R
echo $i-GR1 $i-R $i-R
echo $i-GR2 $i-R $i-R
echo $i-GR3 $i-R $i-R
echo $i-H $i-R
echo $i-H $i-R $i-R
echo $i-H $i-R $i-R $i-R
echo $i-H $i-R $i-R $i-G $i-R
echo $i-H $i-R $i-R $i-G $i-R $i-R
echo $i-GH $i-R
echo $i-GH $i-R $i-R
echo $i-GH $i-R $i-R $i-R
echo $i-GH $i-R $i-R $i-R $i-R
echo $i-GH $i-R $i-R $i-R $i-G $i-R
echo $i-GH $i-R $i-R $i-R $i-G $i-R $i-R
done
# Alan Stern's example that breaks Boqun's proposed change
# and its inverse:
echo RW-G RW-G RW-G RW-R RW-R RW-G RW-R RW-R
echo RW-R RW-R RW-R RW-G RW-G RW-R RW-G RW-G
} | sort -u | sh dir2litmus.sh auto/
# LB tests
{
# Properly paired tests
sh gendir.sh "R-Dd R-A R-Oc OB-O" 4 |
sed -e 's/OB-O$/OB-OB/'
} | {
awk '{
if (NF > 1) {
print "LRR " $0;
print "LRW " $0;
print "LWR " $0;
print "LWW " $0;
if ($0 ~ / OB-O OB-O /) {
# Produce a few once-once examples
dir = $0;
sub(/ OB-O /, " O-O ", dir);
print "LRW " dir;
}
if ($0 ~ / R-Dd R-Dd /) {
# Produce a few with dependency, but no deref
dir = $0;
sub(/ R-Dd /, " R-Od ", dir);
print "LRW " dir;
}
if ($0 ~ / R-Dd$/) {
# Produce a few at end with deref, but no dependency
dir = $0;
sub(/ R-Dd$/, " R-D", dir);
print "LRW " dir;
}
if ($0 ~ / R-Dd$/) {
# Produce a few at end with dependency, but no deref
dir = $0;
sub(/ R-Dd$/, " R-Od", dir);
print "LRR " dir;
# Produce a few at end with both control and dependency
dir = $0;
sub(/ R-Dd$/, " R-Dcd", dir);
print "LRW " dir;
}
if ($0 ~ / R-Dd R-Dd /) {
# Produce a few with value dependency, but no deref
dir = $0;
sub(/ R-Dd /, " R-Ov R-OC ", dir);
print "LRW " dir;
}
if ($0 ~ / R-Dd$/) {
# Produce a few at end with value dep, but no deref
dir = $0;
sub(/ R-Dd$/, " R-Ov", dir);
print "LRW " dir;
# Produce a few at end with both control and value
dir = $0;
sub(/ R-Dd$/, " R-Dcv", dir);
print "LRW " dir;
}
if ($0 ~ / R-Oc /) {
# Produce a few with combined control/rmb
dir = $0;
sub(/ R-Oc /, " R-OC ", dir);
print "LRW " dir;
}
if ($0 ~ / R-Oc$/) {
# Ditto, but with trailing read
dir = $0;
sub(/ R-Oc$/, " R-OC", dir);
print "LRR " dir;
}
if ($0 ~ / R-Oc$/) {
# Produce a few with fake control dependency at end
dir = $0;
sub(/ R-Oc$/, " R-Ok", dir);
print "LRW " dir;
}
if ($0 ~ / R-A$/) {
# Produce a few with C11 release sequence at end
dir = $0;
sub(/ R-A$/, " RQ-A", dir);
print "LRW " dir;
}
if ($0 ~ / R-A R-A$/) {
# Produce a few with C11 release sequence near end
dir = $0;
sub(/ R-A R-A$/, " RQ-A R-A", dir);
print "LRW " dir;
}
if ($0 ~ / R-A R-A$/) {
# Produce a few with non-control-dependency-protected
# C11 release sequence near end
dir = $0;
sub(/ R-A R-A$/, " R-Oc Oq-A", dir);
print "LRW " dir;
}
}
print "GRR " $0;
print "GRW " $0;
print "GWR " $0;
print "GWW " $0;
}'
for i in GRR GRW GWR GWW LRR LRW LWR LWW
do
echo $i R-A O-Dd
echo $i R-A R-Dd
echo $i R-A OB-Dd
done
echo LRW OB-Dv
echo LRW OB-Ov
sh gendir.sh "R-A R-Oc R-OC R-Od R-D R-Ov" 3 |
grep -v 'R-Ov [^-]*-[^ ]*d' |
grep -v 'R-Ov$' |
awk '{
print "Lrw" $0;
print "Lwr" $0;
print "Lww" $0;
}'
} | sort -u |
awk -f RCULBlitmusgen.awk -e '{ gen_lb_litmus("auto/", $0); }'