Merge "Convert Renderscript Hal test to test against each of the service names."
diff --git a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.cpp b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.cpp
index c534889..671c4b1 100644
--- a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.cpp
+++ b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.cpp
@@ -30,10 +30,12 @@
}
void Gralloc::init() {
- mAllocator = ::testing::VtsHalHidlTargetTestBase::getService<IAllocator>();
+ mAllocator = ::testing::VtsHalHidlTargetTestBase::getService<IAllocator>(
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IAllocator>());
ASSERT_NE(nullptr, mAllocator.get()) << "failed to get allocator service";
- mMapper = ::testing::VtsHalHidlTargetTestBase::getService<IMapper>();
+ mMapper = ::testing::VtsHalHidlTargetTestBase::getService<IMapper>(
+ GraphicsMapperHidlEnvironment::Instance()->getServiceName<IMapper>());
ASSERT_NE(nullptr, mMapper.get()) << "failed to get mapper service";
ASSERT_FALSE(mMapper->isRemote()) << "mapper is not in passthrough mode";
}
diff --git a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.h b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.h
index 757f20b..9cf60a3 100644
--- a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.h
+++ b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperTestUtils.h
@@ -19,6 +19,7 @@
#include <unordered_set>
+#include <VtsHalHidlTargetTestEnvBase.h>
#include <android/hardware/graphics/allocator/2.0/IAllocator.h>
#include <android/hardware/graphics/mapper/2.0/IMapper.h>
#include <utils/StrongPointer.h>
@@ -88,6 +89,21 @@
std::unordered_set<const native_handle_t*> mImportedBuffers;
};
+// Test environment for graphics.mapper.
+class GraphicsMapperHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
+ public:
+ // get the test environment singleton
+ static GraphicsMapperHidlEnvironment* Instance() {
+ static GraphicsMapperHidlEnvironment* instance = new GraphicsMapperHidlEnvironment;
+ return instance;
+ }
+
+ virtual void registerTestServices() override {
+ registerTestService<IAllocator>();
+ registerTestService<IMapper>();
+ }
+};
+
} // namespace tests
} // namespace V2_0
} // namespace mapper
diff --git a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperV2_0TargetTest.cpp b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperV2_0TargetTest.cpp
index c74013b..1f94898 100644
--- a/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperV2_0TargetTest.cpp
+++ b/graphics/mapper/2.0/vts/functional/VtsHalGraphicsMapperV2_0TargetTest.cpp
@@ -403,10 +403,11 @@
} // namespace android
int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
-
- int status = RUN_ALL_TESTS();
- LOG(INFO) << "Test result = " << status;
-
- return status;
+ using android::hardware::graphics::mapper::V2_0::tests::GraphicsMapperHidlEnvironment;
+ ::testing::AddGlobalTestEnvironment(GraphicsMapperHidlEnvironment::Instance());
+ ::testing::InitGoogleTest(&argc, argv);
+ GraphicsMapperHidlEnvironment::Instance()->init(&argc, argv);
+ int status = RUN_ALL_TESTS();
+ LOG(INFO) << "Test result = " << status;
+ return status;
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 0507cc9..4f729f1 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -142,7 +142,7 @@
int serial = GetRandomSerialNumber();
radio->getAvailableNetworks(serial);
- EXPECT_EQ(std::cv_status::no_timeout, wait());
+ EXPECT_EQ(std::cv_status::no_timeout, wait(300));
EXPECT_EQ(serial, radioRsp->rspInfo.serial);
ASSERT_TRUE(radioRsp->rspInfo.type == RadioResponseType::SOLICITED ||
radioRsp->rspInfo.type == RadioResponseType::SOLICITED_ACK_EXP);
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
index ed2c6bb..b5f036e 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_test.cpp
@@ -51,13 +51,13 @@
cv.notify_one();
}
-std::cv_status RadioHidlTest::wait() {
+std::cv_status RadioHidlTest::wait(int sec) {
std::unique_lock<std::mutex> lock(mtx);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
- status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ status = cv.wait_until(lock, now + std::chrono::seconds(sec));
if (status == std::cv_status::timeout) {
return status;
}
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
index b60887c..2a7487f 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
+++ b/radio/1.0/vts/functional/radio_hidl_hal_utils_v1_0.h
@@ -527,7 +527,7 @@
void notify();
/* Test code calls this function to wait for response */
- std::cv_status wait();
+ std::cv_status wait(int sec = TIMEOUT_PERIOD);
/* Used for checking General Errors */
bool CheckGeneralError();
@@ -538,4 +538,4 @@
sp<IRadio> radio;
sp<RadioResponse> radioRsp;
sp<RadioIndication> radioInd;
-};
\ No newline at end of file
+};
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
index e0b1ad4..f03db20 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
+++ b/radio/1.1/vts/functional/radio_hidl_hal_test.cpp
@@ -52,13 +52,13 @@
cv.notify_one();
}
-std::cv_status RadioHidlTest_v1_1::wait() {
+std::cv_status RadioHidlTest_v1_1::wait(int sec) {
std::unique_lock<std::mutex> lock(mtx);
std::cv_status status = std::cv_status::no_timeout;
auto now = std::chrono::system_clock::now();
while (count == 0) {
- status = cv.wait_until(lock, now + std::chrono::seconds(TIMEOUT_PERIOD));
+ status = cv.wait_until(lock, now + std::chrono::seconds(sec));
if (status == std::cv_status::timeout) {
return status;
}
diff --git a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
index 3e31459..523b9ba 100644
--- a/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
+++ b/radio/1.1/vts/functional/radio_hidl_hal_utils_v1_1.h
@@ -550,7 +550,7 @@
void notify();
/* Test code calls this function to wait for response */
- std::cv_status wait();
+ std::cv_status wait(int sec = TIMEOUT_PERIOD);
/* Used for checking General Errors */
bool CheckGeneralError();
@@ -561,4 +561,4 @@
sp<::android::hardware::radio::V1_1::IRadio> radio_v1_1;
sp<RadioResponse_v1_1> radioRsp_v1_1;
sp<RadioIndication_v1_1> radioInd_v1_1;
-};
\ No newline at end of file
+};