mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Quick-fail NNAPI VTS test case if driver is dead
This CL adds a check during SetUp that an NNAPI driver service is still
alive by pinging the driver service. If it is not alive, the test will
fail during SetUp. Without this quick-fail, the test case would continue
as if the driver were still active, which would result in multiple
EXPECT_* and ASSERT_* statements failing instead of a single, clear
failure message.
Bug: 197035200
Test: mma
Test: presubmit: VtsHalNeuralnetworks*TargetTest
Change-Id: Ib1b75ed20f764055699590581d5ad4e5aff4baae
Merged-In: Ib1b75ed20f764055699590581d5ad4e5aff4baae
(cherry picked from commit 9c3c8642fb)
This commit is contained in:
@@ -154,6 +154,8 @@ void Execute(const sp<IDevice>& device, const TestModel& testModel) {
|
||||
void GeneratedTestBase::SetUp() {
|
||||
testing::TestWithParam<GeneratedTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||
|
||||
@@ -81,6 +81,8 @@ void createPreparedModel(const sp<IDevice>& device, const Model& model,
|
||||
void NeuralnetworksHidlTest::SetUp() {
|
||||
testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
static NamedDevice makeNamedDevice(const std::string& name) {
|
||||
|
||||
@@ -162,6 +162,8 @@ void Execute(const sp<IDevice>& device, const TestModel& testModel) {
|
||||
void GeneratedTestBase::SetUp() {
|
||||
testing::TestWithParam<GeneratedTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||
|
||||
@@ -84,6 +84,8 @@ void createPreparedModel(const sp<IDevice>& device, const Model& model,
|
||||
void NeuralnetworksHidlTest::SetUp() {
|
||||
testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
static NamedDevice makeNamedDevice(const std::string& name) {
|
||||
|
||||
@@ -225,6 +225,8 @@ class CompilationCachingTestBase : public testing::Test {
|
||||
void SetUp() override {
|
||||
testing::Test::SetUp();
|
||||
ASSERT_NE(kDevice.get(), nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
|
||||
// Create cache directory. The cache directory and a temporary cache file is always created
|
||||
// to test the behavior of prepareModelFromCache, even when caching is not supported.
|
||||
|
||||
@@ -384,6 +384,8 @@ void Execute(const sp<IDevice>& device, const TestModel& testModel, bool testDyn
|
||||
void GeneratedTestBase::SetUp() {
|
||||
testing::TestWithParam<GeneratedTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||
|
||||
@@ -87,6 +87,8 @@ void createPreparedModel(const sp<IDevice>& device, const Model& model,
|
||||
void NeuralnetworksHidlTest::SetUp() {
|
||||
testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
static NamedDevice makeNamedDevice(const std::string& name) {
|
||||
|
||||
@@ -228,6 +228,8 @@ class CompilationCachingTestBase : public testing::Test {
|
||||
void SetUp() override {
|
||||
testing::Test::SetUp();
|
||||
ASSERT_NE(kDevice.get(), nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
|
||||
// Create cache directory. The cache directory and a temporary cache file is always created
|
||||
// to test the behavior of prepareModelFromCache_1_3, even when caching is not supported.
|
||||
|
||||
@@ -926,6 +926,8 @@ void Execute(const sp<IDevice>& device, const TestModel& testModel, TestKind tes
|
||||
void GeneratedTestBase::SetUp() {
|
||||
testing::TestWithParam<GeneratedTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||
|
||||
@@ -243,6 +243,8 @@ class MemoryDomainTestBase : public testing::Test {
|
||||
void SetUp() override {
|
||||
testing::Test::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
sp<IPreparedModel> createConvPreparedModel(const TestOperand& testOperand,
|
||||
|
||||
@@ -92,6 +92,8 @@ void createPreparedModel(const sp<IDevice>& device, const Model& model,
|
||||
void NeuralnetworksHidlTest::SetUp() {
|
||||
testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive = kDevice->ping().isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
static NamedDevice makeNamedDevice(const std::string& name) {
|
||||
|
||||
@@ -223,6 +223,9 @@ class CompilationCachingTestBase : public testing::Test {
|
||||
void SetUp() override {
|
||||
testing::Test::SetUp();
|
||||
ASSERT_NE(kDevice.get(), nullptr);
|
||||
const bool deviceIsResponsive =
|
||||
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
|
||||
// Create cache directory. The cache directory and a temporary cache file is always created
|
||||
// to test the behavior of prepareModelFromCache, even when caching is not supported.
|
||||
|
||||
@@ -904,6 +904,9 @@ void Execute(const std::shared_ptr<IDevice>& device, const TestModel& testModel,
|
||||
void GeneratedTestBase::SetUp() {
|
||||
testing::TestWithParam<GeneratedTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive =
|
||||
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
|
||||
|
||||
@@ -233,6 +233,9 @@ class MemoryDomainTestBase : public testing::Test {
|
||||
void SetUp() override {
|
||||
testing::Test::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive =
|
||||
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
std::shared_ptr<IPreparedModel> createConvPreparedModel(const TestOperand& testOperand,
|
||||
|
||||
@@ -91,6 +91,9 @@ void createPreparedModel(const std::shared_ptr<IDevice>& device, const Model& mo
|
||||
void NeuralNetworksAidlTest::SetUp() {
|
||||
testing::TestWithParam<NeuralNetworksAidlTestParam>::SetUp();
|
||||
ASSERT_NE(kDevice, nullptr);
|
||||
const bool deviceIsResponsive =
|
||||
ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
|
||||
ASSERT_TRUE(deviceIsResponsive);
|
||||
}
|
||||
|
||||
static NamedDevice makeNamedDevice(const std::string& name) {
|
||||
|
||||
Reference in New Issue
Block a user