xref: /freebsd/contrib/kyua/store/testdata_v2.sql (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1-- Copyright 2013 The Kyua Authors.
2-- All rights reserved.
3--
4-- Redistribution and use in source and binary forms, with or without
5-- modification, are permitted provided that the following conditions are
6-- met:
7--
8-- * Redistributions of source code must retain the above copyright
9--   notice, this list of conditions and the following disclaimer.
10-- * Redistributions in binary form must reproduce the above copyright
11--   notice, this list of conditions and the following disclaimer in the
12--   documentation and/or other materials provided with the distribution.
13-- * Neither the name of Google Inc. nor the names of its contributors
14--   may be used to endorse or promote products derived from this software
15--   without specific prior written permission.
16--
17-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21-- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29-- \file store/testdata_v2.sql
30-- Populates a v2 database with some test data.
31
32
33BEGIN TRANSACTION;
34
35
36--
37-- Action 1: Empty context and no test programs nor test cases.
38--
39
40
41-- context_id 1
42INSERT INTO contexts (context_id, cwd) VALUES (1, '/some/root');
43
44-- action_id 1
45INSERT INTO actions (action_id, context_id) VALUES (1, 1);
46
47
48--
49-- Action 2: Plain test programs only.
50--
51-- This action contains 5 test programs, each with one test case, and each
52-- reporting one of all possible result types.
53--
54
55
56-- context_id 2
57INSERT INTO contexts (context_id, cwd) VALUES (2, '/test/suite/root');
58INSERT INTO env_vars (context_id, var_name, var_value)
59    VALUES (2, 'HOME', '/home/test');
60INSERT INTO env_vars (context_id, var_name, var_value)
61    VALUES (2, 'PATH', '/bin:/usr/bin');
62
63-- action_id 2
64INSERT INTO actions (action_id, context_id) VALUES (2, 2);
65
66-- metadata_id 1
67INSERT INTO metadatas VALUES (1, 'allowed_architectures', '');
68INSERT INTO metadatas VALUES (1, 'allowed_platforms', '');
69INSERT INTO metadatas VALUES (1, 'description', '');
70INSERT INTO metadatas VALUES (1, 'has_cleanup', 'false');
71INSERT INTO metadatas VALUES (1, 'required_configs', '');
72INSERT INTO metadatas VALUES (1, 'required_files', '');
73INSERT INTO metadatas VALUES (1, 'required_memory', '0');
74INSERT INTO metadatas VALUES (1, 'required_programs', '');
75INSERT INTO metadatas VALUES (1, 'required_user', '');
76INSERT INTO metadatas VALUES (1, 'timeout', '300');
77
78-- test_program_id 1
79INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
80                           relative_path, test_suite_name, metadata_id,
81                           interface)
82    VALUES (1, 2, '/test/suite/root/foo_test', '/test/suite/root',
83            'foo_test', 'suite-name', 1, 'plain');
84
85-- test_case_id 1
86INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
87    VALUES (1, 1, 'main', 1);
88INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
89                          end_time)
90    VALUES (1, 'passed', NULL, 1357643611000000, 1357643621000500);
91
92-- metadata_id 2
93INSERT INTO metadatas VALUES (2, 'allowed_architectures', '');
94INSERT INTO metadatas VALUES (2, 'allowed_platforms', '');
95INSERT INTO metadatas VALUES (2, 'description', '');
96INSERT INTO metadatas VALUES (2, 'has_cleanup', 'false');
97INSERT INTO metadatas VALUES (2, 'required_configs', '');
98INSERT INTO metadatas VALUES (2, 'required_files', '');
99INSERT INTO metadatas VALUES (2, 'required_memory', '0');
100INSERT INTO metadatas VALUES (2, 'required_programs', '');
101INSERT INTO metadatas VALUES (2, 'required_user', '');
102INSERT INTO metadatas VALUES (2, 'timeout', '10');
103
104-- test_program_id 2
105INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
106                           relative_path, test_suite_name, metadata_id,
107                           interface)
108    VALUES (2, 2, '/test/suite/root/subdir/another_test', '/test/suite/root',
109            'subdir/another_test', 'subsuite-name', 2, 'plain');
110
111-- test_case_id 2
112INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
113    VALUES (2, 2, 'main', 2);
114INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
115                          end_time)
116    VALUES (2, 'failed', 'Exited with code 1',
117            1357643622001200, 1357643622900021);
118
119-- file_id 1
120INSERT INTO files (file_id, contents) VALUES (1, x'54657374207374646f7574');
121INSERT INTO test_case_files (test_case_id, file_name, file_id)
122    VALUES (2, '__STDOUT__', 1);
123
124-- file_id 2
125INSERT INTO files (file_id, contents) VALUES (2, x'5465737420737464657272');
126INSERT INTO test_case_files (test_case_id, file_name, file_id)
127    VALUES (2, '__STDERR__', 2);
128
129-- metadata_id 3
130INSERT INTO metadatas VALUES (3, 'allowed_architectures', '');
131INSERT INTO metadatas VALUES (3, 'allowed_platforms', '');
132INSERT INTO metadatas VALUES (3, 'description', '');
133INSERT INTO metadatas VALUES (3, 'has_cleanup', 'false');
134INSERT INTO metadatas VALUES (3, 'required_configs', '');
135INSERT INTO metadatas VALUES (3, 'required_files', '');
136INSERT INTO metadatas VALUES (3, 'required_memory', '0');
137INSERT INTO metadatas VALUES (3, 'required_programs', '');
138INSERT INTO metadatas VALUES (3, 'required_user', '');
139INSERT INTO metadatas VALUES (3, 'timeout', '300');
140
141-- test_program_id 3
142INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
143                           relative_path, test_suite_name, metadata_id,
144                           interface)
145    VALUES (3, 2, '/test/suite/root/subdir/bar_test', '/test/suite/root',
146            'subdir/bar_test', 'subsuite-name', 3, 'plain');
147
148-- test_case_id 3
149INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
150    VALUES (3, 3, 'main', 3);
151INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
152                          end_time)
153    VALUES (3, 'broken', 'Received signal 1',
154            1357643623500000, 1357643630981932);
155
156-- metadata_id 4
157INSERT INTO metadatas VALUES (4, 'allowed_architectures', '');
158INSERT INTO metadatas VALUES (4, 'allowed_platforms', '');
159INSERT INTO metadatas VALUES (4, 'description', '');
160INSERT INTO metadatas VALUES (4, 'has_cleanup', 'false');
161INSERT INTO metadatas VALUES (4, 'required_configs', '');
162INSERT INTO metadatas VALUES (4, 'required_files', '');
163INSERT INTO metadatas VALUES (4, 'required_memory', '0');
164INSERT INTO metadatas VALUES (4, 'required_programs', '');
165INSERT INTO metadatas VALUES (4, 'required_user', '');
166INSERT INTO metadatas VALUES (4, 'timeout', '300');
167
168-- test_program_id 4
169INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
170                           relative_path, test_suite_name, metadata_id,
171                           interface)
172    VALUES (4, 2, '/test/suite/root/top_test', '/test/suite/root',
173            'top_test', 'suite-name', 4, 'plain');
174
175-- test_case_id 4
176INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
177    VALUES (4, 4, 'main', 4);
178INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
179                          end_time)
180    VALUES (4, 'expected_failure', 'Known bug',
181            1357643631000000, 1357643631020000);
182
183-- metadata_id 5
184INSERT INTO metadatas VALUES (5, 'allowed_architectures', '');
185INSERT INTO metadatas VALUES (5, 'allowed_platforms', '');
186INSERT INTO metadatas VALUES (5, 'description', '');
187INSERT INTO metadatas VALUES (5, 'has_cleanup', 'false');
188INSERT INTO metadatas VALUES (5, 'required_configs', '');
189INSERT INTO metadatas VALUES (5, 'required_files', '');
190INSERT INTO metadatas VALUES (5, 'required_memory', '0');
191INSERT INTO metadatas VALUES (5, 'required_programs', '');
192INSERT INTO metadatas VALUES (5, 'required_user', '');
193INSERT INTO metadatas VALUES (5, 'timeout', '300');
194
195-- test_program_id 5
196INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
197                           relative_path, test_suite_name, metadata_id,
198                           interface)
199    VALUES (5, 2, '/test/suite/root/last_test', '/test/suite/root',
200            'last_test', 'suite-name', 5, 'plain');
201
202-- test_case_id 5
203INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
204    VALUES (5, 5, 'main', 5);
205INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
206                          end_time)
207    VALUES (5, 'skipped', 'Does not apply', 1357643632000000, 1357643638000000);
208
209
210--
211-- Action 3: ATF test programs only.
212--
213
214
215-- context_id 3
216INSERT INTO contexts (context_id, cwd) VALUES (3, '/usr/tests');
217INSERT INTO env_vars (context_id, var_name, var_value)
218    VALUES (3, 'PATH', '/bin:/usr/bin');
219
220-- action_id 3
221INSERT INTO actions (action_id, context_id) VALUES (3, 3);
222
223-- metadata_id 6
224INSERT INTO metadatas VALUES (6, 'allowed_architectures', '');
225INSERT INTO metadatas VALUES (6, 'allowed_platforms', '');
226INSERT INTO metadatas VALUES (6, 'description', '');
227INSERT INTO metadatas VALUES (6, 'has_cleanup', 'false');
228INSERT INTO metadatas VALUES (6, 'required_configs', '');
229INSERT INTO metadatas VALUES (6, 'required_files', '');
230INSERT INTO metadatas VALUES (6, 'required_memory', '0');
231INSERT INTO metadatas VALUES (6, 'required_programs', '');
232INSERT INTO metadatas VALUES (6, 'required_user', '');
233INSERT INTO metadatas VALUES (6, 'timeout', '300');
234
235-- test_program_id 6
236INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
237                           relative_path, test_suite_name, metadata_id,
238                           interface)
239    VALUES (6, 3, '/usr/tests/complex_test', '/usr/tests',
240            'complex_test', 'suite-name', 6, 'atf');
241
242-- metadata_id 7
243INSERT INTO metadatas VALUES (7, 'allowed_architectures', '');
244INSERT INTO metadatas VALUES (7, 'allowed_platforms', '');
245INSERT INTO metadatas VALUES (7, 'description', '');
246INSERT INTO metadatas VALUES (7, 'has_cleanup', 'false');
247INSERT INTO metadatas VALUES (7, 'required_configs', '');
248INSERT INTO metadatas VALUES (7, 'required_files', '');
249INSERT INTO metadatas VALUES (7, 'required_memory', '0');
250INSERT INTO metadatas VALUES (7, 'required_programs', '');
251INSERT INTO metadatas VALUES (7, 'required_user', '');
252INSERT INTO metadatas VALUES (7, 'timeout', '300');
253
254-- test_case_id 6, passed, no optional metadata.
255INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
256    VALUES (6, 6, 'this_passes', 7);
257INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
258                          end_time)
259    VALUES (6, 'passed', NULL, 1357648712000000, 1357648718000000);
260
261-- metadata_id 8
262INSERT INTO metadatas VALUES (8, 'allowed_architectures', '');
263INSERT INTO metadatas VALUES (8, 'allowed_platforms', '');
264INSERT INTO metadatas VALUES (8, 'description', 'Test description');
265INSERT INTO metadatas VALUES (8, 'has_cleanup', 'true');
266INSERT INTO metadatas VALUES (8, 'required_configs', '');
267INSERT INTO metadatas VALUES (8, 'required_files', '');
268INSERT INTO metadatas VALUES (8, 'required_memory', '128');
269INSERT INTO metadatas VALUES (8, 'required_programs', '');
270INSERT INTO metadatas VALUES (8, 'required_user', 'root');
271INSERT INTO metadatas VALUES (8, 'timeout', '300');
272
273-- test_case_id 7, failed, optional non-multivalue metadata.
274INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
275    VALUES (7, 6, 'this_fails', 8);
276INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
277                          end_time)
278    VALUES (7, 'failed', 'Some reason', 1357648719000000, 1357648720897182);
279
280-- metadata_id 9
281INSERT INTO metadatas VALUES (9, 'allowed_architectures', 'powerpc x86_64');
282INSERT INTO metadatas VALUES (9, 'allowed_platforms', 'amd64 macppc');
283INSERT INTO metadatas VALUES (9, 'description', 'Test explanation');
284INSERT INTO metadatas VALUES (9, 'has_cleanup', 'true');
285INSERT INTO metadatas VALUES (9, 'required_configs', 'unprivileged_user X-foo');
286INSERT INTO metadatas VALUES (9, 'required_files', '/the/data/file');
287INSERT INTO metadatas VALUES (9, 'required_memory', '512');
288INSERT INTO metadatas VALUES (9, 'required_programs', 'cp /bin/ls');
289INSERT INTO metadatas VALUES (9, 'required_user', 'unprivileged');
290INSERT INTO metadatas VALUES (9, 'timeout', '600');
291
292-- test_case_id 8, skipped, all optional metadata.
293INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
294    VALUES (8, 6, 'this_skips', 9);
295INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
296                          end_time)
297    VALUES (8, 'skipped', 'Another reason', 1357648729182013, 1357648730000000);
298
299-- file_id 3
300INSERT INTO files (file_id, contents)
301    VALUES (3, x'416e6f74686572207374646f7574');
302INSERT INTO test_case_files (test_case_id, file_name, file_id)
303    VALUES (8, '__STDOUT__', 3);
304
305-- metadata_id 10
306INSERT INTO metadatas VALUES (10, 'allowed_architectures', '');
307INSERT INTO metadatas VALUES (10, 'allowed_platforms', '');
308INSERT INTO metadatas VALUES (10, 'description', '');
309INSERT INTO metadatas VALUES (10, 'has_cleanup', 'false');
310INSERT INTO metadatas VALUES (10, 'required_configs', '');
311INSERT INTO metadatas VALUES (10, 'required_files', '');
312INSERT INTO metadatas VALUES (10, 'required_memory', '0');
313INSERT INTO metadatas VALUES (10, 'required_programs', '');
314INSERT INTO metadatas VALUES (10, 'required_user', '');
315INSERT INTO metadatas VALUES (10, 'timeout', '300');
316
317-- test_program_id 7
318INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
319                           relative_path, test_suite_name, metadata_id,
320                           interface)
321    VALUES (7, 3, '/usr/tests/simple_test', '/usr/tests',
322            'simple_test', 'subsuite-name', 10, 'atf');
323
324-- metadata_id 11
325INSERT INTO metadatas VALUES (11, 'allowed_architectures', '');
326INSERT INTO metadatas VALUES (11, 'allowed_platforms', '');
327INSERT INTO metadatas VALUES (11, 'description', 'More text');
328INSERT INTO metadatas VALUES (11, 'has_cleanup', 'true');
329INSERT INTO metadatas VALUES (11, 'required_configs', '');
330INSERT INTO metadatas VALUES (11, 'required_files', '');
331INSERT INTO metadatas VALUES (11, 'required_memory', '128');
332INSERT INTO metadatas VALUES (11, 'required_programs', '');
333INSERT INTO metadatas VALUES (11, 'required_user', 'unprivileged');
334INSERT INTO metadatas VALUES (11, 'timeout', '300');
335
336-- test_case_id 9
337INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
338    VALUES (9, 7, 'main', 11);
339INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
340                          end_time)
341    VALUES (9, 'failed', 'Exited with code 1',
342            1357648740120000, 1357648750081700);
343
344-- file_id 4
345INSERT INTO files (file_id, contents)
346    VALUES (4, x'416e6f7468657220737464657272');
347INSERT INTO test_case_files (test_case_id, file_name, file_id)
348    VALUES (9, '__STDERR__', 4);
349
350
351--
352-- Action 4: Mixture of test programs.
353--
354
355
356-- context_id 4
357INSERT INTO contexts (context_id, cwd) VALUES (4, '/usr/tests');
358INSERT INTO env_vars (context_id, var_name, var_value)
359    VALUES (4, 'LANG', 'C');
360INSERT INTO env_vars (context_id, var_name, var_value)
361    VALUES (4, 'PATH', '/bin:/usr/bin');
362INSERT INTO env_vars (context_id, var_name, var_value)
363    VALUES (4, 'TERM', 'xterm');
364
365-- action_id 4
366INSERT INTO actions (action_id, context_id) VALUES (4, 4);
367
368-- metadata_id 12
369INSERT INTO metadatas VALUES (12, 'allowed_architectures', '');
370INSERT INTO metadatas VALUES (12, 'allowed_platforms', '');
371INSERT INTO metadatas VALUES (12, 'description', '');
372INSERT INTO metadatas VALUES (12, 'has_cleanup', 'false');
373INSERT INTO metadatas VALUES (12, 'required_configs', '');
374INSERT INTO metadatas VALUES (12, 'required_files', '');
375INSERT INTO metadatas VALUES (12, 'required_memory', '0');
376INSERT INTO metadatas VALUES (12, 'required_programs', '');
377INSERT INTO metadatas VALUES (12, 'required_user', '');
378INSERT INTO metadatas VALUES (12, 'timeout', '10');
379
380-- test_program_id 8
381INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
382                           relative_path, test_suite_name, metadata_id,
383                           interface)
384    VALUES (8, 4, '/usr/tests/subdir/another_test', '/usr/tests',
385            'subdir/another_test', 'subsuite-name', 12, 'plain');
386
387-- test_case_id 10
388INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
389    VALUES (10, 8, 'main', 12);
390INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
391                          end_time)
392    VALUES (10, 'failed', 'Exit failure', 1357644395000000, 1357644396000000);
393
394-- file_id 5
395INSERT INTO files (file_id, contents) VALUES (5, x'54657374207374646f7574');
396INSERT INTO test_case_files (test_case_id, file_name, file_id)
397    VALUES (10, '__STDOUT__', 5);
398
399-- file_id 6
400INSERT INTO files (file_id, contents) VALUES (6, x'5465737420737464657272');
401INSERT INTO test_case_files (test_case_id, file_name, file_id)
402    VALUES (10, '__STDERR__', 6);
403
404-- metadata_id 13
405INSERT INTO metadatas VALUES (13, 'allowed_architectures', '');
406INSERT INTO metadatas VALUES (13, 'allowed_platforms', '');
407INSERT INTO metadatas VALUES (13, 'description', '');
408INSERT INTO metadatas VALUES (13, 'has_cleanup', 'false');
409INSERT INTO metadatas VALUES (13, 'required_configs', '');
410INSERT INTO metadatas VALUES (13, 'required_files', '');
411INSERT INTO metadatas VALUES (13, 'required_memory', '0');
412INSERT INTO metadatas VALUES (13, 'required_programs', '');
413INSERT INTO metadatas VALUES (13, 'required_user', '');
414INSERT INTO metadatas VALUES (13, 'timeout', '300');
415
416-- test_program_id 9
417INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
418                           relative_path, test_suite_name, metadata_id,
419                           interface)
420    VALUES (9, 4, '/usr/tests/complex_test', '/usr/tests',
421            'complex_test', 'suite-name', 14, 'atf');
422
423-- metadata_id 15
424INSERT INTO metadatas VALUES (15, 'allowed_architectures', '');
425INSERT INTO metadatas VALUES (15, 'allowed_platforms', '');
426INSERT INTO metadatas VALUES (15, 'description', '');
427INSERT INTO metadatas VALUES (15, 'has_cleanup', 'false');
428INSERT INTO metadatas VALUES (15, 'required_configs', '');
429INSERT INTO metadatas VALUES (15, 'required_files', '');
430INSERT INTO metadatas VALUES (15, 'required_memory', '0');
431INSERT INTO metadatas VALUES (15, 'required_programs', '');
432INSERT INTO metadatas VALUES (15, 'required_user', '');
433INSERT INTO metadatas VALUES (15, 'timeout', '300');
434
435-- test_case_id 11
436INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
437    VALUES (11, 9, 'this_passes', 15);
438INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
439                          end_time)
440    VALUES (11, 'passed', NULL, 1357644396500000, 1357644397000000);
441
442-- metadata_id 16
443INSERT INTO metadatas VALUES (16, 'allowed_architectures', '');
444INSERT INTO metadatas VALUES (16, 'allowed_platforms', '');
445INSERT INTO metadatas VALUES (16, 'description', 'Test description');
446INSERT INTO metadatas VALUES (16, 'has_cleanup', 'false');
447INSERT INTO metadatas VALUES (16, 'required_configs', '');
448INSERT INTO metadatas VALUES (16, 'required_files', '');
449INSERT INTO metadatas VALUES (16, 'required_memory', '0');
450INSERT INTO metadatas VALUES (16, 'required_programs', '');
451INSERT INTO metadatas VALUES (16, 'required_user', 'root');
452INSERT INTO metadatas VALUES (16, 'timeout', '300');
453
454-- test_case_id 12
455INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
456    VALUES (12, 9, 'this_fails', 16);
457INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
458                          end_time)
459    VALUES (12, 'failed', 'Some reason', 1357644397100000, 1357644399005000);
460
461
462COMMIT TRANSACTION;
463