Debian Codegraph @

tests/API/XCCDF/variable_instance/all.sh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 #
3 # Copyright 2013 Red Hat Inc., Durham, North Carolina.
4 # All Rights Reserved.
5 #
6 # This script is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
20 set -e -o pipefail
21
22 . $builddir/tests/test_common.sh
23
24 #
25 # Export two values from XCCDF to a single OVAL variable as a part
26 # of single rule. Result is a single varible set with multiple values.
27 #
28 function xccdf_export_1_multivalscip-shell shell shell-project 0.0.0 xccdf_export_1_multival().() {
29 local name=$FUNCNAME
30 local variables0="requires_both-oval.xml-0.variables-0.xml"
31 local variables1="requires_both-oval.xml-0.variables-1.xml"
32 local result="$variables0"
33 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
34 echoscip-shell system . . echo. "Stderr file = $stderr"
35
36 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
37 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
38 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_1 \
39 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
40 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
41 [scip-shell system . . `[`. -f $variables0 ]
42 [scip-shell system . . `[`. ! -f $variables1 ]
43 $OSCAP oval validate $variables0
44 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
45 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
46 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
47 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
48 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
49 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
50 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
51 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
52 rmscip-shell system . . rm. $variables0
53 rmscip-shell system . . rm. $stderr
54 }
55
56 #
57 # Export two values from XCCDF to a single OVAL variable that it should
58 # result in multiple (two) variable sets each with a single value.
59 #
60 function xccdf_export_2_multisetscip-shell shell shell-project 0.0.0 xccdf_export_2_multiset().(){
61 local variables0="requires_both-oval.xml-0.variables-0.xml"
62 local variables1="requires_both-oval.xml-0.variables-1.xml"
63 local variables2="requires_both-oval.xml-0.variables-2.xml"
64 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
65 echoscip-shell system . . echo. "Stderr file = $stderr"
66
67 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
68 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
69 [scip-shell system . . `[`. ! -f $variables2 ] || rmscip-shell system . . rm. $variables2
70 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_2 \
71 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
72 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
73 [scip-shell system . . `[`. -f $variables0 ]
74 [scip-shell system . . `[`. -f $variables1 ]
75 [scip-shell system . . `[`. ! -f $variables2 ]
76 $OSCAP oval validate $variables0
77 $OSCAP oval validate $variables1
78 local result="$variables0"
79 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
80 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
81 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
82 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
83 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
84 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
85 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
86 result="$variables1"
87 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
88 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
89 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
90 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
91 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
92 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
93 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
94 rmscip-shell system . . rm. $stderr
95 rmscip-shell system . . rm. $variables0
96 rmscip-shell system . . rm. $variables1
97 }
98
99 #
100 # Export a single value from XCCDF to a single OVAL variable twice.
101 #
102 function xccdf_export_3_twice_samescip-shell shell shell-project 0.0.0 xccdf_export_3_twice_same().(){
103 local variables0="requires_both-oval.xml-0.variables-0.xml"
104 local variables1="requires_both-oval.xml-0.variables-1.xml"
105 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
106 echoscip-shell system . . echo. "Stderr file = $stderr"
107
108 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
109 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
110 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_3 \
111 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
112 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
113 [scip-shell system . . `[`. -f $variables0 ]
114 [scip-shell system . . `[`. ! -f $variables1 ]
115 $OSCAP oval validate $variables0
116 local result="$variables0"
117 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
118 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
119 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
120 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
121 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
122 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
123 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
124 rmscip-shell system . . rm. $stderr
125 rmscip-shell system . . rm. $variables0
126 }
127
128 #
129 # Export the very same value twice in the same batch. The behaviour seems
130 # undefined, although OpenSCAP chooses to export a single value to OVAL
131 #
132 function xccdf_export_4_two_samescip-shell shell shell-project 0.0.0 xccdf_export_4_two_same().(){
133 local variables0="requires_both-oval.xml-0.variables-0.xml"
134 local variables1="requires_both-oval.xml-0.variables-1.xml"
135 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
136 echoscip-shell system . . echo. "Stderr file = $stderr"
137
138 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
139 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
140 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_4 \
141 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
142 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
143 [scip-shell system . . `[`. -f $variables0 ]
144 [scip-shell system . . `[`. ! -f $variables1 ]
145 $OSCAP oval validate $variables0
146 local result="$variables0"
147 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
148 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
149 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
150 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
151 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
152 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
153 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
154 rmscip-shell system . . rm. $stderr
155 rmscip-shell system . . rm. $variables0
156 }
157
158 #
159 # Export two variable sets (the very same) from XCCDF to OVAL.
160 #
161 function xccdf_export_5_multival_twicescip-shell shell shell-project 0.0.0 xccdf_export_5_multival_twice().(){
162 local variables0="requires_both-oval.xml-0.variables-0.xml"
163 local variables1="requires_both-oval.xml-0.variables-1.xml"
164 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
165 echoscip-shell system . . echo. "Stderr file = $stderr"
166
167 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
168 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
169 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_5 \
170 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
171 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
172 [scip-shell system . . `[`. -f $variables0 ]
173 [scip-shell system . . `[`. ! -f $variables1 ]
174 $OSCAP oval validate $variables0
175 local result="$variables0"
176 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
177 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
178 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
179 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
180 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
181 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
182 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
183 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
184 rmscip-shell system . . rm. $stderr
185 rmscip-shell system . . rm. $variables0
186 }
187
188 #
189 # Export two distinct variable sets from XCCDF to OVAL.
190 #
191 function xccdf_export_6_multiset_multivalscip-shell shell shell-project 0.0.0 xccdf_export_6_multiset_multival().(){
192 local variables0="requires_both-oval.xml-0.variables-0.xml"
193 local variables1="requires_both-oval.xml-0.variables-1.xml"
194 local variables2="requires_both-oval.xml-0.variables-2.xml"
195 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
196 echoscip-shell system . . echo. "Stderr file = $stderr"
197
198 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
199 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
200 [scip-shell system . . `[`. ! -f $variables2 ] || rmscip-shell system . . rm. $variables2
201 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_6 \
202 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
203 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
204 [scip-shell system . . `[`. -f $variables0 ]
205 [scip-shell system . . `[`. -f $variables1 ]
206 [scip-shell system . . `[`. ! -f $variables2 ]
207 $OSCAP oval validate $variables0
208 $OSCAP oval validate $variables1
209 local result="$variables0"
210 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
211 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
212 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
213 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
214 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
215 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
216 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
217 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
218 result="$variables1"
219 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
220 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
221 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
222 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
223 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
224 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
225 assert_exists 1 '/oval_variables/variables/variable/value[text()="200"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="200"]`.'
226 assert_exists 1 '/oval_variables/variables/variable/value[text()="400"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="400"]`.'
227 rmscip-shell system . . rm. $stderr
228 rmscip-shell system . . rm. $variables0
229 rmscip-shell system . . rm. $variables1
230 }
231
232 #
233 # Export the very same variable sets twice (the second value-set is shuffled
234 # but the tool should correctly recognize it is the same
235 #
236 function xccdf_export_7_shuffled_multivalscip-shell shell shell-project 0.0.0 xccdf_export_7_shuffled_multival().(){
237 local variables0="requires_both-oval.xml-0.variables-0.xml"
238 local variables1="requires_both-oval.xml-0.variables-1.xml"
239 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
240 echoscip-shell system . . echo. "Stderr file = $stderr"
241
242 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
243 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
244 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_7 \
245 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
246 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
247 [scip-shell system . . `[`. -f $variables0 ]
248 [scip-shell system . . `[`. ! -f $variables1 ]
249 $OSCAP oval validate $variables0
250 local result="$variables0"
251 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
252 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
253 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
254 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
255 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
256 assert_exists 4 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
257 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
258 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
259 assert_exists 1 '/oval_variables/variables/variable/value[text()="200"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="200"]`.'
260 assert_exists 1 '/oval_variables/variables/variable/value[text()="400"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="400"]`.'
261 rmscip-shell system . . rm. $stderr
262 rmscip-shell system . . rm. $variables0
263 }
264
265 #
266 # Export the very same variable sets twice (the second value-set is shuffled
267 # and a different set of values is duplicated in each bunch.
268 #
269 function xccdf_export_8_shuffled_multivalscip-shell shell shell-project 0.0.0 xccdf_export_8_shuffled_multival().(){
270 local variables0="requires_both-oval.xml-0.variables-0.xml"
271 local variables1="requires_both-oval.xml-0.variables-1.xml"
272 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
273 echoscip-shell system . . echo. "Stderr file = $stderr"
274
275 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
276 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
277 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_8 \
278 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
279 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
280 [scip-shell system . . `[`. -f $variables0 ]
281 [scip-shell system . . `[`. ! -f $variables1 ]
282 $OSCAP oval validate $variables0
283 local result="$variables0"
284 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
285 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
286 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
287 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
288 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
289 assert_exists 3 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
290 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
291 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
292 assert_exists 1 '/oval_variables/variables/variable/value[text()="200"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="200"]`.'
293 rmscip-shell system . . rm. $stderr
294 rmscip-shell system . . rm. $variables0
295 }
296
297 #
298 # Export two multivals, the first is subset of the second or third.
299 #
300 function xccdf_export_9_first_subsetscip-shell shell shell-project 0.0.0 xccdf_export_9_first_subset().(){
301 local variables0="requires_both-oval.xml-0.variables-0.xml"
302 local variables1="requires_both-oval.xml-0.variables-1.xml"
303 local variables2="requires_both-oval.xml-0.variables-2.xml"
304 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
305 echoscip-shell system . . echo. "Stderr file = $stderr"
306
307 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
308 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
309 [scip-shell system . . `[`. ! -f $variables2 ] || rmscip-shell system . . rm. $variables2
310 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_9 \
311 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
312 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
313 [scip-shell system . . `[`. -f $variables0 ]
314 [scip-shell system . . `[`. -f $variables1 ]
315 [scip-shell system . . `[`. ! -f $variables2 ]
316 $OSCAP oval validate $variables0
317 $OSCAP oval validate $variables1
318 local result="$variables0"
319 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
320 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
321 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
322 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
323 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
324 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
325 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
326 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
327 result="$variables1"
328 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
329 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
330 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
331 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
332 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
333 assert_exists 3 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
334 assert_exists 1 '/oval_variables/variables/variable/value[text()="200"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="200"]`.'
335 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
336 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
337 rmscip-shell system . . rm. $stderr
338 rmscip-shell system . . rm. $variables0
339 rmscip-shell system . . rm. $variables1
340 }
341
342 #
343 # Export two multivals, the last is subset of the first two.
344 #
345 function xccdf_export_A_second_subsetscip-shell shell shell-project 0.0.0 xccdf_export_A_second_subset().(){
346 local variables0="requires_both-oval.xml-0.variables-0.xml"
347 local variables1="requires_both-oval.xml-0.variables-1.xml"
348 local variables2="requires_both-oval.xml-0.variables-2.xml"
349 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
350 echoscip-shell system . . echo. "Stderr file = $stderr"
351
352 [scip-shell system . . `[`. ! -f $variables0 ] || rmscip-shell system . . rm. $variables0
353 [scip-shell system . . `[`. ! -f $variables1 ] || rmscip-shell system . . rm. $variables1
354 [scip-shell system . . `[`. ! -f $variables2 ] || rmscip-shell system . . rm. $variables2
355 $OSCAP xccdf export-oval-variables --profile xccdf_moc.elpmaxe.www_profile_10 \
356 $srcdir/test_xccdf_variable_instance.xccdf.xml 2>&1 > $stderr
357 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
358 [scip-shell system . . `[`. -f $variables0 ]
359 [scip-shell system . . `[`. -f $variables1 ]
360 [scip-shell system . . `[`. ! -f $variables2 ]
361 $OSCAP oval validate $variables0
362 $OSCAP oval validate $variables1
363 local result="$variables0"
364 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
365 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
366 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
367 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
368 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
369 assert_exists 3 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
370 assert_exists 1 '/oval_variables/variables/variable/value[text()="200"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="200"]`.'
371 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
372 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
373 result="$variables1"
374 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
375 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
376 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
377 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
378 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
379 assert_exists 2 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
380 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
381 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
382 rmscip-shell system . . rm. $stderr
383 rmscip-shell system . . rm. $variables0
384 rmscip-shell system . . rm. $variables1
385 }
386
387 #
388 # Evaluate XCCDF while exporting two values from XCCDF document to a single OVAL
389 # variable that it should result in multiple (two) variable sets each with a single
390 # value. This tests asserts for correctly collected system characteristics.
391 #
392 function xccdf_eval_2_multisetscip-shell shell shell-project 0.0.0 xccdf_eval_2_multiset().(){
393 local variables0="requires_both-oval.xml-0.variables-0.xml"
394 local variables1="requires_both-oval.xml-0.variables-1.xml"
395 local variables2="requires_both-oval.xml-0.variables-2.xml"
396 local oval_result="requires_both-oval.xml.result.xml"
397 local xccdf_result=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.xml.XXXXXX)
398 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
399 local profile="xccdf_moc.elpmaxe.www_profile_2"
400 local tested_file="testing_file.xml"
401 echoscip-shell system . . echo. "Stderr file = $stderr"
402 cpscip-shell system . . cp. $srcdir/testing_file_300.xml $tested_file
403
404 for f in $variables0 $variables1 $variables2 $oval_result $xccdf_result; do
405 [scip-shell system . . `[`. ! -f $f ] || rmscip-shell system . . rm. $f
406 done
407 local res=0
408 $OSCAP xccdf eval --profile $profile \
409 --export-variables --oval-results --results $xccdf_result \
410 $srcdir/test_xccdf_variable_instance.xccdf.xml 2> $stderr || res=$?
411 [scip-shell system . . `[`. $res -eq 2 ]
412 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
413 [scip-shell system . . `[`. -f $variables0 ]
414 [scip-shell system . . `[`. -f $variables1 ]
415 [scip-shell system . . `[`. ! -f $variables2 ]
416 $OSCAP oval validate $variables0
417 $OSCAP oval validate $variables1
418 $OSCAP oval validate $oval_result
419 local result="$xccdf_result"
420 assert_exists 1 '/Benchmark/TestResultscip-shell filesystem . . `/Benchmark/TestResult`.'
421 assert_exists 1 '/Benchmark/TestResult/profilescip-shell filesystem . . `/Benchmark/TestResult/profile`.'
422 assert_exists 1 '/Benchmark/TestResult/profile/@*scip-shell filesystem . . `/Benchmark/TestResult/profile/@*`.'
423 assert_exists 1 '/Benchmark/TestResult/profile[@idref="'$profile'"]'
424 assert_exists 2 '/Benchmark/TestResult/rule-result/result[text()!="notselected"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result/result[text()!="notselected"]`.'
425 assert_exists 1 '/Benchmark/TestResult/rule-result/result[text()="pass"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result/result[text()="pass"]`.'
426 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]`.'
427 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/result[text()="pass"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/result[text()="pass"]`.'
428 assert_exists 0 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/messagescip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/message`.'
429 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/checkscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check`.'
430 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-exportscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-export`.'
431 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-export[@export-name="oval:com.example.www:var:1"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-export[@export-name="oval:com.example.www:var:1"]`.'
432 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-export[@value-id="xccdf_moc.elpmaxe.www_value_1"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-export[@value-id="xccdf_moc.elpmaxe.www_value_1"]`.'
433 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-content-refscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_2"]/check/check-content-ref`.'
434 assert_exists 1 '/Benchmark/TestResult/rule-result/result[text()="fail"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result/result[text()="fail"]`.'
435 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]`.'
436 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/result[text()="fail"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/result[text()="fail"]`.'
437 assert_exists 0 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/messagescip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/message`.'
438 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/checkscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check`.'
439 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-exportscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-export`.'
440 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-export[@export-name="oval:com.example.www:var:1"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-export[@export-name="oval:com.example.www:var:1"]`.'
441 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-export[@value-id="xccdf_moc.elpmaxe.www_value_2"]scip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-export[@value-id="xccdf_moc.elpmaxe.www_value_2"]`.'
442 assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-content-refscip-shell filesystem . . `/Benchmark/TestResult/rule-result[@idref="xccdf_moc.elpmaxe.www_rule_3"]/check/check-content-ref`.'
443 result="$variables0"
444 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
445 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
446 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
447 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
448 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
449 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
450 assert_exists 1 '/oval_variables/variables/variable/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="300"]`.'
451 result="$variables1"
452 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
453 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
454 assert_exists 1 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
455 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
456 assert_exists 1 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
457 assert_exists 1 '/oval_variables/variables/variable/valuescip-shell filesystem . . `/oval_variables/variables/variable/value`.'
458 assert_exists 1 '/oval_variables/variables/variable/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable/value[text()="600"]`.'
459 result="$oval_result"
460 assert_exists 1 '/oval_resultsscip-shell filesystem . . `/oval_results`.'
461 assert_exists 1 '/oval_results/resultsscip-shell filesystem . . `/oval_results/results`.'
462 assert_exists 1 '/oval_results/results/systemscip-shell filesystem . . `/oval_results/results/system`.'
463 assert_exists 1 '/oval_results/results/system/oval_system_characteristicsscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics`.'
464 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/generatorscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/generator`.'
465 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_infoscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_info`.'
466 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_datascip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data`.'
467 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_itemscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item`.'
468 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(*) = 5]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(*) = 5]`.'
469 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath`.'
470 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:pathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:path`.'
471 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filenamescip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filename`.'
472 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:xpathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:xpath`.'
473 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_ofscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of`.'
474 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="300"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="300"]`.'
475 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objectsscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects`.'
476 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/objectscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object`.'
477 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[count(@*) = 4]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[count(@*) = 4]`.'
478 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:com.example.www:obj:1"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@id="oval:com.example.www:obj:1"]`.'
479 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@version="1"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@version="1"]`.'
480 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@flag="complete"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@flag="complete"]`.'
481 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[reference]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[reference]`.'
482 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[count(reference/@*) = 1]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[count(reference/@*) = 1]`.'
483 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[reference/@item_ref]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[reference/@item_ref]`.'
484 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@variable_instance="1"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@variable_instance="1"]`.'
485 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@variable_instance="2"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/collected_objects/object[@variable_instance="2"]`.'
486 assert_exists 4 '/oval_results/results/system/oval_system_characteristics/*scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/*`.'
487 assert_exists 1 '/oval_results/results/system/testsscip-shell filesystem . . `/oval_results/results/system/tests`.'
488 assert_exists 3 '/oval_results/results/system/tests/testscip-shell filesystem . . `/oval_results/results/system/tests/test`.'
489 assert_exists 3 '/oval_results/results/system/tests/test[@version="1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@version="1"]`.'
490 assert_exists 3 '/oval_results/results/system/tests/test[@check="at least one"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@check="at least one"]`.'
491 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"]`.'
492 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @result="not evaluated"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @result="not evaluated"]`.'
493 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and count(*) = 0]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and count(*) = 0]`.'
494 assert_exists 2 '/oval_results/results/system/tests/test[count(*) = 2]scip-shell filesystem . . `/oval_results/results/system/tests/test[count(*) = 2]`.'
495 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]`.'
496 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="true"]`.'
497 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and not(@variable_instance)]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and not(@variable_instance)]`.'
498 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and not(@variable_instance) and @result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and not(@variable_instance) and @result="true"]`.'
499 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="false"]`.'
500 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @variable_instance="2"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @variable_instance="2"]`.'
501 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @variable_instance="2" and @result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @variable_instance="2" and @result="false"]`.'
502 assert_exists 2 '/oval_results/results/system/tests/test/tested_itemscip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item`.'
503 assert_exists 4 '/oval_results/results/system/tests/test/tested_item/@*scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item/@*`.'
504 assert_exists 2 '/oval_results/results/system/tests/test/tested_item/@item_idscip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item/@item_id`.'
505 assert_exists 1 '/oval_results/results/system/tests/test/tested_item[@result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item[@result="true"]`.'
506 assert_exists 1 '/oval_results/results/system/tests/test/tested_item[@result="false"]scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_item[@result="false"]`.'
507 assert_exists 2 '/oval_results/results/system/tests/test/tested_variablescip-shell filesystem . . `/oval_results/results/system/tests/test/tested_variable`.'
508 assert_exists 2 '/oval_results/results/system/tests/test/tested_variable[@variable_id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_variable[@variable_id="oval:com.example.www:var:1"]`.'
509 assert_exists 1 '/oval_results/results/system/tests/test/tested_variable[text()="300"]scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_variable[text()="300"]`.'
510 assert_exists 1 '/oval_results/results/system/tests/test/tested_variable[text()="600"]scip-shell filesystem . . `/oval_results/results/system/tests/test/tested_variable[text()="600"]`.'
511 assert_exists 1 '/oval_results/results/system/definitionsscip-shell filesystem . . `/oval_results/results/system/definitions`.'
512 assert_exists 3 '/oval_results/results/system/definitions/*scip-shell filesystem . . `/oval_results/results/system/definitions/*`.'
513 assert_exists 3 '/oval_results/results/system/definitions/definitionscip-shell filesystem . . `/oval_results/results/system/definitions/definition`.'
514 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2"]`.'
515 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and not(@variable_instance)]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and not(@variable_instance)]`.'
516 assert_exists 2 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1"]`.'
517 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]`.'
518 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteriascip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria`.'
519 assert_exists 2 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/@*scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/@*`.'
520 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria[@operator="AND"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria[@operator="AND"]`.'
521 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria[@result="false"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria[@result="false"]`.'
522 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterionscip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion`.'
523 assert_exists 3 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion/@*scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion/@*`.'
524 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@test_ref="oval:com.example.www:tst:1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@test_ref="oval:com.example.www:tst:1"]`.'
525 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@version="1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@version="1"]`.'
526 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@result="false"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="2"]/criteria/criterion[@result="false"]`.'
527 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]`.'
528 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteriascip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria`.'
529 assert_exists 2 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/@*scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/@*`.'
530 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria[@operator="AND"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria[@operator="AND"]`.'
531 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria[@result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria[@result="true"]`.'
532 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterionscip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion`.'
533 assert_exists 3 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion/@*scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion/@*`.'
534 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@test_ref="oval:com.example.www:tst:1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@test_ref="oval:com.example.www:tst:1"]`.'
535 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@version="1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@version="1"]`.'
536 assert_exists 1 '/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@variable_instance="1"]/criteria/criterion[@result="true"]`.'
537 assert_exists 3 '/oval_results/results/system/*scip-shell filesystem . . `/oval_results/results/system/*`.'
538 rmscip-shell system . . rm. $stderr
539 rmscip-shell system . . rm. $xccdf_result
540 rmscip-shell system . . rm. $oval_result
541 rmscip-shell system . . rm. $variables0
542 rmscip-shell system . . rm. $variables1
543 chmodscip-shell system . . chmod. u+w $tested_file ; rmscip-shell system . . rm. $tested_file
544 }
545
546 #
547 # Evaluate XCCDF while exporting two values from XCCDF document to a single OVAL
548 # variable that it should result in multiple (two) variable sets each with a single
549 # value. This tests asserts for correctly collected system characteristics.
550 #
551 function xccdf_eval_1_multiset_syscharscip-shell shell shell-project 0.0.0 xccdf_eval_1_multiset_syschar().(){
552 local variables0="requires_both-oval.xml-0.variables-0.xml"
553 local variables1="requires_both-oval.xml-0.variables-1.xml"
554 local variables2="requires_both-oval.xml-0.variables-2.xml"
555 local oval_result="requires_both-oval.xml.result.xml"
556 local xccdf_result=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.xml.XXXXXX)
557 local stderr=$(mktempscip-shell system . . mktemp. -t ${FUNCNAME}.err.XXXXXX)
558 local profile="xccdf_moc.elpmaxe.www_profile_11"
559 local file300="testing_file_300x.xml"
560 local file600="testing_file_600x.xml"
561 echoscip-shell system . . echo. "Stderr file = $stderr"
562
563 cpscip-shell system . . cp. $srcdir/testing_file_300.xml $file300
564 cpscip-shell system . . cp. $srcdir/testing_file_600.xml $file600
565 for f in $variables0 $variables1 $variables2 $oval_result $xccdf_result; do
566 [scip-shell system . . `[`. ! -f $f ] || rmscip-shell system . . rm. $f
567 done
568
569 # Creating files in ./ directory for distcheck
570 $OSCAP xccdf eval --profile $profile \
571 --export-variables --oval-results --results $xccdf_result \
572 $srcdir/test_xccdf_variable_instance.xccdf.xml 2> $stderr
573 [scip-shell system . . `[`. -f $stderr ]; [scip-shell system . . `[`. ! -s $stderr ]
574 [scip-shell system . . `[`. -f $variables0 ]
575 [scip-shell system . . `[`. -f $variables1 ]
576 [scip-shell system . . `[`. ! -f $variables2 ]
577 $OSCAP oval validate $variables0
578 $OSCAP oval validate $variables1
579 $OSCAP oval validate $oval_result
580 result="$variables0"
581 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
582 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
583 assert_exists 2 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
584 assert_exists 2 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
585 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
586 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/valuescip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value`.'
587 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value[text()="300"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value[text()="300"]`.'
588 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]`.'
589 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/valuescip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/value`.'
590 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/value[text()="./'$file300'"]'
591 result="$variables1"
592 assert_exists 1 '/oval_variablesscip-shell filesystem . . `/oval_variables`.'
593 assert_exists 1 '/oval_variables/variablesscip-shell filesystem . . `/oval_variables/variables`.'
594 assert_exists 2 '/oval_variables/variables/variablescip-shell filesystem . . `/oval_variables/variables/variable`.'
595 assert_exists 2 '/oval_variables/variables/variable[@datatype="string"]scip-shell filesystem . . `/oval_variables/variables/variable[@datatype="string"]`.'
596 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]`.'
597 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/valuescip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value`.'
598 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value[text()="600"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:1"]/value[text()="600"]`.'
599 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]scip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]`.'
600 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/valuescip-shell filesystem . . `/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/value`.'
601 assert_exists 1 '/oval_variables/variables/variable[@id="oval:com.example.www:var:2"]/value[text()="./'$file600'"]'
602 result="$oval_result"
603 assert_exists 1 '/oval_resultsscip-shell filesystem . . `/oval_results`.'
604 assert_exists 1 '/oval_results/resultsscip-shell filesystem . . `/oval_results/results`.'
605 assert_exists 1 '/oval_results/results/systemscip-shell filesystem . . `/oval_results/results/system`.'
606 assert_exists 1 '/oval_results/results/system/oval_system_characteristicsscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics`.'
607 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/generatorscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/generator`.'
608 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_infoscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_info`.'
609 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_datascip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data`.'
610 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/*scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/*`.'
611 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_itemscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item`.'
612 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(*) = 5]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(*) = 5]`.'
613 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(@*) = 2]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[count(@*) = 2]`.'
614 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[@status="exists"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item[@status="exists"]`.'
615 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filepath`.'
616 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:pathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:path`.'
617 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filenamescip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filename`.'
618 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filename[text()="'$file600'"]'
619 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:filename[text()="'$file300'"]'
620 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:xpathscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:xpath`.'
621 assert_exists 2 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_ofscip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of`.'
622 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="300"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="300"]`.'
623 assert_exists 1 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="600"]scip-shell filesystem . . `/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:xmlfilecontent_item/ind-sys:value_of[text()="600"]`.'
624 assert_exists 1 '/oval_results/results/system/testsscip-shell filesystem . . `/oval_results/results/system/tests`.'
625 assert_exists 3 '/oval_results/results/system/tests/testscip-shell filesystem . . `/oval_results/results/system/tests/test`.'
626 assert_exists 3 '/oval_results/results/system/tests/test[@version="1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@version="1"]`.'
627 assert_exists 3 '/oval_results/results/system/tests/test[@check="at least one"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@check="at least one"]`.'
628 assert_exists 2 '/oval_results/results/system/tests/test[count(*) = 3]scip-shell filesystem . . `/oval_results/results/system/tests/test[count(*) = 3]`.'
629
630 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]`.'
631 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="not evaluated"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1" and @result="not evaluated"]`.'
632 assert_exists 0 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]/*scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:1"]/*`.'
633 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"]`.'
634 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"][tested_item]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"][tested_item]`.'
635 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"][tested_item/@result = "true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2"][tested_item/@result = "true"]`.'
636 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @result="true"]`.'
637 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]`.'
638 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variablescip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable`.'
639 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:1"]`.'
640 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:1" and text() = "300"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:1" and text() = "300"]`.'
641 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:2"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:2"]`.'
642 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and not(@variable_instance)]/tested_variable[@variable_id="oval:com.example.www:var:2" and text() = "./'$file300'"]'
643 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]`.'
644 assert_exists 2 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variablescip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable`.'
645 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable[@variable_id="oval:com.example.www:var:1"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable[@variable_id="oval:com.example.www:var:1"]`.'
646 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable[@variable_id="oval:com.example.www:var:1" and text() = "600"]scip-shell filesystem . . `/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable[@variable_id="oval:com.example.www:var:1" and text() = "600"]`.'
647 assert_exists 1 '/oval_results/results/system/tests/test[@test_id="oval:com.example.www:tst:2" and @variable_instance="2"]/tested_variable[@variable_id="oval:com.example.www:var:2" and text() = "./'$file600'"]'
648 assert_exists 1 '/oval_results/results/system/definitionsscip-shell filesystem . . `/oval_results/results/system/definitions`.'
649 assert_exists 3 '/oval_results/results/system/definitions/*scip-shell filesystem . . `/oval_results/results/system/definitions/*`.'
650 assert_exists 3 '/oval_results/results/system/definitions/definitionscip-shell filesystem . . `/oval_results/results/system/definitions/definition`.'
651 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1"]`.'
652 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1" and not(@variable_instance)]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1" and not(@variable_instance)]`.'
653 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1" and @result="not evaluated"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:1" and @result="not evaluated"]`.'
654 assert_exists 2 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2"]`.'
655 assert_exists 2 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @result="true"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @result="true"]`.'
656 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @variable_instance="1"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @variable_instance="1"]`.'
657 assert_exists 1 '/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @variable_instance="2"]scip-shell filesystem . . `/oval_results/results/system/definitions/definition[@definition_id="oval:com.example.www:def:2" and @variable_instance="2"]`.'
658 assert_exists 3 '/oval_results/results/system/*scip-shell filesystem . . `/oval_results/results/system/*`.'
659 rmscip-shell system . . rm. $stderr
660 rmscip-shell system . . rm. $xccdf_result
661 rmscip-shell system . . rm. $oval_result
662 rmscip-shell system . . rm. $variables0
663 rmscip-shell system . . rm. $variables1
664 for f in $file300 $file600; do
665 chmodscip-shell system . . chmod. u+w $f ; rmscip-shell system . . rm. $f
666 done
667 }
668
669 test_init test_api_xccdf_variable_instance.log
670
671 test_run "Export from XCCDF to variables: 1x2 values (multival)" xccdf_export_1_multival
672 test_run "Export from XCCDF to variables: 2x1 values (multiset)" xccdf_export_2_multiset
673 test_run "Export from XCCDF to variables: 1x2 same vales (none)" xccdf_export_4_two_same
674 test_run "Export from XCCDF to variables: 2x1 same value (none)" xccdf_export_3_twice_same
675 test_run "Export from XCCDF to variables: 2x2 values (multiset,multival)" xccdf_export_6_multiset_multival
676 test_run "Export from XCCDF to variables: 2x2 same values (multival)" xccdf_export_5_multival_twice
677 test_run "Export from XCCDF to variables: 2x4 same shuffled values (multival)" xccdf_export_7_shuffled_multival
678 test_run "Export from XCCDF to variables: 2x4 same shuffled repeating values (multival)" xccdf_export_8_shuffled_multival
679 test_run "Export from XCCDF to variables: 3x3 the first is subset (multiset,multival)" xccdf_export_9_first_subset
680 test_run "Export from XCCDF to variables: 3x3 the last is subset (multiset,multival)" xccdf_export_A_second_subset
681
682 test_run "Evaluate XCCDF: 2x1 values (multiset)" xccdf_eval_2_multiset
683 test_run "Evaluate XCCDF: 2x1 values (multiset) in syschar" xccdf_eval_1_multiset_syschar
684
685 test_exit