Exemple #1
0
def cleanup(path=None, exclude=[]):
    """
    route for cleaning up testing files
    """
    sp.call((sys.executable, os.path.join(os.getcwd(), "setup.py"), "clean"))
    helpers.RemovePath(os.path.join(os.getcwd(), "tomopy.egg-info"))
    helpers.RemovePath(os.path.join(os.getcwd(), "dist"))
    helpers.RemovePath(os.path.join(os.getcwd(), "MANIFEST"))
    helpers.Cleanup(path, exclude=exclude)
Exemple #2
0
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(
        project_name="PTL",
        source_dir=os.getcwd(),
        binary_dir=os.path.join(os.getcwd(), "build-PTL"),
        build_type="Release",
        vcs_type="git",
    )

    parser.add_argument(
        "--arch", help="PTL_USE_ARCH=ON", default=False, action="store_true"
    )
    parser.add_argument(
        "--tbb", help="PTL_USE_TBB=ON", default=False, action="store_true"
    )
    parser.add_argument(
        "--sanitizer",
        help="PTL_USE_SANITIZER=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--sanitizer-type",
        help="PTL_SANITIZER_TYPE=<type>",
        default="leak",
        type=str,
        choices=("leak", "thread", "memory", "address"),
    )
    parser.add_argument(
        "--static-analysis",
        help="PTL_USE_CLANG_TIDY=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--coverage",
        help="PTL_USE_COVERAGE=ON",
        default=False,
        action="store_true",
    )
    parser.add_argument(
        "--num-tasks", help="Set the number of tasks", default=65536, type=int
    )
    parser.add_argument(
        "--use-locks",
        help="Enable mutex locking in task subqueues for extra safety",
        default=None,
        action="store_true",
    )
    parser.add_argument(
        "--build-libs",
        help="Set the number of tasks",
        default=["shared", "static"],
        type=str,
        nargs="*",
        choices=("shared", "static"),
    )

    args = parser.parse_args()

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version

        if (
            _pyctest_version[0] == 0
            and _pyctest_version[1] == 0
            and _pyctest_version[2] < 11
        ):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"]
            )
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake

            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    pyct.set(
        "CTEST_CUSTOM_COVERAGE_EXCLUDE",
        ";".join(
            [
                "/usr/.*",
                ".*external/.*",
                ".*examples/.*",
                ".*/Backtrace.hh",
            ]
        ),
    )

    return args
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TiMemory",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.path.join(
                                        os.getcwd(), "build-timemory",
                                        platform.system()),
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=False)

    parser.add_argument("--arch",
                        help="TIMEMORY_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--profile",
                        help="Run gperf profiler",
                        default=None,
                        type=str,
                        choices=("cpu", "heap"))
    parser.add_argument("--sanitizer",
                        help="Type of sanitizer",
                        default=None,
                        type=str,
                        choices=("leak", "memory", "address", "thread"))
    parser.add_argument("--coverage",
                        help="TIMEMORY_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--static-analysis",
                        help="TIMEMORY_USE_CLANG_TIDY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tools",
                        help="TIMEMORY_BUILD_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tau",
                        help="TIMEMORY_USE_TAU=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpip",
                        help="TIMEMORY_BUILD_MPIP=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cuda",
                        help="TIMEMORY_USE_CUDA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--nvtx",
                        help="TIMEMORY_USE_NVTX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cupti",
                        help="TIMEMORY_USE_CUPTI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--upcxx",
                        help="TIMEMORY_USE_UPCXX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gotcha",
                        help="TIMEMORY_USE_GOTCHA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gperftools",
                        help="TIMEMORY_USE_GPERFTOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--caliper",
                        help="TIMEMORY_USE_CALIPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--likwid",
                        help="TIMEMORY_USE_LIKWID=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--papi",
                        help="TIMEMORY_USE_PAPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi",
                        help="TIMEMORY_USE_MPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi-init",
                        help="TIMEMORY_USE_MPI_INIT=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--python",
                        help="TIMEMORY_BUILD_PYTHON=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--ompt",
                        help="TIMEMORY_BUILD_OMPT=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--kokkos",
                        help="TIMEMORY_BUILD_KOKKOS_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--dyninst",
                        help="TIMEMORY_USE_DYNINST=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--extra-optimizations",
                        help="TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--lto",
                        help="TIMEMORY_BUILD_LTO=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--developer",
                        help="TIMEMORY_BUILD_DEVELOPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--xray",
                        help="TIMEMORY_BUILD_XRAY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--stats",
                        help="TIMEMORY_USE_STATISTICS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--timing",
                        help="TIMEMORY_USE_COMPILE_TIMING=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--build-libs",
                        help="Build library type(s)",
                        default=("shared"),
                        nargs='*',
                        type=str,
                        choices=("static", "shared"))
    parser.add_argument("--tls-model",
                        help="Thread-local static model",
                        default=('global-dynamic'),
                        type=str,
                        choices=('global-dynamic', 'local-dynamic',
                                 'initial-exec', 'local-exec'))
    parser.add_argument("--cxx-standard",
                        help="C++ standard",
                        type=str,
                        default="17",
                        choices=("14", "17", "20"))
    parser.add_argument("--generate",
                        help="Generate the tests only",
                        action='store_true')
    parser.add_argument("-j",
                        "--cpu-count",
                        type=int,
                        default=mp.cpu_count(),
                        help="Parallel build jobs to run")

    args = parser.parse_args()

    if "shared" not in args.build_libs and args.python:
        raise RuntimeError("Python cannot be built with static libraries")

    if os.environ.get("CTEST_SITE") is not None:
        pyct.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    if platform.system() != "Linux":
        args.papi = False

    os.environ["PYCTEST_TESTING"] = "ON"
    os.environ["TIMEMORY_PLOT_OUTPUT"] = "ON"
    os.environ["TIMEMORY_BANNER"] = "OFF"

    # update PYTHONPATH for the unit tests
    pypath = os.environ.get("PYTHONPATH", "").split(":")
    pypath = [pyct.BINARY_DIRECTORY] + pypath
    os.environ["PYTHONPATH"] = ":".join(pypath)

    return args
Exemple #4
0
def configure():

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TiMemory",
                                    source_dir=os.getcwd(),
                                    binary_dir=os.path.join(
                                        os.getcwd(), "build-timemory",
                                        platform.system()),
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=False)

    parser.add_argument("--arch",
                        help="TIMEMORY_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--profile",
                        help="Run gperf profiler",
                        default=None,
                        type=str,
                        choices=("cpu", "heap"))
    parser.add_argument("--sanitizer",
                        help="Type of sanitizer",
                        default=None,
                        type=str,
                        choices=("leak", "memory", "address", "thread"))
    parser.add_argument("--coverage",
                        help="TIMEMORY_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--static-analysis",
                        help="TIMEMORY_USE_CLANG_TIDY=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tools",
                        help="TIMEMORY_BUILD_TOOLS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tau",
                        help="TIMEMORY_USE_TAU=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpip",
                        help="TIMEMORY_BUILD_MPIP=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cuda",
                        help="TIMEMORY_USE_CUDA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--cupti",
                        help="TIMEMORY_USE_CUPTI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--upcxx",
                        help="TIMEMORY_USE_UPCXX=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gotcha",
                        help="TIMEMORY_USE_GOTCHA=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--caliper",
                        help="TIMEMORY_USE_CALIPER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--likwid",
                        help="TIMEMORY_USE_LIKWID=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--papi",
                        help="TIMEMORY_USE_PAPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--mpi",
                        help="TIMEMORY_USE_MPI=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--python",
                        help="TIMEMORY_BUILD_PYTHON=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--extra-optimizations",
                        help="TIMEMORY_BUILD_EXTRA_OPTIMIZATIONS=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--build-libs",
                        help="Build library type(s)",
                        default=("shared"),
                        nargs='*',
                        type=str,
                        choices=("static", "shared"))
    parser.add_argument("--generate",
                        help="Generate the tests only",
                        action='store_true')

    args = parser.parse_args()

    if os.environ.get("CTEST_SITE") is not None:
        pyct.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyct.command(
                [cm, "--build", pyct.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyct.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyct.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyct.BINARY_DIRECTORY, "CMakeCache.txt"))

    if platform.system() != "Linux":
        args.papi = False

    os.environ["PYCTEST_TESTING"] = "ON"

    return args
Exemple #5
0
def configure():

    geant_binary_dir = os.path.join(os.getcwd(), "build-GeantExascalePilot",
                                    platform.system())

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="GeantExascalePilot",
                                    source_dir=os.getcwd(),
                                    binary_dir=geant_binary_dir,
                                    build_type="Release",
                                    vcs_type="git",
                                    use_launchers=True)

    parser.add_argument("--arch",
                        help="GEANT_USE_ARCH=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--gperf",
                        help="GEANT_USE_GPERF=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--tbb",
                        help="PTL_USE_TBB=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--sanitizer",
                        help="GEANT_USE_SANITIZER=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--no-static-analysis",
                        help="GEANT_USE_CLANG_TIDY=OFF",
                        default=False,
                        action='store_true')
    parser.add_argument("--coverage",
                        help="GEANT_USE_COVERAGE=ON",
                        default=False,
                        action='store_true')
    parser.add_argument("--num-tasks",
                        help="Set the number of tasks",
                        default=16384,
                        type=int)

    args = parser.parse_args()

    if os.environ.get("CTEST_SITE") is not None:
        pyctest.set("CTEST_SITE", "{}".format(os.environ.get("CTEST_SITE")))

    if os.path.exists(os.path.join(pyctest.BINARY_DIRECTORY,
                                   "CMakeCache.txt")):
        from pyctest import cmake_executable as cm
        from pyctest import version_info as _pyctest_version
        if (_pyctest_version[0] == 0 and _pyctest_version[1] == 0
                and _pyctest_version[2] < 11):
            cmd = pyctest.command(
                [cm, "--build", pyctest.BINARY_DIRECTORY, "--target", "clean"])
            cmd.SetWorkingDirectory(pyctest.BINARY_DIRECTORY)
            cmd.SetOutputQuiet(True)
            cmd.SetErrorQuiet(True)
            cmd.Execute()
        else:
            from pyctest.cmake import CMake
            CMake("--build", pyctest.BINARY_DIRECTORY, "--target", "clean")
        helpers.RemovePath(
            os.path.join(pyctest.BINARY_DIRECTORY, "CMakeCache.txt"))

    if args.gperf:
        pyctest.copy_files(["gperf_cpu_profile.sh", "gperf_heap_profile.sh"],
                           os.path.join(pyctest.SOURCE_DIRECTORY, ".scripts"),
                           pyctest.BINARY_DIRECTORY)

    return args
Exemple #6
0
def run_pyctest():

    repo_src = os.path.join(os.getcwd(), "tomopy-src")
    repo_bin = os.path.join(os.getcwd(), "tomopy-bin")
    helpers.RemovePath(repo_src)
    helpers.RemovePath(repo_bin)

    # Get pyctest argument parser that include PyCTest arguments
    parser = helpers.ArgumentParser(project_name="TomoPy",
                                    source_dir=repo_src,
                                    binary_dir=repo_bin,
                                    python_exe=sys.executable,
                                    vcs_type="git",
                                    ctest_args=["-VV"])

    default_repo_url = "https://github.com/tomopy/tomopy.git"
    default_repo_branch = "master"

    parser.add_argument("--repo-url",
                        help="Set the repository URL",
                        type=str,
                        default=default_repo_url)
    parser.add_argument("--repo-branch",
                        help="Branch of the repository",
                        type=str,
                        default=default_repo_branch)
    args = parser.parse_args()

    # executables
    pyexe = pyctest.PYTHON_EXECUTABLE
    pyexe_dir = os.path.dirname(pyexe)
    coverage_exe = os.path.join(pyexe_dir, "coverage")
    nosetests_exe = os.path.join(pyexe_dir, "nosetests")

    # Set the build name
    pyctest.BUILD_NAME = "[{}] [{} {} {}] [Python ({}) {}]".format(
        args.repo_branch,
        platform.uname()[0], helpers.GetSystemVersionInfo(),
        platform.uname()[4], platform.python_implementation(),
        platform.python_version())
    # Set the checkout command
    pyctest.CHECKOUT_COMMAND = "git clone -b {} {} {}".format(
        args.repo_branch, args.repo_url, pyctest.SOURCE_DIRECTORY)
    # Set the configuration command (copy to binary directory)
    pyctest.CONFIGURE_COMMAND = "cmake -E copy_directory {}/ {}/".format(
        pyctest.SOURCE_DIRECTORY, pyctest.BINARY_DIRECTORY)
    # Set the build command
    pyctest.BUILD_COMMAND = "{} setup.py build".format(
        pyctest.PYTHON_EXECUTABLE)

    #--------------------------------------------------------------------------#
    # create a CTest that wraps "nosetest"
    #
    pyctest.test(name="nosetests",
                 cmd=[pyexe, coverage_exe, "run", nosetests_exe],
                 properties={
                     "WORKING_DIRECTORY": pyctest.BINARY_DIRECTORY,
                     "TIMEOUT": "600",
                     "ENVIRONMENT": "OMP_NUM_THREADS=1"
                 })

    pyctest.run()