Pretty-print ErrorStatus and DeviceStatus test failure logs

Argument-dependent lookup will only work for operator>> if the operator
is in one of the argument's namespaces. This caused the enumerations to
pretty-print for V1_0, but not for V1_1 or V1_2. This change ensures the
V1_0 namespace is used.

Test: mma
Test: atest VtsHalNeuralnetworksV1_0TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_1TargetTest (verified the test output "OFFLINE" for DeviceStatus and "DEVICE_UNAVAILABLE" for ErrorStatus instead of raw byte value representation)
Test: atest VtsHalNeuralnetworksV1_2TargetTest (verified ran and passed tests)
Fixes: 124316129
Change-Id: I764a46e2d87615b1f3da0ab0e6edb134bb533887
(cherry picked from commit 42a35bee10)
This commit is contained in:
Michael Butler
2019-02-12 13:50:25 -08:00
parent 3a4601ba48
commit 857142085f
6 changed files with 45 additions and 27 deletions

View File

@@ -60,6 +60,12 @@ void NeuralnetworksHidlTest::TearDown() {
} // namespace functional
} // namespace vts
} // namespace V1_0
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus) {
return os << toString(errorStatus);
@@ -69,10 +75,7 @@ void NeuralnetworksHidlTest::TearDown() {
return os << toString(deviceStatus);
}
} // namespace V1_0
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
} // namespace android::hardware::neuralnetworks::V1_0
using android::hardware::neuralnetworks::V1_0::vts::functional::NeuralnetworksHidlEnvironment;

View File

@@ -72,14 +72,17 @@ class GeneratedTest : public NeuralnetworksHidlTest {};
} // namespace functional
} // namespace vts
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace V1_0
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace android::hardware::neuralnetworks::V1_0
#endif // VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H

View File

@@ -60,6 +60,12 @@ void NeuralnetworksHidlTest::TearDown() {
} // namespace functional
} // namespace vts
} // namespace V1_1
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus) {
return os << toString(errorStatus);
@@ -69,10 +75,7 @@ void NeuralnetworksHidlTest::TearDown() {
return os << toString(deviceStatus);
}
} // namespace V1_1
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
} // namespace android::hardware::neuralnetworks::V1_0
using android::hardware::neuralnetworks::V1_1::vts::functional::NeuralnetworksHidlEnvironment;

View File

@@ -81,14 +81,17 @@ class GeneratedTest : public NeuralnetworksHidlTest {};
} // namespace functional
} // namespace vts
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace V1_1
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace android::hardware::neuralnetworks::V1_0
#endif // VTS_HAL_NEURALNETWORKS_V1_1_H

View File

@@ -66,6 +66,12 @@ sp<IPreparedModel> getPreparedModel_1_2(
} // namespace functional
} // namespace vts
} // namespace V1_2
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus) {
return os << toString(errorStatus);
@@ -75,10 +81,7 @@ sp<IPreparedModel> getPreparedModel_1_2(
return os << toString(deviceStatus);
}
} // namespace V1_2
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
} // namespace android::hardware::neuralnetworks::V1_0
using android::hardware::neuralnetworks::V1_2::vts::functional::NeuralnetworksHidlEnvironment;

View File

@@ -88,14 +88,17 @@ sp<IPreparedModel> getPreparedModel_1_2(
} // namespace functional
} // namespace vts
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace V1_2
} // namespace neuralnetworks
} // namespace hardware
} // namespace android
namespace android::hardware::neuralnetworks::V1_0 {
// pretty-print values for error messages
::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus);
::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus);
} // namespace android::hardware::neuralnetworks::V1_0
#endif // VTS_HAL_NEURALNETWORKS_V1_2_H