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

Commit c605a940 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

audio: Add VTS for configurable engine am: b449cdb2 am: 45e73573

Change-Id: Ifffffbd9471a6012f84232eab55fdcd5191601a3
parents 1574fade 45e73573
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
elaurent@google.com
mnaganov@google.com
+31 −0
Original line number Diff line number Diff line
cc_test {
    name: "VtsHalAudioPolicyV1_0TargetTest",
    defaults: ["vts_target_tests_defaults"],
    srcs: [
        "ValidateEngineConfiguration.cpp",
    ],
    static_libs: [
        "android.hardware.audio.common.test.utility",
        "libxml2",
        "liblog",
    ],
    // Use test_config for vts-core suite.
    // TODO(b/146104851): Add auto-gen rules and remove it.
    test_config: "VtsHalAudioPolicyV1_0TargetTest.xml",
    cflags: [
        "-DXSD_DIR=\"/data/local/tmp\"",
        "-Wall",
        "-Werror",
        "-Wno-unused-function",
        "-O0",
        "-g",
    ],
    data: [
        ":audio_policy_engine_conf_V1_0",
    ],
    gtest: true,
    test_suites: [
        "general-tests",
        "vts-core",
    ],
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <gtest/gtest.h>

#include <unistd.h>
#include <string>
#include "utility/ValidateXml.h"

static const std::vector<const char*> locations = {"/odm/etc", "/vendor/etc", "/system/etc"};
static const std::string config = "audio_policy_engine_configuration.xml";
static const std::string schema =
        std::string(XSD_DIR) + "/audio_policy_engine_configuration_V1_0.xsd";

/**
 * @brief TEST to ensure the audio policy engine configuration file is validating schemas.
 * Note: this configuration file is not mandatory, an hardcoded fallback is provided, so
 * it does not fail if not found.
 */
TEST(ValidateConfiguration, audioPolicyEngineConfiguration) {
    RecordProperty("description",
                   "Verify that the audio policy engine configuration file "
                   "is valid according to the schemas");
    EXPECT_VALID_XML_MULTIPLE_LOCATIONS(config.c_str(), locations, schema.c_str());
}
+36 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="Runs VtsHalAudioPolicyV1_0TargetTest.">
  <option name="test-suite-tag" value="apct" />
  <option name="test-suite-tag" value="apct-native" />

  <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
  </target_preparer>

  <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
  </target_preparer>

  <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
    <option name="cleanup" value="true" />
    <option name="push" value="VtsHalAudioPolicyV1_0TargetTest->/data/local/tmp/VtsHalAudioPolicyV1_0TargetTest" />
    <option name="push" value="audio_policy_engine_conf_V1_0.xsd->/data/local/tmp/audio_policy_engine_configuration_V1_0.xsd" />
  </target_preparer>

  <test class="com.android.tradefed.testtype.GTest" >
    <option name="native-test-device-path" value="/data/local/tmp" />
    <option name="module-name" value="VtsHalAudioPolicyV1_0TargetTest" />
  </test>
</configuration>
+5 −0
Original line number Diff line number Diff line
xsd_config {
    name: "audio_policy_engine_conf_V1_0",
    srcs: ["audio_policy_engine_configuration.xsd"],
    package_name: "audio.policy.V1_0",
}
Loading