mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Use curl
stub instead of aria2c
during tests (equiv to rbenv/ruby-build#965)
This commit is contained in:
parent
a300254841
commit
0dcce750b9
9 changed files with 92 additions and 53 deletions
|
@ -8,9 +8,10 @@ export CC=cc
|
||||||
export -n PYTHON_CONFIGURE_OPTS
|
export -n PYTHON_CONFIGURE_OPTS
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
mkdir -p "$INSTALL_ROOT"
|
mkdir -p "$INSTALL_ROOT"
|
||||||
stub md5 false
|
stub md5 false
|
||||||
stub aria2c false
|
stub curl false
|
||||||
}
|
}
|
||||||
|
|
||||||
executable() {
|
executable() {
|
||||||
|
|
|
@ -3,27 +3,28 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=1
|
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||||
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
||||||
export PYTHON_BUILD_ARIA2_OPTS=
|
export PYTHON_BUILD_CURL_OPTS=
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
mkdir "$PYTHON_BUILD_CACHE_PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "packages are saved to download cache" {
|
@test "packages are saved to download cache" {
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/without-checksum
|
install_fixture definitions/without-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "cached package without checksum" {
|
@test "cached package without checksum" {
|
||||||
stub aria2c
|
stub curl
|
||||||
|
|
||||||
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
||||||
|
|
||||||
|
@ -32,13 +33,13 @@ setup() {
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "cached package with valid checksum" {
|
@test "cached package with valid checksum" {
|
||||||
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
stub aria2c
|
stub curl
|
||||||
|
|
||||||
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH"
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ setup() {
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +59,8 @@ setup() {
|
||||||
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
|
|
||||||
stub shasum true "echo invalid" "echo $checksum"
|
stub shasum true "echo invalid" "echo $checksum"
|
||||||
stub aria2c "--dry-run * : true" \
|
stub curl "-*I* * : true" \
|
||||||
"--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
|
"-q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
|
||||||
|
|
||||||
touch "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
|
touch "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
|
||||||
|
|
||||||
|
@ -70,13 +71,13 @@ setup() {
|
||||||
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
|
||||||
assert diff -q "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
|
assert diff -q "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" "${FIXTURE_ROOT}/package-1.0.0.tar.gz"
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "nonexistent cache directory is ignored" {
|
@test "nonexistent cache directory is ignored" {
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
export PYTHON_BUILD_CACHE_PATH="${TMP}/nonexistent"
|
export PYTHON_BUILD_CACHE_PATH="${TMP}/nonexistent"
|
||||||
|
|
||||||
|
@ -86,5 +87,5 @@ setup() {
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
refute [ -d "$PYTHON_BUILD_CACHE_PATH" ]
|
refute [ -d "$PYTHON_BUILD_CACHE_PATH" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,107 +3,107 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=1
|
export PYTHON_BUILD_SKIP_MIRROR=1
|
||||||
export PYTHON_BUILD_CACHE_PATH=
|
export PYTHON_BUILD_CACHE_PATH=
|
||||||
export PYTHON_BUILD_ARIA2_OPTS=
|
export PYTHON_BUILD_CURL_OPTS=
|
||||||
|
|
||||||
|
|
||||||
@test "package URL without checksum" {
|
@test "package URL without checksum" {
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/without-checksum
|
install_fixture definitions/without-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with valid checksum" {
|
@test "package URL with valid checksum" {
|
||||||
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with invalid checksum" {
|
@test "package URL with invalid checksum" {
|
||||||
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-invalid-checksum
|
install_fixture definitions/with-invalid-checksum
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
refute [ -f "${INSTALL_ROOT}/bin/package" ]
|
refute [ -f "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with checksum but no shasum support" {
|
@test "package URL with checksum but no shasum support" {
|
||||||
stub shasum false
|
stub shasum false
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with valid md5 checksum" {
|
@test "package URL with valid md5 checksum" {
|
||||||
stub md5 true "echo 83e6d7725e20166024a1eb74cde80677"
|
stub md5 true "echo 83e6d7725e20166024a1eb74cde80677"
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-md5-checksum
|
install_fixture definitions/with-md5-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub md5
|
unstub md5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with md5 checksum but no md5 support" {
|
@test "package URL with md5 checksum but no md5 support" {
|
||||||
stub md5 false
|
stub md5 false
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-md5-checksum
|
install_fixture definitions/with-md5-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub md5
|
unstub md5
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package with invalid checksum" {
|
@test "package with invalid checksum" {
|
||||||
stub shasum true "echo invalid"
|
stub shasum true "echo invalid"
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_failure
|
assert_failure
|
||||||
refute [ -f "${INSTALL_ROOT}/bin/package" ]
|
refute [ -f "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "existing tarball in build location is reused" {
|
@test "existing tarball in build location is reused" {
|
||||||
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
stub aria2c false
|
stub curl false
|
||||||
stub curl false
|
stub curl false
|
||||||
stub wget false
|
stub wget false
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ DEF
|
||||||
stub shasum true \
|
stub shasum true \
|
||||||
"echo invalid" \
|
"echo invalid" \
|
||||||
"echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
"echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
export -n PYTHON_BUILD_CACHE_PATH
|
export -n PYTHON_BUILD_CACHE_PATH
|
||||||
export PYTHON_BUILD_BUILD_PATH="${TMP}/build"
|
export PYTHON_BUILD_BUILD_PATH="${TMP}/build"
|
||||||
|
@ -146,7 +146,7 @@ DEF
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "package URL with checksum of unexpected length" {
|
@test "package URL with checksum of unexpected length" {
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
run_inline_definition <<DEF
|
run_inline_definition <<DEF
|
||||||
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy
|
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy
|
||||||
|
|
|
@ -5,12 +5,13 @@ export PYTHON_BUILD_SKIP_MIRROR=1
|
||||||
export PYTHON_BUILD_CACHE_PATH=
|
export PYTHON_BUILD_CACHE_PATH=
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
export PYTHON_BUILD_BUILD_PATH="${TMP}/source"
|
export PYTHON_BUILD_BUILD_PATH="${TMP}/source"
|
||||||
mkdir -p "${PYTHON_BUILD_BUILD_PATH}"
|
mkdir -p "${PYTHON_BUILD_BUILD_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "failed download displays error message" {
|
@test "failed download displays error message" {
|
||||||
stub aria2c false
|
stub curl false
|
||||||
|
|
||||||
install_fixture definitions/without-checksum
|
install_fixture definitions/without-checksum
|
||||||
assert_failure
|
assert_failure
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
load test_helper
|
load test_helper
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
export PYENV_ROOT="${TMP}/pyenv"
|
export PYENV_ROOT="${TMP}/pyenv"
|
||||||
export HOOK_PATH="${TMP}/i has hooks"
|
export HOOK_PATH="${TMP}/i has hooks"
|
||||||
mkdir -p "$HOOK_PATH"
|
mkdir -p "$HOOK_PATH"
|
||||||
|
|
|
@ -4,12 +4,12 @@ load test_helper
|
||||||
export PYTHON_BUILD_SKIP_MIRROR=
|
export PYTHON_BUILD_SKIP_MIRROR=
|
||||||
export PYTHON_BUILD_CACHE_PATH=
|
export PYTHON_BUILD_CACHE_PATH=
|
||||||
export PYTHON_BUILD_MIRROR_URL=http://mirror.example.com
|
export PYTHON_BUILD_MIRROR_URL=http://mirror.example.com
|
||||||
export PYTHON_BUILD_ARIA2_OPTS=
|
export PYTHON_BUILD_CURL_OPTS=
|
||||||
|
|
||||||
|
|
||||||
@test "package URL without checksum bypasses mirror" {
|
@test "package URL without checksum bypasses mirror" {
|
||||||
stub shasum true
|
stub shasum true
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/without-checksum
|
install_fixture definitions/without-checksum
|
||||||
echo "$output" >&2
|
echo "$output" >&2
|
||||||
|
@ -17,21 +17,21 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@test "package URL with checksum but no shasum support bypasses mirror" {
|
@test "package URL with checksum but no shasum support bypasses mirror" {
|
||||||
stub shasum false
|
stub shasum false
|
||||||
stub aria2c "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,15 +41,15 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
||||||
|
|
||||||
stub shasum true "echo $checksum"
|
stub shasum true "echo $checksum"
|
||||||
stub aria2c "--dry-run $mirror_url : true" \
|
stub curl "-*I* $mirror_url : true" \
|
||||||
"--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
|
"-q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,15 +59,15 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
||||||
|
|
||||||
stub shasum true "echo $checksum"
|
stub shasum true "echo $checksum"
|
||||||
stub aria2c "--dry-run $mirror_url : false" \
|
stub curl "-*I* $mirror_url : false" \
|
||||||
"--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$3"
|
"-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,9 +77,9 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
|
||||||
|
|
||||||
stub shasum true "echo invalid" "echo $checksum"
|
stub shasum true "echo invalid" "echo $checksum"
|
||||||
stub aria2c "--dry-run $mirror_url : true" \
|
stub curl "-*I* $mirror_url : true" \
|
||||||
"--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \
|
"-q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \
|
||||||
"--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
"-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
echo "$output" >&2
|
echo "$output" >&2
|
||||||
|
@ -87,7 +87,7 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,15 +97,15 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
|
|
||||||
stub shasum true "echo $checksum"
|
stub shasum true "echo $checksum"
|
||||||
stub aria2c "--dry-run : true" \
|
stub curl "-*I* : true" \
|
||||||
"--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \
|
"-q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \
|
||||||
|
|
||||||
install_fixture definitions/with-checksum
|
install_fixture definitions/with-checksum
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ export PYTHON_BUILD_ARIA2_OPTS=
|
||||||
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
|
||||||
|
|
||||||
stub shasum true "echo $checksum"
|
stub shasum true "echo $checksum"
|
||||||
stub aria2c "--allow-overwrite=true -o * https://www.python.org/* : cp $FIXTURE_ROOT/\${4##*/} \$3"
|
stub curl "-q -o * -*S* https://www.python.org/* : cp $FIXTURE_ROOT/\${5##*/} \$3"
|
||||||
|
|
||||||
run_inline_definition <<DEF
|
run_inline_definition <<DEF
|
||||||
install_package "package-1.0.0" "https://www.python.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy
|
install_package "package-1.0.0" "https://www.python.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy
|
||||||
|
@ -124,6 +124,6 @@ DEF
|
||||||
assert_success
|
assert_success
|
||||||
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
assert [ -x "${INSTALL_ROOT}/bin/package" ]
|
||||||
|
|
||||||
unstub aria2c
|
unstub curl
|
||||||
unstub shasum
|
unstub shasum
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ load test_helper
|
||||||
export PYENV_ROOT="${TMP}/pyenv"
|
export PYENV_ROOT="${TMP}/pyenv"
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
stub pyenv-hooks 'install : true'
|
stub pyenv-hooks 'install : true'
|
||||||
stub pyenv-rehash 'true'
|
stub pyenv-rehash 'true'
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,10 @@ export CC=cc
|
||||||
export TMP_FIXTURES="$TMP/fixtures"
|
export TMP_FIXTURES="$TMP/fixtures"
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
mkdir -p "$INSTALL_ROOT"
|
mkdir -p "$INSTALL_ROOT"
|
||||||
stub md5 false
|
stub md5 false
|
||||||
stub aria2c false
|
stub curl false
|
||||||
}
|
}
|
||||||
|
|
||||||
executable() {
|
executable() {
|
||||||
|
|
|
@ -9,6 +9,39 @@ if [ "$FIXTURE_ROOT" != "$BATS_TEST_DIRNAME/fixtures" ]; then
|
||||||
export PATH
|
export PATH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
remove_command_from_path() {
|
||||||
|
OLDIFS="${IFS}"
|
||||||
|
local cmd="$1"
|
||||||
|
local path
|
||||||
|
local paths=()
|
||||||
|
IFS=:
|
||||||
|
for path in ${PATH}; do
|
||||||
|
if [ -e "${path}/${cmd}" ]; then
|
||||||
|
local tmp_path="$(mktemp -d "${TMP}/path.XXXXX")"
|
||||||
|
ln -fs "${path}"/* "${tmp_path}"
|
||||||
|
rm -f "${tmp_path}/${cmd}"
|
||||||
|
paths["${#paths[@]}"]="${tmp_path}"
|
||||||
|
else
|
||||||
|
paths["${#paths[@]}"]="${path}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
export PATH="${paths[*]}"
|
||||||
|
IFS="${OLDIFS}"
|
||||||
|
}
|
||||||
|
|
||||||
|
ensure_not_found_in_path() {
|
||||||
|
local cmd
|
||||||
|
for cmd; do
|
||||||
|
if command -v "${cmd}" 1>/dev/null 2>&1; then
|
||||||
|
remove_command_from_path "${cmd}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
ensure_not_found_in_path aria2c
|
||||||
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
rm -fr "${TMP:?}"/*
|
rm -fr "${TMP:?}"/*
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue