Documentation ¶
Index ¶
Constants ¶
const ( // CopyStdinToStdoutSource is a small C++ program that just copies stdin to // stdout. CopyStdinToStdoutSource = `` /* 567-byte string literal not displayed */ // RunningStampFilename is the name of the file that is placed in a CI run // directory to indicate that it is still running. RunningStampFilename = ".running" )
Variables ¶
var ( // ErrSkipped is an error category which causes the CI run to be marked as // skipped (since the tests/tests.json file or the settings.json files were // missing). ErrSkipped = stderrors.New("not found") )
Functions ¶
This section is empty.
Types ¶
type LRUCache ¶
LRUCache is a base.LRUCache specialized for CI runs.
func NewLRUCache ¶
NewLRUCache returns a new LRUCache with the specified size limit.
func (*LRUCache) AddRun ¶
AddRun adds a run (which is a directory name with files) into the LRUCache.
func (*LRUCache) ReloadRuns ¶
ReloadRuns adds all CI runs that are in the ciRoot directory to the LRUCache.
type OutGeneratorConfig ¶ added in v1.2.11
type OutGeneratorConfig struct { Solution SolutionConfig Input *common.LiteralInput }
OutGeneratorConfig represents the configuration of the .out file generation.
func (*OutGeneratorConfig) String ¶ added in v1.2.11
func (c *OutGeneratorConfig) String() string
String implements the fmt.Stringer interface.
type Report ¶
type Report struct { Problem string `json:"problem"` CommitHash string `json:"commit_hash"` StartTime time.Time `json:"start_time"` FinishTime *time.Time `json:"finish_time,omitempty"` Duration *base.Duration `json:"duration,omitempty"` State State `json:"state"` ReportError *ReportError `json:"error,omitempty"` Tests []*ReportTest `json:"tests,omitempty"` }
Report represents the result of a CI run.
func (*Report) UpdateState ¶
func (r *Report) UpdateState()
UpdateState should be called when all of the tests have finished running.
type ReportError ¶ added in v1.2.10
type ReportError struct {
Error error
}
ReportError is a wrapper around error such that it can be marshaled to JSON.
func (*ReportError) MarshalText ¶ added in v1.2.10
func (s *ReportError) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface.
func (*ReportError) UnmarshalText ¶ added in v1.2.13
func (s *ReportError) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ReportTest ¶
type ReportTest struct { Index int `json:"index"` Type string `json:"type"` Filename string `json:"filename"` EphemeralToken string `json:"ephemeral_token,omitempty"` StartTime time.Time `json:"start_time"` FinishTime *time.Time `json:"finish_time,omitempty"` Duration *base.Duration `json:"duration,omitempty"` State State `json:"state"` ReportError *ReportError `json:"error,omitempty"` SolutionSetting *common.SolutionSettings `json:"solution,omitempty"` InputsValidatorSetting *common.InputsValidatorSettings `json:"inputs,omitempty"` Result *runner.RunResult `json:"result,omitempty"` }
ReportTest represents the result of an individual test case within the CI run.
func (*ReportTest) SetResult ¶
func (t *ReportTest) SetResult(result *runner.RunResult)
SetResult sets the result of running the test. It also updates the state of the test based on the verdict and score of the test.
func (*ReportTest) String ¶
func (t *ReportTest) String() string
String implements the fmt.Stringer interface.
type RunConfig ¶
type RunConfig struct { TestsSettings common.TestsSettings OutGeneratorConfig *OutGeneratorConfig TestConfigs []*TestConfig // Input is the common.LiteralInput shared by all the non-input-validator // TestConfigs. Input *common.LiteralInput }
RunConfig represents the configuration of a suite of tests that need to run for a problem.
func NewRunConfig ¶
func NewRunConfig(files common.ProblemFiles, generateOutputFiles bool) (*RunConfig, error)
NewRunConfig creates a RunConfig based on the contents of ProblemFiles.
type SolutionConfig ¶ added in v1.2.11
SolutionConfig represents the configuration of a solution.
func (*SolutionConfig) String ¶ added in v1.2.11
func (c *SolutionConfig) String() string
String implements the fmt.Stringer interface.
type State ¶
type State int
State represents the state of the CI run or any of the individual tests.
const ( // StateWaiting marks the run/test to be waiting for the processing queue // to pick it up. StateWaiting State = iota // StateRunning signals that the request has been taken off the queue and // is currently running. StateRunning // StateSkipped signals that the CI run did not even start running since // the requested commit was not set up for CI, either because // tests/tests.json or settings.json were missing. StateSkipped // StateError signals that the CI run is no longer running because an error // ocurred. StateError // StateFailed signals that the CI run has finished running and it failed. StateFailed // StatePassed signals that the CI run has finished running and it was // successful. StatePassed )
func (State) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (*State) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
type TestConfig ¶
type TestConfig struct { Test *ReportTest Solution SolutionConfig Input *common.LiteralInput }
TestConfig represents the configuration of a single test within a tests.json file.
func (*TestConfig) String ¶
func (c *TestConfig) String() string
String implements the fmt.Stringer interface.