def main(): cxx_path, test_path, source_file, prefix = get_input_args() count = 1 CXXTEST_DIR_NAME = "cxxtest" PYTHON_DIR_NAME = "python" THIRD_PARTY_LIBRARY_DIR_NAME = "third-party-libraries" GENERIC_RESULTS_NAME = "TestResults.xml" GENERIC_CPP_NAME = "runner.cpp" CXXTESTGEN_FILENAME = "cxxtestgen" # define the directory of test header files that are to be used to create the tests if len(test_path) == 0: test_path.append(os.getcwd()) # define the name of the parent directory for the cxxtest framework relative_path = "" if len(cxx_path) == 0: usage() return if not os.path.exists(cxx_path): relative_path = os.path.join(test_path, cxx_path) if not os.path.exists(relative_path): usage() return; else: cxx_path = relative_path # define a name for the test results xml_results_name = GENERIC_RESULTS_NAME if len(prefix) > 0: xml_results_name = prefix + "_" + GENERIC_RESULTS_NAME # collect all the header files for cxxtestgen header_files = findAllHeadersInPaths(test_path) #define fullpath of cpp file runner_file = os.path.join(test_path[0], defaultIfEmpty(source_file, GENERIC_CPP_NAME)) # prep arguments for command line arguments = [os.path.join(cxx_path, 'cxxtestgen'), '--xunit-printer', '--xunit-file', xml_results_name, '-o', runner_file] for header_file in header_files: arguments.append(' ') arguments.append(header_file) if sys.version_info >= (3, 0): cxx_path = os.path.join(cxx_path, 'python3') sys.path.insert(1, cxx_path) sys.path.append(".") import cxxtest cxxtest.main(arguments)
def main(): cxx_path, test_path, prefix = get_input_args() count = 1 CXXTEST_DIR_NAME = "cxxtest" PYTHON_DIR_NAME = "python" THIRD_PARTY_LIBRARY_DIR_NAME = "third-party-libraries" GENERIC_RESULTS_NAME = "TestResults.xml" GENERIC_CPP_NAME = "runner.cpp" CXXTESTGEN_FILENAME = "cxxtestgen" # define the directory of test header files that are to be used to create the tests if len(test_path) == 0: test_path = os.getcwd() # define the name of the parent directory for the cxxtest framework relative_path = "" if len(cxx_path) == 0: usage() return if not os.path.exists(cxx_path): relative_path = os.path.join(test_path, cxx_path) if not os.path.exists(relative_path): usage() return else: cxx_path = relative_path # define a name for the test results xml_results_name = GENERIC_RESULTS_NAME if len(prefix) > 0: xml_results_name = prefix + "_" + GENERIC_RESULTS_NAME # collect all the header files for cxxtestgen header_files = [] for f in os.listdir(test_path): if f.endswith(".h") or f.endswith(".hpp"): header_files.append(os.path.join(test_path, f)) # define fullpath of cpp file runner_file = os.path.join(test_path, GENERIC_CPP_NAME) # prep arguments for command line arguments = [ os.path.join(cxx_path, "cxxtestgen"), "--xunit-printer", "--xunit-file", xml_results_name, "-o", runner_file, ] for header_file in header_files: arguments.append(" ") arguments.append(header_file) if sys.version_info >= (3, 0): cxx_path = os.path.join(cxx_path, "python3") sys.path.insert(1, cxx_path) sys.path.append(".") import cxxtest cxxtest.main(arguments)
#! /usr/bin/env python # # The CxxTest driver script, which uses the cxxtest Python package. # import sys import os from os.path import realpath, dirname if sys.version_info < (3, 0): sys.path.insert(0, dirname(dirname(realpath(__file__))) + os.sep + 'python') else: sys.path.insert( 0, dirname(dirname(realpath(__file__))) + os.sep + 'python' + os.sep + 'python3') sys.path.append(".") import cxxtest cxxtest.main(sys.argv)
#! /usr/bin/env python # # The CxxTest driver script, which uses the cxxtest Python package. # import sys import os from os.path import realpath, dirname if sys.version_info < (3,0): sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python') else: sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python'+os.sep+'python3') sys.path.append(".") import cxxtest cxxtest.main(sys.argv)