Parsing 'Not Run' flag as 'Skip' status.
There is a bug where for the CFT runs, the 'Not Run' status is translated to
CRASH status in the testhause. This was because the 'Not Run' status was not
handled by the parser, thus it falls back to default value i.e. Crash
'Not Run' is more relevant to 'Skip' rather than 'Crash'.
BUG=b:301307681
TEST=./fast_build.sh -t chromiumos/test/execution/cmd/cros-test/internal/tautoresults
Change-Id: Iea3f4fca93635bc5e005708ebdc658310e2faf0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/4895059
Auto-Submit: Afshin Sadrieh <asadrieh@google.com>
Tested-by: Afshin Sadrieh <asadrieh@google.com>
Commit-Queue: Derek Beckett <dbeckett@chromium.org>
Reviewed-by: Derek Beckett <dbeckett@chromium.org>
(cherry picked from commit c1ecc2e98977b1e6be59b8587dc8c37b77f09791)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/4937690
Commit-Queue: Afshin Sadrieh <asadrieh@google.com>
diff --git a/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults.go b/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults.go
index f2a5a0d..6e5c21d 100644
--- a/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults.go
+++ b/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults.go
@@ -150,6 +150,18 @@
} else if test.Verdict == "Pass" {
testResult.Verdict = &api.TestCaseResult_Pass_{Pass: &api.TestCaseResult_Pass{}}
testResult.Reason = ""
+ } else if test.Verdict == "Warn" {
+ testResult.Verdict = &api.TestCaseResult_Pass_{Pass: &api.TestCaseResult_Pass{}}
+ testResult.Reason = test.Errmsg
+ if test.Errmsg == "" {
+ testResult.Reason = "Test had warnings."
+ }
+ } else if test.Verdict == "Not Run" {
+ testResult.Verdict = &api.TestCaseResult_Skip_{Skip: &api.TestCaseResult_Skip{}}
+ testResult.Reason = test.Errmsg
+ if test.Errmsg == "" {
+ testResult.Reason = "Test ended with Not Run state."
+ }
}
// r.testCaseResults = append(r.testCaseResults, &testResult)
return &testResult
diff --git a/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults_test.go b/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults_test.go
index 3a235e0..bfdef70 100644
--- a/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults_test.go
+++ b/src/chromiumos/test/execution/cmd/cros-test/internal/tautoresults/tautoresults_test.go
@@ -47,6 +47,22 @@
"resultspath": "/tmp/test/results/tauto/results-1-stub_FailServer",
"starttime": "1650319391",
"endtime": "1650319496"
+ },
+ {
+ "verdict": "Warn",
+ "testname": "infra_warn",
+ "errmsg": "warning happened.",
+ "resultspath": "/tmp/test/results/tauto/results-1-stub_FailServer",
+ "starttime": "1650319391",
+ "endtime": "1650319496"
+ },
+ {
+ "verdict": "Not Run",
+ "testname": "infra_skip",
+ "errmsg": "test skipped.",
+ "resultspath": "/tmp/test/results/tauto/results-1-stub_FailServer",
+ "starttime": "1650319391",
+ "endtime": "1650319496"
}]
}`
td, err := ioutil.TempDir("", "example")
@@ -144,6 +160,64 @@
Duration: DURATION105,
},
{
+ TestCaseId: &api.TestCase_Id{Value: "infra_warn_id"},
+ ResultDirPath: &_go.StoragePath{
+ HostType: _go.StoragePath_LOCAL,
+ Path: "/tmp/test/results/tauto/results-1-stub_FailServer",
+ },
+ Verdict: &api.TestCaseResult_Pass_{Pass: &api.TestCaseResult_Pass{}},
+ Reason: "warning happened.",
+ TestHarness: &api.TestHarness{
+ TestHarnessType: &api.TestHarness_Tauto_{
+ Tauto: &api.TestHarness_Tauto{},
+ },
+ },
+ StartTime: EXPECTSTARTTIME,
+ Duration: DURATION105,
+ TestCaseMetadata: &api.TestCaseMetadata{
+ TestCase: &api.TestCase{
+ Name: "infra_warn",
+ },
+ TestCaseInfo: &api.TestCaseInfo{
+ Owners: []*api.Contact{
+ {
+ Email: "owner1@test.com",
+ },
+ },
+ Requirements: []*api.Requirement{
+ {
+ Value: "requirement 1",
+ },
+ },
+ BugComponent: &api.BugComponent{
+ Value: "b/1234",
+ },
+ Criteria: &api.Criteria{
+ Value: "criteria 1",
+ },
+ HwAgnostic: &api.HwAgnostic{
+ Value: true,
+ },
+ },
+ },
+ },
+ {
+ TestCaseId: &api.TestCase_Id{Value: "infra_skip_id"},
+ ResultDirPath: &_go.StoragePath{
+ HostType: _go.StoragePath_LOCAL,
+ Path: "/tmp/test/results/tauto/results-1-stub_FailServer",
+ },
+ Verdict: &api.TestCaseResult_Skip_{Skip: &api.TestCaseResult_Skip{}},
+ Reason: "test skipped.",
+ TestHarness: &api.TestHarness{
+ TestHarnessType: &api.TestHarness_Tauto_{
+ Tauto: &api.TestHarness_Tauto{},
+ },
+ },
+ StartTime: EXPECTSTARTTIME,
+ Duration: DURATION105,
+ },
+ {
TestCaseId: &api.TestCase_Id{Value: "infra_dne_id"},
Verdict: &api.TestCaseResult_NotRun_{NotRun: &api.TestCaseResult_NotRun{}},
Reason: "AutoservCrash",
@@ -155,13 +229,15 @@
},
}
- tests := []string{"infra_pass", "infra_fail", "infra_err", "infra_dne"}
+ tests := []string{"infra_pass", "infra_fail", "infra_err", "infra_dne", "infra_warn", "infra_skip"}
testNamesToIds := map[string]string{
"infra_pass": "infra_pass_id",
"infra_fail": "infra_fail_id",
"infra_err": "infra_err_id",
"infra_dne": "infra_dne_id",
+ "infra_warn": "infra_warn_id",
+ "infra_skip": "infra_skip_id",
}
testNamesToMetadata := map[string]*api.TestCaseMetadata{
@@ -191,6 +267,32 @@
},
},
},
+ "infra_warn": {
+ TestCase: &api.TestCase{
+ Name: "infra_warn",
+ },
+ TestCaseInfo: &api.TestCaseInfo{
+ Owners: []*api.Contact{
+ {
+ Email: "owner1@test.com",
+ },
+ },
+ Requirements: []*api.Requirement{
+ {
+ Value: "requirement 1",
+ },
+ },
+ BugComponent: &api.BugComponent{
+ Value: "b/1234",
+ },
+ Criteria: &api.Criteria{
+ Value: "criteria 1",
+ },
+ HwAgnostic: &api.HwAgnostic{
+ Value: true,
+ },
+ },
+ },
}
reports, err := TestsReports(resultsDir, tests, testNamesToIds, testNamesToMetadata, "AutoservCrash")
@@ -200,7 +302,7 @@
for i := 0; i < len(reports); i++ {
if !proto.Equal(reports[i], expectedResults[i]) {
- t.Errorf("Got unexpected reports(-got +want):\n%v\n--\n%v\n", reports, expectedResults)
+ t.Errorf("[%v]Got unexpected reports(-got +want):\n%v\n--\n%v\n", i, reports[i], expectedResults[i])
}
}