import os

import lit.formats
import lit.util

config.name = "shtest-readfile"
config.suffixes = [".txt"]
lit_shell_env = os.environ.get("LIT_USE_INTERNAL_SHELL")
use_lit_shell = lit.util.pythonize_bool(lit_shell_env)
config.test_format = lit.formats.ShTest(execute_external=not use_lit_shell)
config.test_source_root = None
config.test_exec_root = None
config.substitutions.append(("%{python}", '"%s"' % (sys.executable)))

# If we are testing with the external shell, remove the fake-externals from
# PATH so that we use mkdir in the tests.
if not use_lit_shell:
    path_parts = config.environment["PATH"].split(os.path.pathsep)
    path_parts = [path_part for path_part in path_parts if "fake-externals" not in path_part]
    config.environment["PATH"] = os.path.pathsep.join(path_parts)
