diff --git a/README.md b/README.md index 960edbd..2ff88d0 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ bash test/run.sh --no-build # reuse an already built image bash test/run.sh --suite compat # run a single suite ``` +They run unchanged on Linux, macOS and Windows/Git-Bash. On Git-Bash the +scripts set `MSYS_NO_PATHCONV=1` and `MSYS2_ARG_CONV_EXCL='*'` themselves, +because MSYS would otherwise rewrite container paths such as +`/usr/bin/backup` into `C:/Program Files/Git/usr/bin/backup` before `docker` +sees them. Nothing has to be exported by hand. + There are three suites: * **compat** (`test/compat.sh`) - backup, restore, forget, check, hooks and diff --git a/test/lib.sh b/test/lib.sh index 71d6fc1..5acc01b 100644 --- a/test/lib.sh +++ b/test/lib.sh @@ -4,6 +4,15 @@ # Deliberately dependency-free: bash + docker only. No test framework, no # host-side bind mounts (files are moved with `docker cp`) so the suites behave # identically on Linux CI runners, macOS and Windows/Git-Bash. +# +# Windows/Git-Bash needs one extra thing: MSYS rewrites every argument that +# looks like a POSIX path before the process sees it, so +# `docker exec /usr/bin/backup` reaches the daemon as +# `C:/Program Files/Git/usr/bin/backup` and the container command is not found. +# Both variables are required (one covers the command, one covers its +# arguments) and both are ignored on Linux and macOS. +export MSYS_NO_PATHCONV=1 +export MSYS2_ARG_CONV_EXCL='*' IMAGE="${IMAGE:-restic-backup-docker:test}" diff --git a/test/run.sh b/test/run.sh index 5295f1b..0cba1a6 100644 --- a/test/run.sh +++ b/test/run.sh @@ -12,6 +12,14 @@ set -u +# Windows/Git-Bash: MSYS mangles POSIX-looking arguments on their way to the +# docker daemon, which breaks `docker exec` and `--config /test/structure.yml`. +# lib.sh exports the same two variables for the suites that source it; run.sh +# calls docker itself and starts the suites as separate processes, so it needs +# them as well. Both are ignored on Linux and macOS. +export MSYS_NO_PATHCONV=1 +export MSYS2_ARG_CONV_EXCL='*' + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" IMAGE="${IMAGE:-restic-backup-docker:test}"