test: start preparing to run ourselfs in the harness

This commit is contained in:
Mitchell Hashimoto
2022-07-17 19:33:27 -07:00
parent 1586afe64b
commit ad2a795b9d
4 changed files with 50 additions and 0 deletions

1
.gitignore vendored
View File

@ -2,5 +2,6 @@
zig-cache/
zig-out/
/result*
test/ghostty
glad.zip

41
test/README.md Normal file
View File

@ -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`).

View File

@ -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 \

View File

@ -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.