]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/test.py
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / seastar / test.py
1 #!/usr/bin/env python3
2 #
3 # This file is open source software, licensed to you under the terms
4 # of the Apache License, Version 2.0 (the "License"). See the NOTICE file
5 # distributed with this work for additional information regarding copyright
6 # ownership. You may not use this file except in compliance with the License.
7 #
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied. See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 #
19
20 import argparse
21 import subprocess
22 import seastar_cmake
23
24 if __name__ == "__main__":
25
26 parser = argparse.ArgumentParser(description="Seastar test runner")
27 parser.add_argument('--fast', action="store_true", help="Run only fast tests")
28 parser.add_argument('--name', action="store", help="Run only test whose name contains given string")
29 parser.add_argument('--mode', choices=seastar_cmake.SUPPORTED_MODES, help="Run only tests for given build mode")
30 parser.add_argument('--timeout', action="store",default="300",type=int, help="timeout value for test execution")
31 parser.add_argument('--jenkins', action="store",help="jenkins output file prefix")
32 parser.add_argument('--verbose', '-v', action = 'store_true', default = False,
33 help = 'Verbose reporting')
34 args = parser.parse_args()
35
36 MODES = [args.mode] if args.mode else seastar_cmake.SUPPORTED_MODES
37
38 def run_tests(mode):
39 BUILD_PATH = seastar_cmake.BUILD_PATHS[mode]
40
41 # For convenience.
42 tr = seastar_cmake.translate_arg
43
44 TRANSLATED_CMAKE_ARGS = [
45 tr(args.timeout, 'TEST_TIMEOUT'),
46 tr(args.fast, 'EXECUTE_ONLY_FAST_TESTS'),
47 tr(args.jenkins, 'JENKINS', value_when_none=''),
48 ]
49
50 # Modify the existing build by pointing to the build directory.
51 CMAKE_ARGS = ['cmake', BUILD_PATH] + TRANSLATED_CMAKE_ARGS
52 print(CMAKE_ARGS)
53 subprocess.check_call(CMAKE_ARGS, shell=False, cwd=seastar_cmake.ROOT_PATH)
54
55 TRANSLATED_CTEST_ARGS = ['-E', 'Seastar.dist']
56 if args.verbose:
57 TRANSLATED_CTEST_ARGS += ['--verbose']
58 if args.name:
59 TRANSLATED_CTEST_ARGS += ['-R', args.name]
60
61 CTEST_ARGS = ['ctest', BUILD_PATH] + TRANSLATED_CTEST_ARGS
62 print(CTEST_ARGS)
63 subprocess.check_call(CTEST_ARGS, shell=False, cwd=BUILD_PATH)
64
65 for mode in MODES:
66 run_tests(mode)