]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/tests/unit/framework/run_unit_tests.py
8de2c26353cb1efb9d212883021e4ae4fc78b6d3
[ceph.git] / ceph / src / spdk / ocf / tests / unit / framework / run_unit_tests.py
1 #!/usr/bin/env python2
2
3 #
4 # Copyright(c) 2012-2018 Intel Corporation
5 # SPDX-License-Identifier: BSD-3-Clause-Clear
6 #
7
8 import tests_config
9 import os
10 import commands
11
12 script_path = os.path.dirname(os.path.realpath(__file__))
13
14 main_UT_dir = os.path.normpath(script_path + os.sep\
15 + tests_config.MAIN_DIRECTORY_OF_UNIT_TESTS) + os.sep
16
17 main_tested_dir = os.path.normpath(script_path + os.sep\
18 + tests_config.MAIN_DIRECTORY_OF_TESTED_PROJECT) + os.sep
19
20
21 if not os.path.isdir(main_UT_dir + "ocf_env" + os.sep + "ocf"):
22 try:
23 os.makedirs(main_UT_dir + "ocf_env" + os.sep + "ocf")
24 except Exception:
25 print "Cannot crate ocf_env/ocf directory!"
26
27 status, output = commands.getstatusoutput("cp " + main_tested_dir +\
28 "inc" + os.sep + "*" + " " + main_UT_dir + "ocf_env" + os.sep + "ocf")
29
30
31 if os.system(script_path + os.sep + "prepare_sources_for_testing.py") != 0:
32 print "Preparing sources for testing failed!"
33 exit()
34
35
36 build_dir = main_UT_dir + "build" + os.sep
37
38 if not os.path.isdir(build_dir):
39 try:
40 os.makedirs(build_dir)
41 except Exception:
42 print "Cannot crate build directory!"
43
44 status, output = commands.getstatusoutput("cd " + build_dir + " && cmake .. && make && make test")
45
46 print output