cargo-binstall/e2e-tests/subcrate.sh
Jiahao XU b876bdc8c7
e2e-tests: Check version of installed crates (#1119)
and also test `fetch_crate_cratesio_version_matched` in
`e2e-tests/live.sh`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-06-03 08:28:44 +00:00

21 lines
572 B
Bash
Executable file

#!/bin/bash
set -euxo pipefail
unset CARGO_INSTALL_ROOT
CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export CARGO_HOME
othertmpdir=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-test')
export PATH="$CARGO_HOME/bin:$othertmpdir/bin:$PATH"
mkdir -p "$othertmpdir/bin"
# Copy it to bin to test use of env var `CARGO`
cp "./$1" "$othertmpdir/bin/"
cargo binstall --no-confirm cargo-audit@0.17.5 --strategies crate-meta-data
cargo_audit_version="$(cargo audit --version)"
echo "$cargo_audit_version"
[ "$cargo_audit_version" = "cargo-audit 0.17.5" ]