Merge "storaged: skip disk_stats test if not supported."

This commit is contained in:
Yifan Hong 2021-12-09 08:13:26 +00:00 committed by Gerrit Code Review
commit c232e0af05
2 changed files with 11 additions and 0 deletions

View File

@ -115,6 +115,9 @@ cc_test {
static_libs: [
"libstoraged",
],
test_suites: [
"general-tests",
],
}
// AIDL interface between storaged and framework.jar

View File

@ -25,6 +25,7 @@
#include <gtest/gtest.h>
#include <aidl/android/hardware/health/IHealth.h>
#include <healthhalutils/HealthHalUtils.h>
#include <storaged.h> // data structures
#include <storaged_utils.h> // functions to test
@ -249,6 +250,13 @@ TEST(storaged_test, disk_stats_monitor) {
// testing if detect() will return the right value
disk_stats_monitor dsm_detect{healthService};
ASSERT_TRUE(dsm_detect.enabled());
// Even if enabled(), healthService may not support disk stats. Check if it is supported.
std::vector<aidl::android::hardware::health::DiskStats> halStats;
if (healthService->getDiskStats(&halStats).getExceptionCode() == EX_UNSUPPORTED_OPERATION) {
GTEST_SKIP();
}
// feed monitor with constant perf data for io perf baseline
// using constant perf is reasonable since the functionality of stream_stats
// has already been tested