1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef VTS_HAL_NEURALNETWORKS_V1_1_H 18 #define VTS_HAL_NEURALNETWORKS_V1_1_H 19 20 #include <android/hardware/neuralnetworks/1.0/types.h> 21 #include <android/hardware/neuralnetworks/1.1/IDevice.h> 22 #include <android/hardware/neuralnetworks/1.1/types.h> 23 24 #include <VtsHalHidlTargetTestBase.h> 25 #include <VtsHalHidlTargetTestEnvBase.h> 26 27 #include <android-base/macros.h> 28 #include <gtest/gtest.h> 29 #include <iostream> 30 #include <vector> 31 32 namespace android { 33 namespace hardware { 34 namespace neuralnetworks { 35 namespace V1_1 { 36 37 using V1_0::Request; 38 using V1_0::DeviceStatus; 39 using V1_0::ErrorStatus; 40 41 namespace vts { 42 namespace functional { 43 44 // A class for test environment setup 45 class NeuralnetworksHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase { 46 DISALLOW_COPY_AND_ASSIGN(NeuralnetworksHidlEnvironment); 47 NeuralnetworksHidlEnvironment(); 48 ~NeuralnetworksHidlEnvironment() override; 49 50 public: 51 static NeuralnetworksHidlEnvironment* getInstance(); 52 void registerTestServices() override; 53 }; 54 55 // The main test class for NEURALNETWORKS HIDL HAL. 56 class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase { 57 DISALLOW_COPY_AND_ASSIGN(NeuralnetworksHidlTest); 58 59 public: 60 NeuralnetworksHidlTest(); 61 ~NeuralnetworksHidlTest() override; 62 void SetUp() override; 63 void TearDown() override; 64 65 protected: 66 sp<IDevice> device; 67 }; 68 69 // Tag for the validation tests 70 class ValidationTest : public NeuralnetworksHidlTest { 71 protected: 72 void validateModel(const Model& model); 73 void validateRequests(const Model& model, const std::vector<Request>& request); 74 }; 75 76 // Tag for the generated tests 77 class GeneratedTest : public NeuralnetworksHidlTest {}; 78 79 } // namespace functional 80 } // namespace vts 81 82 // pretty-print values for error messages 83 ::std::ostream& operator<<(::std::ostream& os, ErrorStatus errorStatus); 84 ::std::ostream& operator<<(::std::ostream& os, DeviceStatus deviceStatus); 85 86 } // namespace V1_1 87 } // namespace neuralnetworks 88 } // namespace hardware 89 } // namespace android 90 91 #endif // VTS_HAL_NEURALNETWORKS_V1_1_H 92