diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index ce7ced95..236a3d7c 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -8,9 +8,10 @@ export CC=cc export -n PYTHON_CONFIGURE_OPTS setup() { + ensure_not_found_in_path aria2c mkdir -p "$INSTALL_ROOT" stub md5 false - stub aria2c false + stub curl false } executable() { diff --git a/plugins/python-build/test/cache.bats b/plugins/python-build/test/cache.bats index 00445ee5..88b3f89d 100644 --- a/plugins/python-build/test/cache.bats +++ b/plugins/python-build/test/cache.bats @@ -3,27 +3,28 @@ load test_helper export PYTHON_BUILD_SKIP_MIRROR=1 export PYTHON_BUILD_CACHE_PATH="$TMP/cache" -export PYTHON_BUILD_ARIA2_OPTS= +export PYTHON_BUILD_CURL_OPTS= setup() { + ensure_not_found_in_path aria2c mkdir "$PYTHON_BUILD_CACHE_PATH" } @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 assert_success assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ] - unstub aria2c + unstub curl } @test "cached package without checksum" { - stub aria2c + stub curl cp "${FIXTURE_ROOT}/package-1.0.0.tar.gz" "$PYTHON_BUILD_CACHE_PATH" @@ -32,13 +33,13 @@ setup() { assert_success assert [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ] - unstub aria2c + unstub curl } @test "cached package with valid checksum" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" - stub aria2c + stub curl 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 [ -e "${PYTHON_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ] - unstub aria2c + unstub curl unstub shasum } @@ -58,8 +59,8 @@ setup() { local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub shasum true "echo invalid" "echo $checksum" - stub aria2c "--dry-run * : true" \ - "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" + stub curl "-*I* * : true" \ + "-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" @@ -70,13 +71,13 @@ setup() { 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" - unstub aria2c + unstub curl unstub shasum } @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" @@ -86,5 +87,5 @@ setup() { assert [ -x "${INSTALL_ROOT}/bin/package" ] refute [ -d "$PYTHON_BUILD_CACHE_PATH" ] - unstub aria2c + unstub curl } diff --git a/plugins/python-build/test/checksum.bats b/plugins/python-build/test/checksum.bats index 9efd8dcc..7cbc1af8 100644 --- a/plugins/python-build/test/checksum.bats +++ b/plugins/python-build/test/checksum.bats @@ -3,107 +3,107 @@ load test_helper export PYTHON_BUILD_SKIP_MIRROR=1 export PYTHON_BUILD_CACHE_PATH= -export PYTHON_BUILD_ARIA2_OPTS= +export PYTHON_BUILD_CURL_OPTS= @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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl } @test "package URL with valid checksum" { 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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @test "package URL with invalid checksum" { 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 assert_failure refute [ -f "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @test "package URL with checksum but no shasum support" { 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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @test "package URL with valid md5 checksum" { 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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub md5 } @test "package URL with md5 checksum but no md5 support" { 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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub md5 } @test "package with invalid checksum" { 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 assert_failure refute [ -f "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @test "existing tarball in build location is reused" { stub shasum true "echo ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" - stub aria2c false + stub curl false stub curl false stub wget false @@ -127,7 +127,7 @@ DEF stub shasum true \ "echo invalid" \ "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 PYTHON_BUILD_BUILD_PATH="${TMP}/build" @@ -146,7 +146,7 @@ DEF } @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 <&2 @@ -17,21 +17,21 @@ export PYTHON_BUILD_ARIA2_OPTS= assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @test "package URL with checksum but no shasum support bypasses mirror" { 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 assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @@ -41,15 +41,15 @@ export PYTHON_BUILD_ARIA2_OPTS= local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum" stub shasum true "echo $checksum" - stub aria2c "--dry-run $mirror_url : true" \ - "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" + stub curl "-*I* $mirror_url : true" \ + "-q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" install_fixture definitions/with-checksum assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @@ -59,15 +59,15 @@ export PYTHON_BUILD_ARIA2_OPTS= local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum" stub shasum true "echo $checksum" - stub aria2c "--dry-run $mirror_url : false" \ - "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${3##*/} \$3" + stub curl "-*I* $mirror_url : false" \ + "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3" install_fixture definitions/with-checksum assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @@ -77,9 +77,9 @@ export PYTHON_BUILD_ARIA2_OPTS= local mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum" stub shasum true "echo invalid" "echo $checksum" - stub aria2c "--dry-run $mirror_url : true" \ - "--allow-overwrite=true -o * $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ - "--allow-overwrite=true -o * http://example.com/* : cp $FIXTURE_ROOT/\${4##*/} \$3" + stub curl "-*I* $mirror_url : true" \ + "-q -o * -*S* $mirror_url : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ + "-q -o * -*S* http://example.com/* : cp $FIXTURE_ROOT/\${5##*/} \$3" install_fixture definitions/with-checksum echo "$output" >&2 @@ -87,7 +87,7 @@ export PYTHON_BUILD_ARIA2_OPTS= assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @@ -97,15 +97,15 @@ export PYTHON_BUILD_ARIA2_OPTS= local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" stub shasum true "echo $checksum" - stub aria2c "--dry-run : true" \ - "--allow-overwrite=true -o * https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ + stub curl "-*I* : true" \ + "-q -o * -*S* https://?*/$checksum : cp $FIXTURE_ROOT/package-1.0.0.tar.gz \$3" \ install_fixture definitions/with-checksum assert_success assert [ -x "${INSTALL_ROOT}/bin/package" ] - unstub aria2c + unstub curl unstub shasum } @@ -115,7 +115,7 @@ export PYTHON_BUILD_ARIA2_OPTS= local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" 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 </dev/null 2>&1; then + remove_command_from_path "${cmd}" + fi + done +} + +setup() { + ensure_not_found_in_path aria2c +} + teardown() { rm -fr "${TMP:?}"/* }