]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/tests/unit/tests/add_new_test_file.py
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / ocf / tests / unit / tests / add_new_test_file.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 commands
9 import sys
10 import os
11
12 args = ' '.join(sys.argv[1:])
13 script_path = os.path.dirname(os.path.realpath(__file__))
14 framework_script_path = script_path + os.sep + "../framework/add_new_test_file.py"
15 framework_script_path = os.path.normpath(framework_script_path)
16 status, output = commands.getstatusoutput(framework_script_path + " " + args)
17
18 print output
19
20 if status == 0:
21 path = output.split(" ", 1)[0]
22 with open(script_path + os.sep + "header.c", "r") as header_file:
23 with open(path, "r+") as source_file:
24 source = source_file.readlines()
25
26 source_file.seek(0, os.SEEK_SET)
27 source_file.truncate()
28
29 source_file.writelines(header_file.readlines())
30 source_file.writelines(source)