xref: /freebsd/contrib/kyua/store/testdata_v1.sql (revision 911f0260390e18cf85f3dbf2c719b593efdc1e3c)
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_v1.sql
30-- Populates a v1 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-- test_program_id 1
67INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
68                           relative_path, test_suite_name, interface)
69    VALUES (1, 2, '/test/suite/root/foo_test', '/test/suite/root',
70            'foo_test', 'suite-name', 'plain');
71INSERT INTO plain_test_programs (test_program_id, timeout)
72    VALUES (1, 300000000);
73
74-- test_case_id 1
75INSERT INTO test_cases (test_case_id, test_program_id, name)
76    VALUES (1, 1, 'main');
77INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
78                          end_time)
79    VALUES (1, 'passed', NULL, 1357643611000000, 1357643621000500);
80
81-- test_program_id 2
82INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
83                           relative_path, test_suite_name, interface)
84    VALUES (2, 2, '/test/suite/root/subdir/another_test', '/test/suite/root',
85            'subdir/another_test', 'subsuite-name', 'plain');
86INSERT INTO plain_test_programs (test_program_id, timeout)
87    VALUES (2, 10000000);
88
89-- test_case_id 2
90INSERT INTO test_cases (test_case_id, test_program_id, name)
91    VALUES (2, 2, 'main');
92INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
93                          end_time)
94    VALUES (2, 'failed', 'Exited with code 1',
95            1357643622001200, 1357643622900021);
96
97-- file_id 1
98INSERT INTO files (file_id, contents) VALUES (1, x'54657374207374646f7574');
99INSERT INTO test_case_files (test_case_id, file_name, file_id)
100    VALUES (2, '__STDOUT__', 1);
101
102-- file_id 2
103INSERT INTO files (file_id, contents) VALUES (2, x'5465737420737464657272');
104INSERT INTO test_case_files (test_case_id, file_name, file_id)
105    VALUES (2, '__STDERR__', 2);
106
107-- test_program_id 3
108INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
109                           relative_path, test_suite_name, interface)
110    VALUES (3, 2, '/test/suite/root/subdir/bar_test', '/test/suite/root',
111            'subdir/bar_test', 'subsuite-name', 'plain');
112INSERT INTO plain_test_programs (test_program_id, timeout)
113    VALUES (3, 300000000);
114
115-- test_case_id 3
116INSERT INTO test_cases (test_case_id, test_program_id, name)
117    VALUES (3, 3, 'main');
118INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
119                          end_time)
120    VALUES (3, 'broken', 'Received signal 1',
121            1357643623500000, 1357643630981932);
122
123-- test_program_id 4
124INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
125                           relative_path, test_suite_name, interface)
126    VALUES (4, 2, '/test/suite/root/top_test', '/test/suite/root',
127            'top_test', 'suite-name', 'plain');
128INSERT INTO plain_test_programs (test_program_id, timeout)
129    VALUES (4, 300000000);
130
131-- test_case_id 4
132INSERT INTO test_cases (test_case_id, test_program_id, name)
133    VALUES (4, 4, 'main');
134INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
135                          end_time)
136    VALUES (4, 'expected_failure', 'Known bug',
137            1357643631000000, 1357643631020000);
138
139-- test_program_id 5
140INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
141                           relative_path, test_suite_name, interface)
142    VALUES (5, 2, '/test/suite/root/last_test', '/test/suite/root',
143            'last_test', 'suite-name', 'plain');
144INSERT INTO plain_test_programs (test_program_id, timeout)
145    VALUES (5, 300000000);
146
147-- test_case_id 5
148INSERT INTO test_cases (test_case_id, test_program_id, name)
149    VALUES (5, 5, 'main');
150INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
151                          end_time)
152    VALUES (5, 'skipped', 'Does not apply', 1357643632000000, 1357643638000000);
153
154
155--
156-- Action 3: ATF test programs only.
157--
158
159
160-- context_id 3
161INSERT INTO contexts (context_id, cwd) VALUES (3, '/usr/tests');
162INSERT INTO env_vars (context_id, var_name, var_value)
163    VALUES (3, 'PATH', '/bin:/usr/bin');
164
165-- action_id 3
166INSERT INTO actions (action_id, context_id) VALUES (3, 3);
167
168-- test_program_id 6
169INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
170                           relative_path, test_suite_name, interface)
171    VALUES (6, 3, '/usr/tests/complex_test', '/usr/tests',
172            'complex_test', 'suite-name', 'atf');
173
174-- test_case_id 6, passed, no optional metadata.
175INSERT INTO test_cases (test_case_id, test_program_id, name)
176    VALUES (6, 6, 'this_passes');
177INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
178                          end_time)
179    VALUES (6, 'passed', NULL, 1357648712000000, 1357648718000000);
180INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
181                            required_memory, required_user)
182    VALUES (6, NULL, 'false', 300000000, 0, NULL);
183
184-- test_case_id 7, failed, optional non-multivalue metadata.
185INSERT INTO test_cases (test_case_id, test_program_id, name)
186    VALUES (7, 6, 'this_fails');
187INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
188                          end_time)
189    VALUES (7, 'failed', 'Some reason', 1357648719000000, 1357648720897182);
190INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
191                            required_memory, required_user)
192    VALUES (7, 'Test description', 'true', 300000000, 128, 'root');
193
194-- test_case_id 8, skipped, all optional metadata.
195INSERT INTO test_cases (test_case_id, test_program_id, name)
196    VALUES (8, 6, 'this_skips');
197INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
198                          end_time)
199    VALUES (8, 'skipped', 'Another reason', 1357648729182013, 1357648730000000);
200INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
201                            required_memory, required_user)
202    VALUES (8, 'Test explanation', 'true', 600000000, 512, 'unprivileged');
203INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
204                                        property_value)
205    VALUES (8, 'require.arch', 'x86_64');
206INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
207                                        property_value)
208    VALUES (8, 'require.arch', 'powerpc');
209INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
210                                        property_value)
211    VALUES (8, 'require.machine', 'amd64');
212INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
213                                        property_value)
214    VALUES (8, 'require.machine', 'macppc');
215INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
216                                        property_value)
217    VALUES (8, 'require.config', 'unprivileged_user');
218INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
219                                        property_value)
220    VALUES (8, 'require.config', 'X-foo');
221INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
222                                        property_value)
223    VALUES (8, 'require.files', '/the/data/file');
224INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
225                                        property_value)
226    VALUES (8, 'require.progs', 'cp');
227INSERT INTO atf_test_cases_multivalues (test_case_id, property_name,
228                                        property_value)
229    VALUES (8, 'require.progs', '/bin/ls');
230
231-- file_id 3
232INSERT INTO files (file_id, contents)
233    VALUES (3, x'416e6f74686572207374646f7574');
234INSERT INTO test_case_files (test_case_id, file_name, file_id)
235    VALUES (8, '__STDOUT__', 3);
236
237-- test_program_id 7
238INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
239                           relative_path, test_suite_name, interface)
240    VALUES (7, 3, '/usr/tests/simple_test', '/usr/tests',
241            'simple_test', 'subsuite-name', 'atf');
242
243-- test_case_id 9
244INSERT INTO test_cases (test_case_id, test_program_id, name)
245    VALUES (9, 7, 'main');
246INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
247                          end_time)
248    VALUES (9, 'failed', 'Exited with code 1',
249            1357648740120000, 1357648750081700);
250INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
251                            required_memory, required_user)
252    VALUES (9, 'More text', 'true', 300000000, 128, 'unprivileged');
253
254-- file_id 4
255INSERT INTO files (file_id, contents)
256    VALUES (4, x'416e6f7468657220737464657272');
257INSERT INTO test_case_files (test_case_id, file_name, file_id)
258    VALUES (9, '__STDERR__', 4);
259
260
261--
262-- Action 4: Mixture of test programs.
263--
264
265
266-- context_id 4
267INSERT INTO contexts (context_id, cwd) VALUES (4, '/usr/tests');
268INSERT INTO env_vars (context_id, var_name, var_value)
269    VALUES (4, 'LANG', 'C');
270INSERT INTO env_vars (context_id, var_name, var_value)
271    VALUES (4, 'PATH', '/bin:/usr/bin');
272INSERT INTO env_vars (context_id, var_name, var_value)
273    VALUES (4, 'TERM', 'xterm');
274
275-- action_id 4
276INSERT INTO actions (action_id, context_id) VALUES (4, 4);
277
278-- test_program_id 8
279INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
280                           relative_path, test_suite_name, interface)
281    VALUES (8, 4, '/usr/tests/subdir/another_test', '/usr/tests',
282            'subdir/another_test', 'subsuite-name', 'plain');
283INSERT INTO plain_test_programs (test_program_id, timeout)
284    VALUES (8, 10000000);
285
286-- test_case_id 10
287INSERT INTO test_cases (test_case_id, test_program_id, name)
288    VALUES (10, 8, 'main');
289INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
290                          end_time)
291    VALUES (10, 'failed', 'Exit failure', 1357644395000000, 1357644396000000);
292
293-- file_id 5
294INSERT INTO files (file_id, contents) VALUES (5, x'54657374207374646f7574');
295INSERT INTO test_case_files (test_case_id, file_name, file_id)
296    VALUES (10, '__STDOUT__', 5);
297
298-- file_id 6
299INSERT INTO files (file_id, contents) VALUES (6, x'5465737420737464657272');
300INSERT INTO test_case_files (test_case_id, file_name, file_id)
301    VALUES (10, '__STDERR__', 6);
302
303-- test_program_id 9
304INSERT INTO test_programs (test_program_id, action_id, absolute_path, root,
305                           relative_path, test_suite_name, interface)
306    VALUES (9, 4, '/usr/tests/complex_test', '/usr/tests',
307            'complex_test', 'suite-name', 'atf');
308
309-- test_case_id 11
310INSERT INTO test_cases (test_case_id, test_program_id, name)
311    VALUES (11, 9, 'this_passes');
312INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
313                          end_time)
314    VALUES (11, 'passed', NULL, 1357644396500000, 1357644397000000);
315INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
316                            required_memory, required_user)
317    VALUES (11, NULL, 'false', 300000000, 0, NULL);
318
319-- test_case_id 12
320INSERT INTO test_cases (test_case_id, test_program_id, name)
321    VALUES (12, 9, 'this_fails');
322INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
323                          end_time)
324    VALUES (12, 'failed', 'Some reason', 1357644397100000, 1357644399005000);
325INSERT INTO atf_test_cases (test_case_id, description, has_cleanup, timeout,
326                            required_memory, required_user)
327    VALUES (12, 'Test description', 'false', 300000000, 0, 'root');
328
329
330COMMIT TRANSACTION;
331