diff --git a/storaged/Android.bp b/storaged/Android.bp index f2366cff1..7960af314 100644 --- a/storaged/Android.bp +++ b/storaged/Android.bp @@ -115,6 +115,9 @@ cc_test { static_libs: [ "libstoraged", ], + test_suites: [ + "general-tests", + ], } // AIDL interface between storaged and framework.jar diff --git a/storaged/tests/storaged_test.cpp b/storaged/tests/storaged_test.cpp index e987f76f2..bb71bf3c2 100644 --- a/storaged/tests/storaged_test.cpp +++ b/storaged/tests/storaged_test.cpp @@ -25,6 +25,7 @@ #include +#include #include #include // data structures #include // 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 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