def METHOD_NAME(qemu: boot_cheribsd.CheriBSDInstance, args: argparse.Namespace):
    if not args.extra_library_paths:
        # If the used passed extra library paths assume that those are correct.
        # Otherwise, set up the default LD_LIBRARY_PATH to include the sysroot
        # and the libraries from the build directory.
        boot_cheribsd.set_ld_library_path_with_sysroot(qemu)
        # Prefer the files from the build directory over the sysroot.
        boot_cheribsd.prepend_ld_library_path(qemu, "/build/lib:/build/bin")
    # If the user supplied test setup steps, run them now.
    if args.test_setup_commands:
        for command in args.test_setup_commands:
            qemu.checked_run(command)
    # Update all references to CMAKE_COMMAND in the CTest file. Otherwise tests that use something like
    # `${CMAKE} -E copy_if_different ...` will fail.
    cmake_cache = Path(args.build_dir, "CMakeCache.txt")
    host_cmake_path = None
    if cmake_cache.is_file():
        with cmake_cache.open("rb") as f:
            for line in f.readlines():
                if line.startswith(b"CMAKE_COMMAND:INTERNAL="):
                    host_cmake_path = line[len(b"CMAKE_COMMAND:INTERNAL=") :].strip()
                    boot_cheribsd.info("Host CMake path is ", host_cmake_path)
                    break
    for ctest_file in Path(args.build_dir).rglob("CTestTestfile.cmake"):
        boot_cheribsd.info("Updating references to ${CMAKE_COMMAND} in ", ctest_file)
        ctest_contents = ctest_file.read_bytes()
        num_host_paths = ctest_contents.count(host_cmake_path)
        if num_host_paths > 0:
            if not host_cmake_path:
                boot_cheribsd.failure("Cannot update host CMake path in ", ctest_file, exit=True)
                continue
            new_contents = ctest_contents.replace(host_cmake_path, b"/cmake/bin/cmake")
            if not boot_cheribsd.PRETEND:
                ctest_file.write_bytes(new_contents)
            boot_cheribsd.info("Updated ", num_host_paths, " references to ${CMAKE_COMMAND} in ", ctest_file)
    # Add CMake/CTest to $PATH
    qemu.checked_run("export PATH=$PATH:/cmake/bin")