storaged: skip disk_stats test if not supported.
If HAL does not support disk stats, do not run corresponding storaged tests. Also add storaged-unit-tests to Treehugger. Test: storaged-unit-tests Bug: 208543110 Change-Id: Ia2acf30ca3e259e0f0744385da69d92f9c00f223
This commit is contained in:
parent
5291a67ee3
commit
1407fd04db
2 changed files with 11 additions and 0 deletions
|
|
@ -115,6 +115,9 @@ cc_test {
|
|||
static_libs: [
|
||||
"libstoraged",
|
||||
],
|
||||
test_suites: [
|
||||
"general-tests",
|
||||
],
|
||||
}
|
||||
|
||||
// AIDL interface between storaged and framework.jar
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue