summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mohamad Mahmoud <mohamadmahmoud@google.com> 2024-06-06 13:21:12 +0000
committer Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-06-06 18:16:33 +0000
commitd57954dc5202e87b4320c6e648d8f6cff161e775 (patch)
tree2c072353f7cb326ba08e2f89ef7e07a1c3b492f3
parent4f644c3744f6450a298be14cf9c5718acfe61385 (diff)
Increase required sdk version for the PaletteClientTest.DebugStore
Require API level 36+ to run PaletteClientTest.DebugStore Test: m && atest Bug: 345367058 Change-Id: Ib8c03f43bef5e97b61ae2ab2b12aa66bdf5ea136
-rw-r--r--libartpalette/apex/palette_test.cc31
1 files changed, 14 insertions, 17 deletions
diff --git a/libartpalette/apex/palette_test.cc b/libartpalette/apex/palette_test.cc
index d42a60685a..cbdfafa733 100644
--- a/libartpalette/apex/palette_test.cc
+++ b/libartpalette/apex/palette_test.cc
@@ -51,13 +51,9 @@ bool PaletteSetTaskProfilesIsSupported(palette_status_t res) {
<< "Device API level: " << android_get_device_api_level();
return false;
}
-bool PaletteDebugStoreIsSupported(palette_status_t res) {
- if (android::modules::sdklevel::IsAtLeastV()) {
- return true;
- }
- EXPECT_EQ(PALETTE_STATUS_NOT_SUPPORTED, res)
- << "Device API level: " << android_get_device_api_level();
- return false;
+bool PaletteDebugStoreIsSupported() {
+ // TODO(b/345433959): Switch to android::modules::sdklevel::IsAtLeastW
+ return android_get_device_api_level() >= 36;
}
#endif
@@ -181,18 +177,19 @@ TEST_F(PaletteClientTest, DebugStore) {
GTEST_SKIP() << "DebugStore is only supported on Android";
#else
std::array<char, 20> result{};
- palette_status_t pstatus = PaletteDebugStoreGetString(result.data(), result.size());
// Make sure the we are on a correct API level.
- if (PaletteDebugStoreIsSupported(pstatus)) {
- EXPECT_EQ(PALETTE_STATUS_OK, pstatus);
+ if (!PaletteDebugStoreIsSupported()) {
+ GTEST_SKIP() << "DebugStore is only supported on API 36+";
+ }
+ palette_status_t pstatus = PaletteDebugStoreGetString(result.data(), result.size());
+ EXPECT_EQ(PALETTE_STATUS_OK, pstatus);
- size_t len = strnlen(result.data(), result.size());
- EXPECT_TRUE(len < result.size());
+ size_t len = strnlen(result.data(), result.size());
+ EXPECT_TRUE(len < result.size());
- const char* start = "1,0,";
- const char* end = "::";
- EXPECT_TRUE(len > strlen(start) + strlen(end));
- EXPECT_EQ(strncmp(result.data() + len - strlen(end), end, strlen(end)), 0);
- }
+ const char* start = "1,0,";
+ const char* end = "::";
+ EXPECT_TRUE(len > strlen(start) + strlen(end));
+ EXPECT_EQ(strncmp(result.data() + len - strlen(end), end, strlen(end)), 0);
#endif
}