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
BUG=b:303096094
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/+/5053400
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Afshin Sadrieh <asadrieh@google.com>
Tested-by: Martin Faltesek <mfaltesek@google.com>
Reviewed-by: Seewai Fu <seewaifu@google.com>
Commit-Queue: Martin Faltesek <mfaltesek@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 9a5481a..0b7ce7f 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
@@ -156,6 +156,12 @@
 		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)
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 94d1986..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
@@ -55,6 +55,14 @@
 	  "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")
@@ -194,6 +202,22 @@
 			},
 		},
 		{
+			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",
@@ -205,7 +229,7 @@
 		},
 	}
 
-	tests := []string{"infra_pass", "infra_fail", "infra_err", "infra_dne", "infra_warn"}
+	tests := []string{"infra_pass", "infra_fail", "infra_err", "infra_dne", "infra_warn", "infra_skip"}
 
 	testNamesToIds := map[string]string{
 		"infra_pass": "infra_pass_id",
@@ -213,6 +237,7 @@
 		"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{