diff --git a/.gitignore b/.gitignore index d55a6320c..e6a5267e6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ zig-cache/ zig-out/ /result* +test/ghostty glad.zip diff --git a/test/README.md b/test/README.md new file mode 100644 index 000000000..81358f62f --- /dev/null +++ b/test/README.md @@ -0,0 +1,41 @@ +# Acceptance Testing + +This directory contains an acceptance test suite for ghostty. This works +by running the terminal emulator within a windowing environment, capturing a +screenshot, and comparing results. We use this to visually verify that +all rendering conforms to what we expect. + +This test suite can also execute alternate terminal emulators so that we +can easily compare outputs between them. + +## Running a Single Test + +To run a single test, use the `run-host.sh` script. This must be executed +from this directory. Example: + +```shell-session +$ ./run-host.sh --exec xterm --case /src/cases/vttest/launch.sh +``` + +The `--case` flag uses `/src` as the root for this directory. + +The `--update` flag can be used to update the screenshot in place. This +should be used to gather a new screenshot. If you want to compare to the old +screenshot, copy the old one or use git to revert. + +## Running the Full Suite + +**Warning:** This can take a long time and isn't recommended. The CI +environment automatically runs the full test suite and is the recommended +approach. + +To run the full test suite against all terminal emulators, use the +`run-all.sh` script. This optionally takes an `--exec` parameter to run +the full test suite against only a single terminal emulator. + +## Modifying the `ghostty` Binary + +This test suite expects the `ghostty` binary to be in _this directory_. +You can manually copy it into place. By default, if the binary doesn't exist, +the various host-side shell scripts will try to copy from +`../zig-out/bin/ghostty` (resulting from `zig build`). diff --git a/test/run-host.sh b/test/run-host.sh index 7538c237c..15d7d2a1f 100755 --- a/test/run-host.sh +++ b/test/run-host.sh @@ -3,6 +3,10 @@ # This runs a single test case from the host (not from Docker itself). The # arguments are the same as run.sh but this wraps it in docker. +if [ ! -f "ghostty" ]; then + cp ../zig-out/bin/ghostty . +fi + docker run \ --init \ --rm \ diff --git a/test/run.sh b/test/run.sh index a0643df57..781ccb029 100755 --- a/test/run.sh +++ b/test/run.sh @@ -55,6 +55,10 @@ fi echo "Term: ${ARG_EXEC}" echo "Case: ${ARG_CASE}" +if [ "$ARG_EXEC" = "ghostty" ]; then + ARG_EXEC="/src/ghostty"; +fi + #-------------------------------------------------------------------- # Some terminals require XDG be properly setup. We create a new # set of XDG directories for this.