1#!@Python3_EXECUTABLE@
2import subprocess
3import sys
4
5dotest_path = '@LLDB_SOURCE_DIR_CONFIGURED@/test/API/dotest.py'
6dotest_args_str = '@LLDB_DOTEST_ARGS_CONFIGURED@'
7arch = '@LLDB_TEST_ARCH@'
8executable = '@LLDB_TEST_EXECUTABLE_CONFIGURED@'
9compiler = '@LLDB_TEST_COMPILER_CONFIGURED@'
10dsymutil = '@LLDB_TEST_DSYMUTIL_CONFIGURED@'
11lldb_build_dir = '@LLDB_TEST_BUILD_DIRECTORY_CONFIGURED@'
12lldb_build_intel_pt = "@LLDB_BUILD_INTEL_PT@"
13lldb_framework_dir = "@LLDB_FRAMEWORK_DIR_CONFIGURED@"
14lldb_libs_dir = "@LLDB_LIBS_DIR_CONFIGURED@"
15llvm_tools_dir = "@LLVM_TOOLS_DIR_CONFIGURED@"
16has_libcxx = @LLDB_HAS_LIBCXX@
17libcxx_libs_dir = "@LIBCXX_LIBRARY_DIR@"
18libcxx_include_dir = "@LIBCXX_GENERATED_INCLUDE_DIR@"
19libcxx_include_target_dir = "@LIBCXX_GENERATED_INCLUDE_TARGET_DIR@"
20
21if __name__ == '__main__':
22    wrapper_args = sys.argv[1:]
23    dotest_args = []
24    # split on an empty string will produce [''] and if you
25    # add that to the command, it will be treated as a directory...
26    if len(dotest_args_str) > 0:
27        dotest_args = dotest_args_str.split(';')
28    # Build dotest.py command.
29    cmd = [sys.executable, dotest_path]
30    cmd.extend(['--arch', arch])
31    cmd.extend(dotest_args)
32    cmd.extend(['--build-dir', lldb_build_dir])
33    cmd.extend(['--executable', executable])
34    cmd.extend(['--compiler', compiler])
35    cmd.extend(['--dsymutil', dsymutil])
36    cmd.extend(['--lldb-libs-dir', lldb_libs_dir])
37    cmd.extend(['--llvm-tools-dir', llvm_tools_dir])
38    if has_libcxx:
39        cmd.extend(['--libcxx-include-dir', libcxx_include_dir])
40        if libcxx_include_target_dir:
41            cmd.extend(['--libcxx-include-target-dir', libcxx_include_target_dir])
42        cmd.extend(['--libcxx-library-dir', libcxx_libs_dir])
43    if lldb_framework_dir:
44        cmd.extend(['--framework', lldb_framework_dir])
45    if lldb_build_intel_pt == "1":
46        cmd.extend(['--enable-plugin', 'intel-pt'])
47    cmd.extend(wrapper_args)
48    # Invoke dotest.py and return exit code.
49    print(' '.join(cmd))
50    sys.exit(subprocess.call(cmd))
51