test: run from host

This commit is contained in:
Mitchell Hashimoto
2022-07-17 17:11:18 -07:00
parent b04ade67aa
commit 70a8245809
4 changed files with 18 additions and 1 deletions

View File

@ -42,4 +42,4 @@ COPY --from=vttest /vttest /usr/bin/vttest
COPY ./run.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/bin/bash"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

12
test/run-host.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
#
# 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.
docker run \
--init \
--rm \
-v $(pwd):/src \
--entrypoint "xvfb-run" \
$(docker build -q .) \
/entrypoint.sh $@

View File

@ -19,16 +19,21 @@ function has_func() {
#--------------------------------------------------------------------
# Flag parsing
ARG_UPDATE=0
while [[ "$#" -gt 0 ]]; do
case $1 in
-e|--exec) ARG_EXEC="$2"; shift ;;
-c|--case) ARG_CASE="$2"; shift ;;
-o|--output) ARG_OUT="$2"; shift ;;
-u|--update) ARG_UPDATE=1 ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# If we're updating, then just update the file in-place
if [ "$ARG_UPDATE" -eq 1 ]; then ARG_OUT="${ARG_CASE}.png"; fi
bad=0
if [ -z "$ARG_EXEC" ]; then bad=1; fi
if [ -z "$ARG_CASE" ]; then bad=1; fi