forked from bazelbuild/bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BEP: Use TestStatus enum to report the status of a TestResult
-- Change-Id: I07c15f7d232a3e9363ebedfb9b5523999630c401 Reviewed-on: https://cr.bazel.build/9450 PiperOrigin-RevId: 150887776 MOS_MIGRATED_REVID=150887776
- Loading branch information
1 parent
3e6bebf
commit 7a2597d
Showing
7 changed files
with
108 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/google/devtools/build/lib/runtime/BuildEventStreamerUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright 2017 The Bazel Authors. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package com.google.devtools.build.lib.runtime; | ||
|
||
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos; | ||
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.TestStatus; | ||
import com.google.devtools.build.lib.view.test.TestStatus.BlazeTestStatus; | ||
|
||
/** | ||
* Utility methods for the build event stream. | ||
* | ||
* <p>TODO(aehlig): remove once proto to proto dependencies are available and pass through the | ||
* BlazeTestStatus. | ||
*/ | ||
public final class BuildEventStreamerUtils { | ||
|
||
/** Map BlazeTestStatus to TestStatus. */ | ||
public static TestStatus bepStatus(BlazeTestStatus status) { | ||
switch (status) { | ||
case NO_STATUS: | ||
return BuildEventStreamProtos.TestStatus.NO_STATUS; | ||
case PASSED: | ||
return BuildEventStreamProtos.TestStatus.PASSED; | ||
case FLAKY: | ||
return BuildEventStreamProtos.TestStatus.FLAKY; | ||
case FAILED: | ||
return BuildEventStreamProtos.TestStatus.FAILED; | ||
case TIMEOUT: | ||
return BuildEventStreamProtos.TestStatus.TIMEOUT; | ||
case INCOMPLETE: | ||
return BuildEventStreamProtos.TestStatus.INCOMPLETE; | ||
case REMOTE_FAILURE: | ||
return BuildEventStreamProtos.TestStatus.REMOTE_FAILURE; | ||
case BLAZE_HALTED_BEFORE_TESTING: | ||
return BuildEventStreamProtos.TestStatus.BLAZE_HALTED_BEFORE_TESTING; | ||
default: | ||
// Not used as the above is a complete case distinction; however, by the open | ||
// nature of protobuf enums, we need the clause to convice java, that we always | ||
// have a return statement. | ||
return BuildEventStreamProtos.TestStatus.NO_STATUS; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters