1 /* 2 * Copyright (C) 2017 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 #include "NeuralNetworksWrapper.h" 18 19 #ifndef NNTEST_ONLY_PUBLIC_API 20 #include "Manager.h" 21 #include "Utils.h" 22 #endif 23 24 #include <gtest/gtest.h> 25 26 using namespace android::nn::wrapper; 27 28 int main(int argc, char** argv) { 29 ::testing::InitGoogleTest(&argc, argv); 30 31 #ifndef NNTEST_ONLY_PUBLIC_API 32 android::nn::initVLogMask(); 33 #endif 34 // Test with the installed drivers. 35 int n1 = RUN_ALL_TESTS(); 36 #ifdef NNTEST_ONLY_PUBLIC_API 37 // Can't use non-public functionality, because we're linking against 38 // the shared library version of the runtime. 39 return n1; 40 #else 41 // Test with the CPU driver only. 42 android::nn::DeviceManager::get()->setUseCpuOnly(true); 43 int n2 = RUN_ALL_TESTS(); 44 return n1 | n2; 45 #endif // NNTEST_ONLY_PUBLIC_API 46 } 47