mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-25 06:40:03 +00:00
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>
This commit is contained in:
parent
f1bfe23672
commit
b876bdc8c7
5 changed files with 67 additions and 7 deletions
|
@ -4,7 +4,11 @@ set -euxo pipefail
|
|||
|
||||
unset CARGO_INSTALL_ROOT
|
||||
|
||||
crates="b3sum@1.3.3 cargo-release@0.24.9 cargo-binstall@0.20.1 cargo-watch@8.4.0 miniserve@0.23.0 sccache@0.3.3"
|
||||
# - `b3sum@<=1.3.3` would test `fetch_crate_cratesio_version_matched` ability
|
||||
# to find versions matching <= 1.3.3
|
||||
# - `cargo-quickinstall` would test `fetch_crate_cratesio_version_matched` ability
|
||||
# to find latest stable version.
|
||||
crates="b3sum@<=1.3.3 cargo-release@0.24.9 cargo-binstall@0.20.1 cargo-watch@8.4.0 miniserve@0.23.0 sccache@0.3.3 cargo-quickinstall"
|
||||
|
||||
CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
|
||||
export CARGO_HOME
|
||||
|
@ -22,9 +26,32 @@ cargo binstall --no-confirm $crates
|
|||
rm -r "$othertmpdir"
|
||||
|
||||
# Test that the installed binaries can be run
|
||||
b3sum --version
|
||||
cargo-release release --version
|
||||
b3sum_version="$(b3sum --version)"
|
||||
echo "$b3sum_version"
|
||||
|
||||
[ "$b3sum_version" = "b3sum 1.3.3" ]
|
||||
|
||||
cargo_release_version="$(cargo-release release --version)"
|
||||
echo "$cargo_release_version"
|
||||
|
||||
[ "$cargo_release_version" = "cargo-release 0.24.9" ]
|
||||
|
||||
cargo-binstall --help >/dev/null
|
||||
cargo binstall --help >/dev/null
|
||||
cargo watch -V
|
||||
miniserve -V
|
||||
|
||||
cargo_binstall_version="$(cargo-binstall -V)"
|
||||
echo "cargo-binstall version $cargo_binstall_version"
|
||||
|
||||
[ "$cargo_binstall_version" = "0.20.1" ]
|
||||
|
||||
cargo_watch_version="$(cargo watch -V)"
|
||||
echo "$cargo_watch_version"
|
||||
|
||||
[ "$cargo_watch_version" = "cargo-watch 8.4.0" ]
|
||||
|
||||
miniserve_version="$(miniserve -V)"
|
||||
echo "$miniserve_version"
|
||||
|
||||
[ "$miniserve_version" = "miniserve 0.23.0" ]
|
||||
|
||||
cargo-quickinstall -V
|
||||
|
|
|
@ -11,5 +11,11 @@ export PATH="$CARGO_HOME/bin:$PATH"
|
|||
# Install binaries using `--manifest-path`
|
||||
# Also test default github template
|
||||
"./$1" binstall --force --manifest-path "manifests/github-test-Cargo.toml" --no-confirm cargo-binstall
|
||||
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
cargo_binstall_version="$(cargo binstall -V)"
|
||||
echo "$cargo_binstall_version"
|
||||
|
||||
[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ]
|
||||
|
|
|
@ -24,6 +24,14 @@ export PATH="$CARGO_HOME/bin:$PATH"
|
|||
--disable-strategies compile \
|
||||
cargo-binstall
|
||||
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
cargo_binstall_version="$(cargo binstall -V)"
|
||||
echo "$cargo_binstall_version"
|
||||
|
||||
[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ]
|
||||
|
||||
# Test default Github pkg-url templates,
|
||||
# with bin-dir provided
|
||||
"./$1" binstall \
|
||||
|
@ -32,3 +40,11 @@ export PATH="$CARGO_HOME/bin:$PATH"
|
|||
--no-confirm \
|
||||
--disable-strategies compile \
|
||||
cargo-binstall
|
||||
|
||||
# Test that the installed binaries can be run
|
||||
cargo binstall --help >/dev/null
|
||||
|
||||
cargo_binstall_version="$(cargo binstall -V)"
|
||||
echo "$cargo_binstall_version"
|
||||
|
||||
[ "$cargo_binstall_version" = "cargo-binstall 0.12.0" ]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -uxo pipefail
|
||||
set -euxo pipefail
|
||||
|
||||
unset CARGO_INSTALL_ROOT
|
||||
|
||||
|
@ -9,18 +9,26 @@ export CARGO_HOME
|
|||
export PATH="$CARGO_HOME/bin:$PATH"
|
||||
|
||||
## Test --disable-strategies
|
||||
set +e
|
||||
|
||||
"./$1" binstall --no-confirm --disable-strategies quick-install,compile cargo-update@11.1.2
|
||||
exit_code="$?"
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$exit_code" != 94 ]; then
|
||||
echo "Expected exit code 94, but actual exit code $exit_code"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
## Test --strategies
|
||||
set +e
|
||||
|
||||
"./$1" binstall --no-confirm --strategies crate-meta-data cargo-update@11.1.2
|
||||
exit_code="$?"
|
||||
|
||||
set -e
|
||||
|
||||
if [ "$exit_code" != 94 ]; then
|
||||
echo "Expected exit code 94, but actual exit code $exit_code"
|
||||
exit 1
|
||||
|
|
|
@ -15,4 +15,7 @@ cp "./$1" "$othertmpdir/bin/"
|
|||
|
||||
cargo binstall --no-confirm cargo-audit@0.17.5 --strategies crate-meta-data
|
||||
|
||||
cargo audit --version
|
||||
cargo_audit_version="$(cargo audit --version)"
|
||||
echo "$cargo_audit_version"
|
||||
|
||||
[ "$cargo_audit_version" = "cargo-audit 0.17.5" ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue