github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/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  	Checkouts []*Checkout `json:"checkouts,omitempty"`
    28  	Builds    []*Build    `json:"builds,omitempty"`
    29  	Tests     []*Test     `json:"tests,omitempty"`
    30  	Issues    []*Issue    `json:"issues,omitempty"`
    31  	Incidents []*Incident `json:"incidents,omitempty"`
    32  	Version   *Version    `json:"version"`
    33  }
    34  
    35  // A build of a checkout.
    36  type Build struct {
    37  	// The last time the build was updated in the database.
    38  	Timestamp string `json:"_timestamp,omitempty"`
    39  
    40  	// ID of the built source code checkout. The checkout must be valid for the build to be considered valid.
    41  	CheckoutID string `json:"checkout_id"`
    42  
    43  	// Build ID.
    44  	// Must start with a non-empty string identifying the CI system which submitted the build,
    45  	// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
    46  	// and must identify the build uniquely among all builds, coming from that CI system.
    47  	ID string `json:"id"`
    48  
    49  	// The name of the CI system which submitted the build.
    50  	Origin string `json:"origin"`
    51  
    52  	// A human-readable comment regarding the build.
    53  	Comment string `json:"comment,omitempty"`
    54  
    55  	// The time the build was started.
    56  	StartTime string `json:"start_time,omitempty"`
    57  
    58  	// The number of seconds it took to complete the build.
    59  	Duration float64 `json:"duration,omitempty"`
    60  
    61  	// Target architecture of the build.
    62  	Architecture string `json:"architecture,omitempty"`
    63  
    64  	// Full shell command line used to make the build, including environment variables.
    65  	Command string `json:"command,omitempty"`
    66  
    67  	// Name and version of the compiler used to make the build.
    68  	Compiler string `json:"compiler,omitempty"`
    69  
    70  	// A list of build input files. E.g. configuration.
    71  	InputFiles []*Resource `json:"input_files,omitempty"`
    72  
    73  	// A list of build output files: images, packages, etc.
    74  	OutputFiles []*Resource `json:"output_files,omitempty"`
    75  
    76  	// A name describing the build configuration options.
    77  	ConfigName string `json:"config_name,omitempty"`
    78  
    79  	// The URL of the build configuration file.
    80  	ConfigURL string `json:"config_url,omitempty"`
    81  
    82  	// The URL of the plain-text build log file.
    83  	LogURL string `json:"log_url,omitempty"`
    84  
    85  	// A part of the build log most relevant to its outcome.
    86  	LogExcerpt string `json:"log_excerpt,omitempty"`
    87  
    88  	// Build status: FAIL, ERROR, MISS, PASS, DONE, or SKIP.
    89  	Status string `json:"status,omitempty"`
    90  
    91  	// Miscellaneous extra data about the build.
    92  	Misc *BuildMisc `json:"misc,omitempty"`
    93  }
    94  
    95  // Miscellaneous extra data about the build.
    96  type BuildMisc struct {
    97  	OriginURL  string `json:"origin_url,omitempty"`
    98  	ReportedBy string `json:"reported_by,omitempty"`
    99  }
   100  
   101  // The environment the test ran in. E.g. a host, a set of hosts, or a lab;
   102  // amount of memory/storage/CPUs, for each host; process environment variables, etc.
   103  type Environment struct {
   104  	// The values from the root-level 'compatible' property of the system's device tree.
   105  	Compatible []string `json:"compatible,omitempty"`
   106  
   107  	// Human-readable comment of the environment.
   108  	Comment string `json:"comment,omitempty"`
   109  
   110  	// Miscellaneous extra data about the environment.
   111  	Misc *EnvironmentMisc `json:"misc,omitempty"`
   112  }
   113  
   114  // Miscellaneous extra data about the environment.
   115  type EnvironmentMisc struct {
   116  }
   117  
   118  // A checkout of the tested code.
   119  //
   120  // Represents a way the tested source code could be obtained. E.g. checking out a particular commit from a git repo,
   121  // and applying a set of patches on top.
   122  type Checkout struct {
   123  	// The last time the checkout was updated in the database.
   124  	Timestamp string `json:"_timestamp,omitempty"`
   125  
   126  	// Source code checkout ID.
   127  	// Must start with a non-empty string identifying the CI system which submitted the checkout,
   128  	// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
   129  	// and must identify the checkout uniquely among all checkouts, coming from that CI system.
   130  	ID string `json:"id"`
   131  
   132  	// The name of the CI system which submitted the checkout.
   133  	Origin string `json:"origin"`
   134  
   135  	// The widely-recognized name of the sub-tree (fork) of the main code tree where the checked out
   136  	// base source code came from.
   137  	TreeName string `json:"tree_name,omitempty"`
   138  
   139  	// The URL of the Git repository which contains the base code of the checkout. The shortest possible https:// URL.
   140  	GitRepositoryURL string `json:"git_repository_url,omitempty"`
   141  
   142  	// The full commit hash of the checked out base source code.
   143  	GitCommitHash string `json:"git_commit_hash,omitempty"`
   144  
   145  	// A human-readable name of the commit containing the checked out base source code, as would be
   146  	// output by "git describe", at the checkout time.
   147  	GitCommitName string `json:"git_commit_name,omitempty"`
   148  
   149  	// The list of (annotated) tags, found in the repository, pointing directly at the checked out commit.
   150  	GitCommitTags []string `json:"git_commit_tags,omitempty"`
   151  
   152  	// The complete message of the commit being checked out, both the subject and the body.
   153  	GitCommitMessage string `json:"git_commit_message,omitempty"`
   154  
   155  	// The Git repository branch from which the commit with the base source code was checked out.
   156  	GitRepositoryBranch string `json:"git_repository_branch,omitempty"`
   157  
   158  	// Whether the checked out commit was at the tip of the specified branch at checkout time.
   159  	GitRepositoryBranchTip bool `json:"git_repository_branch_tip,omitempty"`
   160  
   161  	// List of patch files applied to the checked out base source code, in order of application.
   162  	PatchsetFiles []*Resource `json:"patchset_files,omitempty"`
   163  
   164  	// The patchset hash. Empty if no patches were applied.
   165  	PatchsetHash string `json:"patchset_hash,omitempty"`
   166  
   167  	// The value of the Message-ID header of the e-mail message introducing the checkout, if any.
   168  	MessageID string `json:"message_id,omitempty"`
   169  
   170  	// A human-readable comment regarding the checkout. E.g. the checked out release version.
   171  	Comment string `json:"comment,omitempty"`
   172  
   173  	// The time the checkout was started.
   174  	StartTime string `json:"start_time,omitempty"`
   175  
   176  	// The time the checkout origin finished all planned builds for it.
   177  	OriginBuildsFinishTime string `json:"origin_builds_finish_time,omitempty"`
   178  
   179  	// The time the checkout origin finished all planned tests for it.
   180  	OriginTestsFinishTime string `json:"origin_tests_finish_time,omitempty"`
   181  
   182  	// The URL of a plain-text log file of the checkout attempt. E.g. 'git am' output.
   183  	LogURL string `json:"log_url,omitempty"`
   184  
   185  	// A part of the checkout log most relevant to its outcome.
   186  	LogExcerpt string `json:"log_excerpt,omitempty"`
   187  
   188  	// True if the checkout succeeded, i.e. if the source code parts could be combined.
   189  	// False if not, e.g. if the patches failed to apply.
   190  	Valid bool `json:"valid,omitempty"`
   191  
   192  	// Miscellaneous extra data about the checkout.
   193  	Misc *CheckoutMisc `json:"misc,omitempty"`
   194  }
   195  
   196  // Miscellaneous extra data about the checkout.
   197  type CheckoutMisc struct {
   198  }
   199  
   200  // A test run against a build.
   201  //
   202  // Could represent a result of execution of a test suite program, a result of one of the tests done by the test
   203  // suite program, as well as a summary of a collection of test suite results.
   204  //
   205  // Each test run should normally have a dot-separated test "path" specified in the "path" property,
   206  // which could identify a specific test within a test suite (e.g. "LTPlite.sem01"), a whole test suite
   207  // (e.g. "LTPlite"), or the summary of all tests for a build ( - the empty string).
   208  type Test struct {
   209  	// The last time the test was updated in the database.
   210  	Timestamp string `json:"_timestamp,omitempty"`
   211  
   212  	// ID of the tested build. The build must be valid for the test run to be considered valid.
   213  	BuildID string `json:"build_id"`
   214  
   215  	// ID of the test run.
   216  	// Must start with a non-empty string identifying the CI system which submitted the test run,
   217  	// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
   218  	// and must identify the test run uniquely among all test runs, coming from that CI system.
   219  	ID string `json:"id"`
   220  
   221  	// The name of the CI system which submitted the test run.
   222  	Origin string `json:"origin"`
   223  
   224  	// The environment the test ran in. E.g. a host, a set of hosts, or a lab; amount of memory/storage/CPUs,
   225  	// for each host; process environment variables, etc.
   226  	Environment *Environment `json:"environment,omitempty"`
   227  
   228  	// Dot-separated path to the node in the test classification tree the executed test belongs to.
   229  	// E.g. "ltp.sem01". The empty string signifies the root of the tree, i.e. all tests for the build,
   230  	// executed by the origin CI system.
   231  	Path string `json:"path,omitempty"`
   232  
   233  	// A human-readable comment regarding the test run.
   234  	Comment string `json:"comment,omitempty"`
   235  
   236  	// The URL of the plain-text test output or log file. If multiple outputs exist, this should point to the
   237  	// highest-level overview of the test's operation. The rest should go into output_files.
   238  	LogURL string `json:"log_url,omitempty"`
   239  
   240  	// A part of the test log most relevant to the test outcome.
   241  	LogExcerpt string `json:"log_excerpt,omitempty"`
   242  
   243  	// The test status string: FAIL, ERROR, MISS, PASS, DONE, or SKIP.
   244  	Status string `json:"status,omitempty"`
   245  
   246  	// The numerical output produced by the test, if any.
   247  	Number *TestNumber `json:"number,omitempty"`
   248  
   249  	// The time the test run was started.
   250  	StartTime string `json:"start_time,omitempty"`
   251  
   252  	// The number of seconds it took to run the test.
   253  	Duration float64 `json:"duration,omitempty"`
   254  
   255  	// Test input files (rootfs, initramfs, etc.).
   256  	InputFiles []*Resource `json:"input_files,omitempty"`
   257  
   258  	// A list of test outputs: logs, dumps, etc. Except the file referenced by log_url.
   259  	OutputFiles []*Resource `json:"output_files,omitempty"`
   260  
   261  	// Miscellaneous extra data about the test run.
   262  	Misc *TestMisc `json:"misc,omitempty"`
   263  }
   264  
   265  // The numerical output produced by a test run.
   266  type TestNumber struct {
   267  	// The floating-point output value.
   268  	Value float64 `json:"value"`
   269  
   270  	// The (compound) unit symbols the value is measured in.
   271  	Unit string `json:"unit,omitempty"`
   272  
   273  	// The type of prefix to add to the unit when displaying the value: "metric" or "binary".
   274  	Prefix string `json:"prefix,omitempty"`
   275  }
   276  
   277  // Miscellaneous extra data about the test.
   278  type TestMisc struct {
   279  	OriginURL       string `json:"origin_url,omitempty"`
   280  	ReportedBy      string `json:"reported_by,omitempty"`
   281  	UserSpaceArch   string `json:"user_space_arch,omitempty"`
   282  	CauseRevisionID string `json:"cause_revision_id,omitempty"`
   283  }
   284  
   285  // A named remote resource.
   286  type Resource struct {
   287  	// Resource name. Must be usable as a local file name for the downloaded resource. Cannot be empty.
   288  	// Should not include directories.
   289  	Name string `json:"name"`
   290  
   291  	// Resource URL. Must point to the resource file directly, so it could be downloaded automatically.
   292  	URL string `json:"url"`
   293  }
   294  
   295  type Version struct {
   296  	// Major number of the schema version.
   297  	//
   298  	// Increases represent backward-incompatible changes. E.g. deleting or renaming a property,
   299  	// changing a property type, restricting values, making a property required, or adding a new required property.
   300  	Major int `json:"major"`
   301  
   302  	// Minor number of the schema version.
   303  	//
   304  	// Increases represent backward-compatible changes. E.g. relaxing value restrictions,
   305  	// making a property optional, or adding a new optional property.
   306  	Minor int `json:"minor,omitempty"`
   307  }
   308  
   309  // An issue found in reports.
   310  type Issue struct {
   311  	// The last time the issue was updated in the database.
   312  	Timestamp string `json:"_timestamp,omitempty"`
   313  
   314  	// Issue ID.
   315  	// Must start with a non-empty string identifying the CI system which submitted the issue,
   316  	// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
   317  	// and must identify the issue uniquely among all issues, coming from that CI system.
   318  	ID string `json:"id"`
   319  
   320  	// The modification version number of the issue. Only the highest-numbered version is used for triaging.
   321  	Version int `json:"version"`
   322  
   323  	// The name of the CI system which submitted the issue.
   324  	Origin string `json:"origin"`
   325  
   326  	// Dot-separated paths pointing to nodes in the categorization tree the issue belongs to.
   327  	Categories []string `json:"categories,omitempty"`
   328  
   329  	// The URL of a report describing the issue.
   330  	ReportURL string `json:"report_url,omitempty"`
   331  
   332  	// The subject of the report describing the issue.
   333  	ReportSubject string `json:"report_subject,omitempty"`
   334  
   335  	// Layers of the execution stack responsible for the issue. If all are false, the issue is considered invalid.
   336  	Culprit *IssueCulprit `json:"culprit,omitempty"`
   337  
   338  	// A human-readable comment regarding the issue. E.g. a brief description, or a report subject.
   339  	Comment string `json:"comment,omitempty"`
   340  
   341  	// Miscellaneous extra data about the issue.
   342  	Misc *IssueMisc `json:"misc,omitempty"`
   343  }
   344  
   345  // The layers responsible for an issue.
   346  type IssueCulprit struct {
   347  	// The built/tested code.
   348  	Code bool `json:"code,omitempty"`
   349  
   350  	// The tool - the static analyzer, the build toolchain, the test, etc.
   351  	Tool bool `json:"tool,omitempty"`
   352  
   353  	// The harness - the system controlling the execution of the build/test.
   354  	Harness bool `json:"harness,omitempty"`
   355  }
   356  
   357  // Miscellaneous extra data about the issue.
   358  type IssueMisc struct {
   359  }
   360  
   361  // An incident - an issue occurrence/absence.
   362  type Incident struct {
   363  	// The last time the incident was updated in the database.
   364  	Timestamp string `json:"_timestamp,omitempty"`
   365  
   366  	// Incident ID.
   367  	// Must start with a non-empty string identifying the CI system which submitted the incident,
   368  	// followed by a colon ':' character. The rest of the string is generated by the origin CI system,
   369  	// and must identify the incident uniquely among all incidents, coming from that CI system.
   370  	ID string `json:"id"`
   371  
   372  	// The name of the CI system which submitted the incident.
   373  	Origin string `json:"origin"`
   374  
   375  	// The ID of the occurring/absent issue.
   376  	IssueID string `json:"issue_id"`
   377  
   378  	// The modification version number of the occurring/absent issue.
   379  	IssueVersion int `json:"issue_version"`
   380  
   381  	// The ID of the build object exhibiting/missing the issue.
   382  	BuildID string `json:"build_id,omitempty"`
   383  
   384  	// The ID of the test object exhibiting/missing the issue.
   385  	TestID string `json:"test_id,omitempty"`
   386  
   387  	// True if the issue occurred in the linked objects. False if it was absent.
   388  	Present bool `json:"present,omitempty"`
   389  
   390  	// A human-readable comment regarding the incident.
   391  	Comment string `json:"comment,omitempty"`
   392  
   393  	// Miscellaneous extra data about the incident.
   394  	Misc *IncidentMisc `json:"misc,omitempty"`
   395  }
   396  
   397  // Miscellaneous extra data about the incident.
   398  type IncidentMisc struct {
   399  }