1ba991379Sopenharmony_ci/*
2ba991379Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3ba991379Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4ba991379Sopenharmony_ci * you may not use this file except in compliance with the License.
5ba991379Sopenharmony_ci * You may obtain a copy of the License at
6ba991379Sopenharmony_ci *
7ba991379Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8ba991379Sopenharmony_ci *
9ba991379Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10ba991379Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11ba991379Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12ba991379Sopenharmony_ci * See the License for the specific language governing permissions and
13ba991379Sopenharmony_ci * limitations under the License.
14ba991379Sopenharmony_ci */
15ba991379Sopenharmony_ci
16ba991379Sopenharmony_cipackage tester
17ba991379Sopenharmony_ci
18ba991379Sopenharmony_ciimport "context"
19ba991379Sopenharmony_ci
20ba991379Sopenharmony_citype ResultStatus string
21ba991379Sopenharmony_ci
22ba991379Sopenharmony_ciconst (
23ba991379Sopenharmony_ci	ResultPass           = `pass`
24ba991379Sopenharmony_ci	ResultOccasionalFail = `occasional_fail`
25ba991379Sopenharmony_ci	ResultFail           = `fail`
26ba991379Sopenharmony_ci)
27ba991379Sopenharmony_ci
28ba991379Sopenharmony_citype Result struct {
29ba991379Sopenharmony_ci	TestCaseName string
30ba991379Sopenharmony_ci	Status       ResultStatus
31ba991379Sopenharmony_ci}
32ba991379Sopenharmony_ci
33ba991379Sopenharmony_citype Tester interface {
34ba991379Sopenharmony_ci	// TaskName returns the name of task which DoTestTask execute.
35ba991379Sopenharmony_ci	TaskName() string
36ba991379Sopenharmony_ci	// Prepare do some test preparations for one certain package
37ba991379Sopenharmony_ci	Prepare(pkgDir string, device string, ctx context.Context) error
38ba991379Sopenharmony_ci	// DoTestTask do a full test on given device.
39ba991379Sopenharmony_ci	DoTestTask(device string, ctx context.Context) ([]Result, error)
40ba991379Sopenharmony_ci	// DoTestCase do a single testcase on given device.
41ba991379Sopenharmony_ci	DoTestCase(device string, testCase string, ctx context.Context) (Result, error)
42ba991379Sopenharmony_ci	// DoTestCases do testcases on given device.
43ba991379Sopenharmony_ci	DoTestCases(device string, testcases []string, ctx context.Context) ([]Result, error)
44ba991379Sopenharmony_ci}
45ba991379Sopenharmony_ci
46ba991379Sopenharmony_citype NewFunc func() Tester
47