unittest_environment.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Intel Corporation
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 <fstream>
18 #include <string>
19 #include <vector>
20 
21 #include <boost/filesystem/operations.hpp>
22 #include <gtest/gtest.h>
23 
24 TEST(UnitTestEnvironment, testSDK)
25 {
26  std::system("python2 /opt/movidius/NCSDK/tests/api-check/ncs-python2-check.py > /tmp/NCS_unittest.txt");
27  EXPECT_TRUE(boost::filesystem::exists("/tmp/NCS_unittest.txt"));
28  std::ifstream fin("/tmp/NCS_unittest.txt");
29  std::string ncs_check, tmp;
30  while (std::getline(fin, tmp))
31  {
32  ncs_check = tmp;
33  }
34  EXPECT_EQ(ncs_check, "NCS device working.");
35  std::system("rm -rf /tmp/NCS_unittest.txt > /dev/null 2>&1");
36 }
37 
38 TEST(UnitTestEnvironment, testAppZoo)
39 {
40  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo"));
41  std::system("cd /opt/movidius/ncappzoo && make > /dev/null 2>&1");
42  std::vector<std::string> caffe_dirs = { "AlexNet", "GoogLeNet", "SqueezeNet", "SSD_MobileNet", "TinyYolo" };
43  std::vector<std::string> tf_dirs = { "inception_v1", "inception_v2", "inception_v3", "inception_v4", "mobilenets" };
44  for (std::string caffe : caffe_dirs)
45  {
46  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/caffe/" + caffe + "/graph"));
47  }
48 
49  for (std::string tf : tf_dirs)
50  {
51  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/tensorflow/" + tf + "/graph"));
52  }
53 }
54 
55 TEST(UnitTestEnvironment, testCategories)
56 {
57  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/data/ilsvrc12/imagenet1000.txt"));
58  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/data/ilsvrc12/imagenet1001.txt"));
59  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/data/ilsvrc12/voc20.txt"));
60  EXPECT_TRUE(boost::filesystem::exists("/opt/movidius/ncappzoo/data/ilsvrc12/voc21.txt"));
61 }
62 
63 int main(int argc, char** argv)
64 {
65  testing::InitGoogleTest(&argc, argv);
66  return RUN_ALL_TESTS();
67 }
TEST(UnitTestEnvironment, testSDK)
int main(int argc, char **argv)


movidius_ncs_lib
Author(s): Xiaojun Huang
autogenerated on Mon Jun 10 2019 14:11:23