rebootescrow: skip testing unsupported devices
This HAL is optional, so we should skip devices that do not have it implemented instead of failing the test. Bug: 143695053 Bug: 63928581 Test: atest VtsHalRebootEscrowTargetTest Change-Id: Idaabdbe621cca0b8896377cef6f561b106ea252c
This commit is contained in:
parent
d8db4439ce
commit
2d5d12860c
1 changed files with 11 additions and 1 deletions
|
@ -26,6 +26,9 @@ using android::sp;
|
||||||
using android::String16;
|
using android::String16;
|
||||||
using android::hardware::rebootescrow::IRebootEscrow;
|
using android::hardware::rebootescrow::IRebootEscrow;
|
||||||
|
|
||||||
|
#define SKIP_UNSUPPORTED \
|
||||||
|
if (rebootescrow == nullptr) GTEST_SKIP() << "Not supported on this device"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This tests that the key can be written, read, and removed. It does not test
|
* This tests that the key can be written, read, and removed. It does not test
|
||||||
* that the key survives a reboot. That needs a host-based test.
|
* that the key survives a reboot. That needs a host-based test.
|
||||||
|
@ -36,7 +39,6 @@ class RebootEscrowAidlTest : public testing::TestWithParam<std::string> {
|
||||||
public:
|
public:
|
||||||
virtual void SetUp() override {
|
virtual void SetUp() override {
|
||||||
rebootescrow = android::waitForDeclaredService<IRebootEscrow>(String16(GetParam().c_str()));
|
rebootescrow = android::waitForDeclaredService<IRebootEscrow>(String16(GetParam().c_str()));
|
||||||
ASSERT_NE(rebootescrow, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sp<IRebootEscrow> rebootescrow;
|
sp<IRebootEscrow> rebootescrow;
|
||||||
|
@ -59,6 +61,8 @@ class RebootEscrowAidlTest : public testing::TestWithParam<std::string> {
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_Success) {
|
TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_Success) {
|
||||||
|
SKIP_UNSUPPORTED;
|
||||||
|
|
||||||
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
||||||
|
|
||||||
std::vector<uint8_t> actualKey;
|
std::vector<uint8_t> actualKey;
|
||||||
|
@ -67,6 +71,8 @@ TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_Success) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_SecondRetrieveSucceeds) {
|
TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_SecondRetrieveSucceeds) {
|
||||||
|
SKIP_UNSUPPORTED;
|
||||||
|
|
||||||
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
||||||
|
|
||||||
std::vector<uint8_t> actualKey;
|
std::vector<uint8_t> actualKey;
|
||||||
|
@ -78,6 +84,8 @@ TEST_P(RebootEscrowAidlTest, StoreAndRetrieve_SecondRetrieveSucceeds) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RebootEscrowAidlTest, StoreTwiceOverwrites_Success) {
|
TEST_P(RebootEscrowAidlTest, StoreTwiceOverwrites_Success) {
|
||||||
|
SKIP_UNSUPPORTED;
|
||||||
|
|
||||||
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
ASSERT_TRUE(rebootescrow->storeKey(KEY_1).isOk());
|
||||||
ASSERT_TRUE(rebootescrow->storeKey(KEY_2).isOk());
|
ASSERT_TRUE(rebootescrow->storeKey(KEY_2).isOk());
|
||||||
|
|
||||||
|
@ -87,6 +95,8 @@ TEST_P(RebootEscrowAidlTest, StoreTwiceOverwrites_Success) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_P(RebootEscrowAidlTest, StoreEmpty_AfterGetEmptyKey_Success) {
|
TEST_P(RebootEscrowAidlTest, StoreEmpty_AfterGetEmptyKey_Success) {
|
||||||
|
SKIP_UNSUPPORTED;
|
||||||
|
|
||||||
rebootescrow->storeKey(KEY_1);
|
rebootescrow->storeKey(KEY_1);
|
||||||
rebootescrow->storeKey(EMPTY_KEY);
|
rebootescrow->storeKey(EMPTY_KEY);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue