mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-05 08:11:15 -03:00
Remove --cachedir for test_driver.py
This was only used to cache `fish_test_driver`, which can be built in a few tens of milliseconds on most systems. This avoids using outdated binaries for testing and simplifies the code and its usage.
This commit is contained in:
@@ -219,12 +219,10 @@ Or you can run them on a fish, without involving cmake::
|
||||
|
||||
cargo build
|
||||
cargo test # for the unit tests
|
||||
tests/test_driver.py --cachedir=/tmp target/debug # for the script and interactive tests
|
||||
tests/test_driver.py target/debug # for the script and interactive tests
|
||||
|
||||
Here, the first argument to test_driver.py refers to a directory with ``fish``, ``fish_indent`` and ``fish_key_reader`` in it.
|
||||
In this example we're in the root of the git repo and have run ``cargo build`` without ``--release``, so it's a debug build.
|
||||
The ``--cachedir /tmp`` argument means it will keep the fish_test_helper binary in /tmp instead of recompiling it for every test.
|
||||
This saves some time, but isn't strictly necessary.
|
||||
|
||||
Git hooks
|
||||
---------
|
||||
|
||||
@@ -63,7 +63,7 @@ foreach(CHECK ${FISH_CHECKS})
|
||||
get_filename_component(CHECK_NAME ${CHECK} NAME)
|
||||
get_filename_component(CHECK ${CHECK} NAME_WE)
|
||||
add_test(NAME ${CHECK_NAME}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
||||
checks/${CHECK}.fish
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||
)
|
||||
@@ -76,7 +76,7 @@ FILE(GLOB PEXPECTS CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/tests/pexpects/*.py)
|
||||
foreach(PEXPECT ${PEXPECTS})
|
||||
get_filename_component(PEXPECT ${PEXPECT} NAME)
|
||||
add_test(NAME ${PEXPECT}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py --cachedir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMAND ${CMAKE_SOURCE_DIR}/tests/test_driver.py ${CMAKE_CURRENT_BINARY_DIR}
|
||||
pexpects/${PEXPECT}
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||
)
|
||||
|
||||
@@ -80,25 +80,15 @@ def makeenv(script_path: Path, home: Path):
|
||||
)
|
||||
|
||||
|
||||
def compile_test_helper(
|
||||
cachedir: Optional[str], source_path: Path, binary_path: Path
|
||||
) -> None:
|
||||
# Compile fish_test_helper if necessary.
|
||||
# If we're run multiple times, allow keeping this around to save time.
|
||||
if cachedir:
|
||||
thp = Path(cachedir) / "fish_test_helper"
|
||||
if not os.path.exists(thp):
|
||||
subprocess.run(["cc", source_path, "-o", thp])
|
||||
shutil.copy(thp, binary_path)
|
||||
else:
|
||||
subprocess.run(
|
||||
[
|
||||
"cc",
|
||||
source_path,
|
||||
"-o",
|
||||
binary_path,
|
||||
]
|
||||
)
|
||||
def compile_test_helper(source_path: Path, binary_path: Path) -> None:
|
||||
subprocess.run(
|
||||
[
|
||||
"cc",
|
||||
source_path,
|
||||
"-o",
|
||||
binary_path,
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
@@ -111,14 +101,6 @@ def main():
|
||||
argparser = argparse.ArgumentParser(
|
||||
description="test_driver: Run fish's test suite"
|
||||
)
|
||||
argparser.add_argument(
|
||||
"-f",
|
||||
"--cachedir",
|
||||
type=str,
|
||||
help="Path to keep outputs to speed up the next run",
|
||||
action="store",
|
||||
default=None,
|
||||
)
|
||||
argparser.add_argument("fish", nargs=1, help="Fish to test")
|
||||
argparser.add_argument("file", nargs="*", help="Tests to run")
|
||||
args = argparser.parse_args()
|
||||
@@ -176,7 +158,6 @@ def main():
|
||||
tmp_root = Path(tmp_root)
|
||||
|
||||
compile_test_helper(
|
||||
args.cachedir,
|
||||
script_path / "fish_test_helper.c",
|
||||
tmp_root / "fish_test_helper",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user