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

Commit 9e86b332 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-d6bf2db5-83c3-41cb-ba89-644c366c2525-for-git_oc-mr1-release-40...

release-request-d6bf2db5-83c3-41cb-ba89-644c366c2525-for-git_oc-mr1-release-4070602 snap-temp-L56000000070867102

Change-Id: I65c897e5ec39f3d3d63adbd535cccd01f2ede9cd
parents 3214a162 9f33e742
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -17,7 +17,8 @@
cc_test {
    name: "VtsHalAudioV2_0TargetTest",
    defaults: ["hidl_defaults"],
    srcs: ["AudioPrimaryHidlHalTest.cpp"],
    srcs: ["AudioPrimaryHidlHalTest.cpp",
           "ValidateAudioConfiguration.cpp"],
    shared_libs: [
        "libbase",
        "liblog",
@@ -25,8 +26,10 @@ cc_test {
        "libhidltransport",
        "libutils",
        "libcutils",
        "libxml2",
        "android.hardware.audio@2.0",
        "android.hardware.audio.common@2.0",
        "android.hardware.audio.common.test.utility",
    ],
    static_libs: ["VtsHalHidlTargetTestBase"],
    cflags: [
+4 −59
Original line number Diff line number Diff line
@@ -21,9 +21,7 @@
#include <cstddef>
#include <cstdio>
#include <limits>
#include <list>
#include <string>
#include <type_traits>
#include <vector>

#include <VtsHalHidlTargetTestBase.h>
@@ -37,6 +35,8 @@
#include <android/hardware/audio/common/2.0/types.h>

#include "utility/AssertOk.h"
#include "utility/Documentation.h"
#include "utility/EnvironmentTearDown.h"
#include "utility/PrettyPrintAudioTypes.h"
#include "utility/ReturnIn.h"

@@ -59,8 +59,7 @@ using ::android::hardware::audio::V2_0::IDevicesFactory;
using ::android::hardware::audio::V2_0::IStream;
using ::android::hardware::audio::V2_0::IStreamIn;
using ::android::hardware::audio::V2_0::TimeSpec;
using ReadParameters =
    ::android::hardware::audio::V2_0::IStreamIn::ReadParameters;
using ReadParameters = ::android::hardware::audio::V2_0::IStreamIn::ReadParameters;
using ReadStatus = ::android::hardware::audio::V2_0::IStreamIn::ReadStatus;
using ::android::hardware::audio::V2_0::IStreamOut;
using ::android::hardware::audio::V2_0::IStreamOutCallback;
@@ -81,61 +80,8 @@ using ::android::hardware::audio::common::V2_0::AudioOutputFlag;
using ::android::hardware::audio::common::V2_0::AudioSource;
using ::android::hardware::audio::common::V2_0::ThreadInfo;

using utility::returnIn;
using namespace ::android::hardware::audio::common::test::utility;

const char* getTestName() {
    return ::testing::UnitTest::GetInstance()->current_test_info()->name();
}

namespace doc {
/** Document the current test case.
 * Eg: calling `doc::test("Dump the state of the hal")` in the "debugDump" test
 * will output:
 *   <testcase name="debugDump" status="run" time="6"
 *             classname="AudioPrimaryHidlTest"
               description="Dump the state of the hal." />
 * see
 https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#logging-additional-information
 */
void test(const std::string& testCaseDocumentation) {
    ::testing::Test::RecordProperty("description", testCaseDocumentation);
}

/** Document why a test was not fully run. Usually due to an optional feature
 * not implemented. */
void partialTest(const std::string& reason) {
    LOG(INFO) << "Test " << getTestName() << " partially run: " << reason;
    ::testing::Test::RecordProperty("partialyRunTest", reason);
}

/** Add a note to the test. */
void note(const std::string& note) {
    LOG(INFO) << "Test " << getTestName() << " noted: " << note;
    ::testing::Test::RecordProperty("note", note);
}
}

// Register callback for static object destruction
// Avoid destroying static objects after main return.
// Post main return destruction leads to incorrect gtest timing measurements as
// well as harder
// debuging if anything goes wrong during destruction.
class Environment : public ::testing::Environment {
   public:
    using TearDownFunc = std::function<void()>;
    void registerTearDown(TearDownFunc&& tearDown) {
        tearDowns.push_back(std::move(tearDown));
    }

   private:
    void TearDown() override {
        // Call the tear downs in reverse order of insertion
        for (auto& tearDown : tearDowns) {
            tearDown();
        }
    }
    std::list<TearDownFunc> tearDowns;
};
// Instance to register global tearDown
static Environment* environment;

@@ -1402,6 +1348,5 @@ int main(int argc, char** argv) {
    ::testing::AddGlobalTestEnvironment(environment);
    ::testing::InitGoogleTest(&argc, argv);
    int status = RUN_ALL_TESTS();
    LOG(INFO) << "Test result = " << status;
    return status;
}
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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 "utility/ValidateXml.h"

TEST(CheckConfig, audioPolicyConfigurationValidation) {
    ASSERT_VALID_XML("/vendor/etc/audio_policy_configuration.xml",
                     "/data/local/tmp/audio_policy_configuration.xsd");
}
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ subdirs = [
    "2.0/vts/functional",
    "common/2.0",
    "common/2.0/default",
    "common/test/utility",
    "effect/2.0",
    "effect/2.0/vts/functional",
]
+32 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2017 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.
//

cc_library_shared {
    name: "android.hardware.audio.common.test.utility",
    defaults : ["hidl_defaults"],
    srcs: ["src/ValidateXml.cpp"],
    cflags: [
        "-O0",
        "-g",
        "-Wextra",
    ],
    local_include_dirs: ["include/utility"],
    export_include_dirs: ["include"],
    shared_libs: ["libxml2", "liblog"],
    static_libs: ["libgtest"],
    export_static_lib_headers: ["libgtest"],
}
Loading