Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7fd3367 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "vts_fs_test: Do not check /metadata for automotive" into android14-tests-dev am: 76a9eb43

parents b6c48aed 76a9eb43
Loading
Loading
Loading
Loading
+20 −1
Original line number Original line Diff line number Diff line
@@ -30,6 +30,24 @@ static int GetVsrLevel() {
    return android::base::GetIntProperty("ro.vendor.api_level", -1);
    return android::base::GetIntProperty("ro.vendor.api_level", -1);
}
}


// Returns true iff the device has the specified feature.
bool DeviceSupportsFeature(const char* feature) {
    bool device_supports_feature = false;
    FILE* p = popen("pm list features", "re");
    if (p) {
        char* line = NULL;
        size_t len = 0;
        while (getline(&line, &len, p) > 0) {
            if (strstr(line, feature)) {
                device_supports_feature = true;
                break;
            }
        }
        pclose(p);
    }
    return device_supports_feature;
}

TEST(fs, ErofsSupported) {
TEST(fs, ErofsSupported) {
    // T-launch GKI kernels and higher must support EROFS.
    // T-launch GKI kernels and higher must support EROFS.
    if (GetVsrLevel() < __ANDROID_API_T__) {
    if (GetVsrLevel() < __ANDROID_API_T__) {
@@ -80,7 +98,8 @@ TEST(fs, PartitionTypes) {
    ASSERT_TRUE(android::base::Readlink("/dev/block/by-name/userdata", &userdata_bdev));
    ASSERT_TRUE(android::base::Readlink("/dev/block/by-name/userdata", &userdata_bdev));


    std::vector<std::string> must_be_f2fs = {"/data"};
    std::vector<std::string> must_be_f2fs = {"/data"};
    if (vsr_level >= __ANDROID_API_U__) {
    if (vsr_level >= __ANDROID_API_U__ &&
        !DeviceSupportsFeature("android.hardware.type.automotive")) {
        must_be_f2fs.emplace_back("/metadata");
        must_be_f2fs.emplace_back("/metadata");
    }
    }