From 2c25e261fa99c47a4d5cf82b68887a628828fe0f Mon Sep 17 00:00:00 2001 From: huan qin Date: Mon, 8 Mar 2021 14:02:06 -0500 Subject: [PATCH] Skip test for Automotive in Android Q Two tests in VtsKernelLiblpTest require dynamci partion which is not mandatory for Automotive in Android Q: VtsKernelLiblpTest#BuilderTest.block_device_info VtsKernelLiblpTest#liblp.ReadSuperPartition Test:run vts -m VtsKernelLiblpTest -t VtsKernelLiblpTest#BuilderTest.block_device_info Test:run vts -m VtsKernelLiblpTest -t VtsKernelLiblpTest#liblp.ReadSuperPartition Bug: 156287966 Change-Id: I353b854dd37f1ae3aeb7212c97e376dc9719ba91 --- fs_mgr/liblp/builder_test.cpp | 9 +++++++++ fs_mgr/liblp/io_test.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/fs_mgr/liblp/builder_test.cpp b/fs_mgr/liblp/builder_test.cpp index 46bfe9238..328ac8719 100644 --- a/fs_mgr/liblp/builder_test.cpp +++ b/fs_mgr/liblp/builder_test.cpp @@ -18,12 +18,14 @@ #include #include #include +#include #include "utility.h" using namespace std; using namespace android::fs_mgr; using ::testing::ElementsAre; +using android::base::GetProperty; class Environment : public ::testing::Environment { public: @@ -442,6 +444,13 @@ TEST_F(BuilderTest, MetadataTooLarge) { } TEST_F(BuilderTest, block_device_info) { + //This test requires dynamic partition which is not mandatory for + //Automotive in Android Q or lower + std::string api_level = GetProperty("ro.build.version.sdk",""); + std::string hw_type = GetProperty("ro.hardware.type",""); + if (std::stoi(api_level) <= 29 && hw_type == "automotive") { + return; + } PartitionOpener opener; BlockDeviceInfo device_info; diff --git a/fs_mgr/liblp/io_test.cpp b/fs_mgr/liblp/io_test.cpp index fcef1f0d0..8e7a28890 100644 --- a/fs_mgr/liblp/io_test.cpp +++ b/fs_mgr/liblp/io_test.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -35,6 +36,7 @@ using namespace std; using namespace android::fs_mgr; using unique_fd = android::base::unique_fd; +using android::base::GetProperty; // Our tests assume a 128KiB disk with two 512 byte metadata slots. static const size_t kDiskSize = 131072; @@ -706,6 +708,13 @@ TEST(liblp, UpdateNonRetrofit) { } TEST(liblp, ReadSuperPartition) { + //This test requires dynamic partition which is not mandatory for + //Automotive in Android Q or lower + std::string api_level = GetProperty("ro.build.version.sdk",""); + std::string hw_type = GetProperty("ro.hardware.type",""); + if (std::stoi(api_level) <= 29 && hw_type == "automotive") { + return; + } auto slot_suffix = fs_mgr_get_slot_suffix(); auto slot_number = SlotNumberForSlotSuffix(slot_suffix); auto super_name = fs_mgr_get_super_partition_name(slot_number);