1-- Copyright 2014 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_v3.sql
30-- Populates a v3 database with some test data.
31--
32-- This contains 5 test programs, each with one test case, and each
33-- reporting one of all possible result types.
34
35
36BEGIN TRANSACTION;
37
38
39-- context
40INSERT INTO contexts (cwd) VALUES ('/test/suite/root');
41INSERT INTO env_vars (var_name, var_value)
42    VALUES ('HOME', '/home/test');
43INSERT INTO env_vars (var_name, var_value)
44    VALUES ('PATH', '/bin:/usr/bin');
45
46-- metadata_id 1
47INSERT INTO metadatas VALUES (1, 'allowed_architectures', '');
48INSERT INTO metadatas VALUES (1, 'allowed_platforms', '');
49INSERT INTO metadatas VALUES (1, 'description', '');
50INSERT INTO metadatas VALUES (1, 'has_cleanup', 'false');
51INSERT INTO metadatas VALUES (1, 'required_configs', '');
52INSERT INTO metadatas VALUES (1, 'required_files', '');
53INSERT INTO metadatas VALUES (1, 'required_memory', '0');
54INSERT INTO metadatas VALUES (1, 'required_programs', '');
55INSERT INTO metadatas VALUES (1, 'required_user', '');
56INSERT INTO metadatas VALUES (1, 'timeout', '300');
57
58-- test_program_id 1
59INSERT INTO test_programs (test_program_id, absolute_path, root,
60                           relative_path, test_suite_name, metadata_id,
61                           interface)
62    VALUES (1, '/test/suite/root/foo_test', '/test/suite/root',
63            'foo_test', 'suite-name', 1, 'plain');
64
65-- test_case_id 1
66INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
67    VALUES (1, 1, 'main', 1);
68INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
69                          end_time)
70    VALUES (1, 'passed', NULL, 1357643611000000, 1357643621000500);
71
72-- metadata_id 2
73INSERT INTO metadatas VALUES (2, 'allowed_architectures', '');
74INSERT INTO metadatas VALUES (2, 'allowed_platforms', '');
75INSERT INTO metadatas VALUES (2, 'description', '');
76INSERT INTO metadatas VALUES (2, 'has_cleanup', 'false');
77INSERT INTO metadatas VALUES (2, 'required_configs', '');
78INSERT INTO metadatas VALUES (2, 'required_files', '');
79INSERT INTO metadatas VALUES (2, 'required_memory', '0');
80INSERT INTO metadatas VALUES (2, 'required_programs', '');
81INSERT INTO metadatas VALUES (2, 'required_user', '');
82INSERT INTO metadatas VALUES (2, 'timeout', '10');
83
84-- test_program_id 2
85INSERT INTO test_programs (test_program_id, absolute_path, root,
86                           relative_path, test_suite_name, metadata_id,
87                           interface)
88    VALUES (2, '/test/suite/root/subdir/another_test', '/test/suite/root',
89            'subdir/another_test', 'subsuite-name', 2, 'plain');
90
91-- test_case_id 2
92INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
93    VALUES (2, 2, 'main', 2);
94INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
95                          end_time)
96    VALUES (2, 'failed', 'Exited with code 1',
97            1357643622001200, 1357643622900021);
98
99-- file_id 1
100INSERT INTO files (file_id, contents) VALUES (1, x'54657374207374646f7574');
101INSERT INTO test_case_files (test_case_id, file_name, file_id)
102    VALUES (2, '__STDOUT__', 1);
103
104-- file_id 2
105INSERT INTO files (file_id, contents) VALUES (2, x'5465737420737464657272');
106INSERT INTO test_case_files (test_case_id, file_name, file_id)
107    VALUES (2, '__STDERR__', 2);
108
109-- metadata_id 3
110INSERT INTO metadatas VALUES (3, 'allowed_architectures', '');
111INSERT INTO metadatas VALUES (3, 'allowed_platforms', '');
112INSERT INTO metadatas VALUES (3, 'description', '');
113INSERT INTO metadatas VALUES (3, 'has_cleanup', 'false');
114INSERT INTO metadatas VALUES (3, 'required_configs', '');
115INSERT INTO metadatas VALUES (3, 'required_files', '');
116INSERT INTO metadatas VALUES (3, 'required_memory', '0');
117INSERT INTO metadatas VALUES (3, 'required_programs', '');
118INSERT INTO metadatas VALUES (3, 'required_user', '');
119INSERT INTO metadatas VALUES (3, 'timeout', '300');
120
121-- test_program_id 3
122INSERT INTO test_programs (test_program_id, absolute_path, root,
123                           relative_path, test_suite_name, metadata_id,
124                           interface)
125    VALUES (3, '/test/suite/root/subdir/bar_test', '/test/suite/root',
126            'subdir/bar_test', 'subsuite-name', 3, 'plain');
127
128-- test_case_id 3
129INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
130    VALUES (3, 3, 'main', 3);
131INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
132                          end_time)
133    VALUES (3, 'broken', 'Received signal 1',
134            1357643623500000, 1357643630981932);
135
136-- metadata_id 4
137INSERT INTO metadatas VALUES (4, 'allowed_architectures', '');
138INSERT INTO metadatas VALUES (4, 'allowed_platforms', '');
139INSERT INTO metadatas VALUES (4, 'description', '');
140INSERT INTO metadatas VALUES (4, 'has_cleanup', 'false');
141INSERT INTO metadatas VALUES (4, 'required_configs', '');
142INSERT INTO metadatas VALUES (4, 'required_files', '');
143INSERT INTO metadatas VALUES (4, 'required_memory', '0');
144INSERT INTO metadatas VALUES (4, 'required_programs', '');
145INSERT INTO metadatas VALUES (4, 'required_user', '');
146INSERT INTO metadatas VALUES (4, 'timeout', '300');
147
148-- test_program_id 4
149INSERT INTO test_programs (test_program_id, absolute_path, root,
150                           relative_path, test_suite_name, metadata_id,
151                           interface)
152    VALUES (4, '/test/suite/root/top_test', '/test/suite/root',
153            'top_test', 'suite-name', 4, 'plain');
154
155-- test_case_id 4
156INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
157    VALUES (4, 4, 'main', 4);
158INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
159                          end_time)
160    VALUES (4, 'expected_failure', 'Known bug',
161            1357643631000000, 1357643631020000);
162
163-- metadata_id 5
164INSERT INTO metadatas VALUES (5, 'allowed_architectures', '');
165INSERT INTO metadatas VALUES (5, 'allowed_platforms', '');
166INSERT INTO metadatas VALUES (5, 'description', '');
167INSERT INTO metadatas VALUES (5, 'has_cleanup', 'false');
168INSERT INTO metadatas VALUES (5, 'required_configs', '');
169INSERT INTO metadatas VALUES (5, 'required_files', '');
170INSERT INTO metadatas VALUES (5, 'required_memory', '0');
171INSERT INTO metadatas VALUES (5, 'required_programs', '');
172INSERT INTO metadatas VALUES (5, 'required_user', '');
173INSERT INTO metadatas VALUES (5, 'timeout', '300');
174
175-- test_program_id 5
176INSERT INTO test_programs (test_program_id, absolute_path, root,
177                           relative_path, test_suite_name, metadata_id,
178                           interface)
179    VALUES (5, '/test/suite/root/last_test', '/test/suite/root',
180            'last_test', 'suite-name', 5, 'plain');
181
182-- test_case_id 5
183INSERT INTO test_cases (test_case_id, test_program_id, name, metadata_id)
184    VALUES (5, 5, 'main', 5);
185INSERT INTO test_results (test_case_id, result_type, result_reason, start_time,
186                          end_time)
187    VALUES (5, 'skipped', 'Does not apply', 1357643632000000, 1357643638000000);
188
189
190COMMIT TRANSACTION;
191