-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
schema.go
271 lines (215 loc) · 11.6 KB
/
schema.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
// Copyright 2020 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package kcidb
// Kernel CI report data. To be submitted to/queried from the common report database.
//
// Objects in the data are identified and linked together using "id" and "*_id" string properties.
// Each value of these properties must start with a non-empty string identifying the CI system which
// submitted the object, followed by a colon ':' character. The rest of the string is generated by
// the origin CI system, and must identify that object uniquely among all objects of the same type,
// coming from that CI system.
//
// Any of the immediate properties (except "version") can be missing or be an empty list with each
// submission/query, but only complete data stored in the database should be considered valid.
//
// E.g. a test run referring to a non-existent build is allowed into/from the database,
// but would only appear in reports once both the build and its revision are present.
//
// No special meaning apart from "data is missing" is attached to any immediate or deeper properties being omitted,
// when they're not required, and no default values should be assumed for them.
// At the same time, no properties can be null.
//
// Extra free-form data can be stored under "misc" fields associated with various objects throughout the schema,
// if necessary. That data could later be used as the basis for defining new properties to house it.
type Kcidb struct {
Revisions []*Revision `json:"revisions,omitempty"`
Builds []*Build `json:"builds,omitempty"`
Tests []*Test `json:"tests,omitempty"`
Version *Version `json:"version"`
}
// A build of a revision.
type Build struct {
// Target architecture of the build.
Architecture string `json:"architecture,omitempty"`
// Full shell command line used to make the build, including environment variables.
Command string `json:"command,omitempty"`
// Name and version of the compiler used to make the build.
Compiler string `json:"compiler,omitempty"`
// A name describing the build configuration options.
ConfigName string `json:"config_name,omitempty"`
// The URL of the build configuration file.
ConfigURL string `json:"config_url,omitempty"`
// Human-readable description of the build.
Description string `json:"description,omitempty"`
// The number of seconds it took to complete the build.
Duration float64 `json:"duration,omitempty"`
// Build ID.
// Must start with a non-empty string identifying the CI system which submitted the build,
// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
// and must identify the build uniquely among all builds, coming from that CI system.
ID string `json:"id"`
// A list of build input files. E.g. configuration.
InputFiles []*Resource `json:"input_files,omitempty"`
// The URL of the build log file.
LogURL string `json:"log_url,omitempty"`
// Miscellaneous extra data about the build.
Misc *BuildMisc `json:"misc,omitempty"`
// The name of the CI system which submitted the build.
Origin string `json:"origin"`
// A list of build output files: images, packages, etc.
OutputFiles []*Resource `json:"output_files,omitempty"`
// ID of the built revision. The revision must be valid for the build to be considered valid.
RevisionID string `json:"revision_id"`
// The time the build was started.
StartTime string `json:"start_time,omitempty"`
// True if the build is valid, i.e. if it could be completed.
Valid bool `json:"valid"`
}
// Miscellaneous extra data about the build.
type BuildMisc struct {
OriginURL string `json:"origin_url,omitempty"`
ReportedBy string `json:"reported_by,omitempty"`
}
// The environment the test ran in. E.g. a host, a set of hosts, or a lab;
// amount of memory/storage/CPUs, for each host; process environment variables, etc.
type Environment struct {
// Human-readable description of the environment.
Description string `json:"description,omitempty"`
// Miscellaneous extra data about the environment.
Misc *EnvironmentMisc `json:"misc,omitempty"`
}
// Miscellaneous extra data about the environment.
type EnvironmentMisc struct {
}
// A revision of the tested code.
//
// Represents a way the tested source code could be obtained. E.g. checking out a particular commit from a git repo,
// and applying a set of patches on top.
type Revision struct {
// List of e-mail addresses of contacts concerned with this revision, such as authors, reviewers, and mail lists.
Contacts []string `json:"contacts,omitempty"`
// Human-readable description of the revision. E.g. a release version, or the subject of a patchset message.
Description string `json:"description,omitempty"`
// The time the revision was discovered by the CI system. E.g. the time the CI system found a patch message,
// or noticed a new commit or a new tag in a git repo.
DiscoveryTime string `json:"discovery_time,omitempty"`
// The full commit hash of the revision's base code.
GitCommitHash string `json:"git_commit_hash,omitempty"`
// A human-readable name of the commit containing the base code of the revision,
// as would be output by "git describe", at the discovery time.
GitCommitName string `json:"git_commit_name,omitempty"`
// The Git repository branch in which the commit with the revision's base code was discovered.
GitRepositoryBranch string `json:"git_repository_branch,omitempty"`
// The URL of the Git repository which contains the base code of the revision.
// The shortest possible https:// URL, or, if that's not available, the shortest possible git:// URL.
GitRepositoryURL string `json:"git_repository_url,omitempty"`
// Revision ID.
//
// Must contain the full commit hash of the revision's base code in the Git repository.
//
// If the revision had patches applied to the base code, the commit hash should be followed by the '+'
// character and a sha256 hash over newline-terminated sha256 hashes of each applied patch, in order.
// E.g. generated with this shell command: "sha256sum *.patch | cut -c-64 | sha256sum | cut -c-64".
ID string `json:"id"`
// The URL of the log file of the attempt to construct this revision from its parts. E.g. 'git am' output.
LogURL string `json:"log_url,omitempty"`
// The value of the Message-ID header of the e-mail message introducing this code revision,
// if any. E.g. a message with the revision's patchset, or a release announcement sent to a maillist.
MessageID string `json:"message_id,omitempty"`
// Miscellaneous extra data about the revision.
Misc *RevisionMisc `json:"misc,omitempty"`
// The name of the CI system which submitted the revision.
Origin string `json:"origin"`
// List of mboxes containing patches applied to the base code of the revision, in order of application.
PatchMboxes []*Resource `json:"patch_mboxes,omitempty"`
// The time the revision was made public. E.g. the timestamp on a patch message, a commit, or a tag.
PublishingTime string `json:"publishing_time,omitempty"`
// The widely-recognized name of the sub-tree (fork) of the main code tree that the revision belongs to.
TreeName string `json:"tree_name,omitempty"`
// True if the revision is valid, i.e. if its parts could be combined.
// False if not, e.g. if its patches failed to apply.
Valid bool `json:"valid"`
}
// Miscellaneous extra data about the revision.
type RevisionMisc struct {
}
// A test run against a build.
//
// Could represent a result of execution of a test suite program, a result of one of the tests done by the test
// suite program, as well as a summary of a collection of test suite results.
//
// Each test run should normally have a dot-separated test "path" specified in the "path" property,
// which could identify a specific test within a test suite (e.g. "LTPlite.sem01"), a whole test suite
// (e.g. "LTPlite"), or the summary of all tests for a build ( - the empty string).
type Test struct {
// ID of the tested build. The build must be valid for the test run to be considered valid.
BuildID string `json:"build_id"`
// Human-readable description of the test run.
Description string `json:"description,omitempty"`
// The number of seconds it took to run the test.
Duration float64 `json:"duration,omitempty"`
// The environment the test ran in. E.g. a host, a set of hosts, or a lab; amount of memory/storage/CPUs,
// for each host; process environment variables, etc.
Environment *Environment `json:"environment,omitempty"`
// ID of the test run.
// Must start with a non-empty string identifying the CI system which submitted the test run,
// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
// and must identify the test run uniquely among all test runs, coming from that CI system.
ID string `json:"id"`
// Miscellaneous extra data about the test run.
Misc *TestMisc `json:"misc,omitempty"`
// The name of the CI system which submitted the test run.
Origin string `json:"origin"`
// A list of test outputs: logs, dumps, etc.
OutputFiles []*Resource `json:"output_files,omitempty"`
// Dot-separated path to the node in the test classification tree the executed test belongs to.
// E.g. "ltp.sem01". The empty string signifies the root of the tree, i.e. all tests for the build,
// executed by the origin CI system.
Path string `json:"path,omitempty"`
// The time the test run was started.
StartTime string `json:"start_time,omitempty"`
// The test status string, one of the following. "ERROR" - the test is faulty, the status of the tested
// code is unknown.
// "FAIL" - the test has failed, the tested code is faulty.
// "PASS" - the test has passed, the tested code is correct.
// "DONE" - the test has finished successfully, the status of the tested code is unknown.
// "SKIP" - the test wasn't executed, the status of the tested code is unknown.
//
// The status names above are listed in priority order (highest to lowest), which could be used for producing
// a summary status for a collection of test runs, e.g. for all testing done on a build, based on results of
// executed test suites. The summary status would be the highest priority status across all test runs
// in a collection.
Status string `json:"status,omitempty"`
// True if the test status should be ignored.
// Could be used for reporting test results without affecting the overall test status and alerting
// the contacts concerned with the tested code revision. For example, for collecting test reliability
// statistics when the test is first introduced, or is being fixed.
Waived bool `json:"waived"`
}
// Miscellaneous extra data about the test.
type TestMisc struct {
OriginURL string `json:"origin_url,omitempty"`
ReportedBy string `json:"reported_by,omitempty"`
UserSpaceArch string `json:"user_space_arch,omitempty"`
CauseRevisionID string `json:"cause_revision_id,omitempty"`
}
// A named remote resource.
type Resource struct {
// Resource name. Must be usable as a local file name for the downloaded resource. Cannot be empty.
// Should not include directories.
Name string `json:"name"`
// Resource URL. Must point to the resource file directly, so it could be downloaded automatically.
URL string `json:"url"`
}
type Version struct {
// Major number of the schema version.
//
// Increases represent backward-incompatible changes. E.g. deleting or renaming a property,
// changing a property type, restricting values, making a property required, or adding a new required property.
Major int `json:"major"`
// Minor number of the schema version.
//
// Increases represent backward-compatible changes. E.g. relaxing value restrictions,
// making a property optional, or adding a new optional property.
Minor int `json:"minor"`
}