mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-25 01:44:43 +01:00
platformtest: fix logmockzfs wrapper script / make test-platform for Go 1.19
See the comment in the script. refs https://github.com/golang/go/issues/53962 used by make test-platform breaks the test on Go 1.19
This commit is contained in:
parent
4fae0bb68e
commit
59389b84a2
@ -4,6 +4,21 @@ export ZREPL_MOCK_ZFS_COMMAND_LOG="$1"
|
||||
shift
|
||||
export ZREPL_MOCK_ZFS_PATH="$1"
|
||||
shift
|
||||
export PATH="$(dirname "${BASH_SOURCE[0]}" )":"$PATH"
|
||||
dirname="$(dirname "${BASH_SOURCE[0]}")"
|
||||
# If we invoke this script from the top zrepl source tree, like so:
|
||||
# ./platformtest/logmockzfs/logzfsenv ...
|
||||
# then dirname is relative, i.e., ./platformtest/logmockzfs.
|
||||
# If we put that relative dir in PATH, then Go >= 1.19 will refuse to
|
||||
# exec the `./platformtest/logmockzfs/zfs` wrapper script if it finds
|
||||
# it via PATH lookup. For Example:
|
||||
# cmd := exec.Command("zfs")
|
||||
# err := cmd.Run()
|
||||
# will fail with an error that errors.Is(err, exec.ErrDot), message:
|
||||
# cannot run executable found relative to current directory
|
||||
# The solution is to use an abspath.
|
||||
# Learn more at https://pkg.go.dev/os/exec#hdr-Executables_in_the_current_directory
|
||||
# and https://go-review.googlesource.com/c/go/+/381374
|
||||
absdirname="$(readlink -e "$dirname")"
|
||||
export PATH="$absdirname":"$PATH"
|
||||
args=("$@")
|
||||
exec "${args[@]}"
|
||||
|
Loading…
Reference in New Issue
Block a user