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

Commit bbe5dad2 authored by Michael Butler's avatar Michael Butler
Browse files

Cleanup NNAPI VTS tests

This CL includes the following cleanups:
* namespace compression
* remove "using" from header files
* remove no-op code, default no-op constructors
* clang-formats the code

Bug: N/A
Test: mma
Test: VtsHalNeuralnetworksV1_*TargetTest
Change-Id: I023997d8686ca65223858eed3a0881f5444ed2d6
parent bc4c63c4
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -18,12 +18,7 @@

#include "VtsHalNeuralnetworks.h"

namespace android {
namespace hardware {
namespace neuralnetworks {
namespace V1_0 {
namespace vts {
namespace functional {
namespace android::hardware::neuralnetworks::V1_0::vts::functional {

// create device test
TEST_F(NeuralnetworksHidlTest, CreateDevice) {}
@@ -48,9 +43,4 @@ TEST_F(NeuralnetworksHidlTest, GetCapabilitiesTest) {
    EXPECT_TRUE(ret.isOk());
}

}  // namespace functional
}  // namespace vts
}  // namespace V1_0
}  // namespace neuralnetworks
}  // namespace hardware
}  // namespace android
}  // namespace android::hardware::neuralnetworks::V1_0::vts::functional
+5 −21
Original line number Diff line number Diff line
@@ -33,23 +33,12 @@
#include <gtest/gtest.h>
#include <iostream>

namespace android {
namespace hardware {
namespace neuralnetworks {
namespace V1_0 {
namespace vts {
namespace functional {
namespace android::hardware::neuralnetworks::V1_0::vts::functional {

using namespace test_helper;
using ::android::hardware::neuralnetworks::V1_0::ErrorStatus;
using ::android::hardware::neuralnetworks::V1_0::IDevice;
using ::android::hardware::neuralnetworks::V1_0::IPreparedModel;
using ::android::hardware::neuralnetworks::V1_0::Model;
using ::android::hardware::neuralnetworks::V1_0::Request;
using ::android::hardware::neuralnetworks::V1_0::RequestArgument;
using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
using ::android::hidl::memory::V1_0::IMemory;
using hidl::memory::V1_0::IMemory;
using implementation::ExecutionCallback;
using implementation::PreparedModelCallback;

Model createModel(const TestModel& testModel) {
    // Model operands.
@@ -206,9 +195,4 @@ TEST_P(GeneratedTest, Test) {
INSTANTIATE_GENERATED_TEST(GeneratedTest,
                           [](const TestModel& testModel) { return !testModel.expectFailure; });

}  // namespace functional
}  // namespace vts
}  // namespace V1_0
}  // namespace neuralnetworks
}  // namespace hardware
}  // namespace android
}  // namespace android::hardware::neuralnetworks::V1_0::vts::functional
+2 −12
Original line number Diff line number Diff line
@@ -21,12 +21,7 @@
#include "TestHarness.h"
#include "VtsHalNeuralnetworks.h"

namespace android {
namespace hardware {
namespace neuralnetworks {
namespace V1_0 {
namespace vts {
namespace functional {
namespace android::hardware::neuralnetworks::V1_0::vts::functional {

class GeneratedTestBase
    : public NeuralnetworksHidlTest,
@@ -59,11 +54,6 @@ class ValidationTest : public GeneratedTestBase {

Model createModel(const ::test_helper::TestModel& testModel);

}  // namespace functional
}  // namespace vts
}  // namespace V1_0
}  // namespace neuralnetworks
}  // namespace hardware
}  // namespace android
}  // namespace android::hardware::neuralnetworks::V1_0::vts::functional

#endif  // ANDROID_HARDWARE_NEURALNETWORKS_V1_0_GENERATED_TEST_HARNESS_H
+6 −10
Original line number Diff line number Diff line
@@ -28,15 +28,13 @@
#include <algorithm>
#include <vector>

namespace android {
namespace hardware {
namespace neuralnetworks {
namespace android::hardware::neuralnetworks {

using namespace test_helper;
using ::android::hardware::neuralnetworks::V1_0::DataLocation;
using ::android::hardware::neuralnetworks::V1_0::Request;
using ::android::hardware::neuralnetworks::V1_0::RequestArgument;
using ::android::hidl::memory::V1_0::IMemory;
using hidl::memory::V1_0::IMemory;
using V1_0::DataLocation;
using V1_0::Request;
using V1_0::RequestArgument;

constexpr uint32_t kInputPoolIndex = 0;
constexpr uint32_t kOutputPoolIndex = 1;
@@ -118,6 +116,4 @@ std::vector<TestBuffer> getOutputBuffers(const Request& request) {
    return outputBuffers;
}

}  // namespace neuralnetworks
}  // namespace hardware
}  // namespace android
}  // namespace android::hardware::neuralnetworks
+27 −39
Original line number Diff line number Diff line
@@ -20,15 +20,9 @@
#include "GeneratedTestHarness.h"
#include "VtsHalNeuralnetworks.h"

namespace android {
namespace hardware {
namespace neuralnetworks {
namespace V1_0 {
namespace vts {
namespace functional {
namespace android::hardware::neuralnetworks::V1_0::vts::functional {

using ::android::hardware::neuralnetworks::V1_0::implementation::ExecutionCallback;
using ::android::hardware::neuralnetworks::V1_0::implementation::PreparedModelCallback;
using implementation::PreparedModelCallback;

///////////////////////// UTILITY FUNCTIONS /////////////////////////

@@ -48,7 +42,6 @@ static void validatePrepareModel(const sp<IDevice>& device, const std::string& m
    SCOPED_TRACE(message + " [prepareModel]");

    sp<PreparedModelCallback> preparedModelCallback = new PreparedModelCallback();
    ASSERT_NE(nullptr, preparedModelCallback.get());
    Return<ErrorStatus> prepareLaunchStatus = device->prepareModel(model, preparedModelCallback);
    ASSERT_TRUE(prepareLaunchStatus.isOk());
    ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(prepareLaunchStatus));
@@ -498,9 +491,4 @@ void ValidationTest::validateModel(const V1_0::Model& model) {
    addOperationOutputTest(device, model);
}

}  // namespace functional
}  // namespace vts
}  // namespace V1_0
}  // namespace neuralnetworks
}  // namespace hardware
}  // namespace android
}  // namespace android::hardware::neuralnetworks::V1_0::vts::functional
Loading