mirror of
https://github.com/lobaro/restic-backup-docker.git
synced 2026-11-14 16:02:43 +00:00
fix: make the test suites work on Windows/Git-Bash out of the box
MSYS rewrites POSIX-looking arguments before docker sees them, so `docker exec <id> /usr/bin/backup` arrived as `C:/Program Files/Git/usr/bin/backup` and the structure suite could not read `--config /test/structure.yml`. 23 of 32 compat assertions and the whole structure suite failed on Git-Bash, while test/lib.sh claimed the suites behave identically on every platform. test/lib.sh and test/run.sh now export MSYS_NO_PATHCONV=1 and MSYS2_ARG_CONV_EXCL='*' themselves - lib.sh for the suites that source it, run.sh for its own docker calls and the suites it starts as separate processes. Both variables are ignored on Linux and macOS. README documents that nothing has to be exported by hand. Verified on Git-Bash without any variable set in the environment: structure 13/13, compat 32/32, features 4 SKIP, exit 0, and `bash test/run.sh --sabotage` still reports "sabotage check ok". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Agent-Id: agent-4966d0e6-7f4d-4b37-be3d-0648ed56cb8a
This commit is contained in:
1 parent
9f1c80951d
commit
6cb2f72cf9
3 files changed
+23
No files matched your search
@@ -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 <id> /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}"
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
Reference in new issue
Block a user