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