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

Commit d80d030b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Skip thermal VTS on emulators" into main

parents 18ee0ed8 681096c6
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android/binder_status.h>
#include <cutils/properties.h>
#include <gtest/gtest.h>

#include <unistd.h>
@@ -179,6 +180,34 @@ class ThermalAidlTest : public testing::TestWithParam<std::string> {
            ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
        }
    }

    bool isEmulator() {
        if (property_get_bool("ro.boot.qemu", false)) {
            return true;
        }
        char device[PROP_VALUE_MAX];
        char model[PROP_VALUE_MAX];
        char name[PROP_VALUE_MAX];
        char hardware[PROP_VALUE_MAX];

        property_get("ro.product.device", device, "");
        property_get("ro.product.model", model, "");
        property_get("ro.product.name", name, "");
        property_get("ro.hardware", hardware, "");

        std::string deviceStr(device);
        std::string modelStr(model);
        std::string nameStr(name);
        std::string hardwareStr(hardware);

        return deviceStr.rfind("vsoc_", 0) == 0 || modelStr.rfind("Cuttlefish ", 0) == 0 ||
               nameStr.rfind("cf_", 0) == 0 || nameStr.rfind("aosp_cf_", 0) == 0 ||
               hardwareStr.find("goldfish") != std::string::npos ||
               hardwareStr.find("ranchu") != std::string::npos ||
               hardwareStr.find("cutf_cvm") != std::string::npos ||
               hardwareStr.find("starfish") != std::string::npos;
    }

    // Stores thermal version
    int32_t thermal_version;

@@ -359,6 +388,9 @@ TEST_P(ThermalAidlTest, SkinTemperatureThresholdsTest) {
    if (apiLevel < 202404) {
        GTEST_SKIP() << "Skipping test as the vendor level is below 202404: " << apiLevel;
    }
    if (isEmulator()) {
        GTEST_SKIP() << "Skipping test on emulator";
    }
    for (const auto& feature : kNonHandheldFeatures) {
        if (::testing::deviceSupportsFeature(feature.c_str())) {
            GTEST_SKIP() << "Skipping test as the device has feature: " << feature;