Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
ruby-build
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ruby-build
Commits
b3ba8c86
Commit
b3ba8c86
authored
Jun 10, 2016
by
Yamashita, Yuu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `curl` stub during tests by default
parent
2d2eef70
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
52 deletions
+52
-52
test/build.bats
+1
-1
test/cache.bats
+12
-12
test/checksum.bats
+18
-18
test/fetch.bats
+1
-1
test/mirror.bats
+20
-20
No files found.
test/build.bats
View file @
b3ba8c86
...
...
@@ -11,7 +11,7 @@ setup() {
ensure_not_found_in_path aria2c
mkdir -p "$INSTALL_ROOT"
stub md5 false
stub
aria2c
false
stub
curl
false
}
executable() {
...
...
test/cache.bats
View file @
b3ba8c86
...
...
@@ -3,7 +3,7 @@
load test_helper
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH="$TMP/cache"
export RUBY_BUILD_
ARIA2
_OPTS=
export RUBY_BUILD_
CURL
_OPTS=
setup() {
ensure_not_found_in_path aria2c
...
...
@@ -12,19 +12,19 @@ setup() {
@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 "${RUBY_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" "$RUBY_BUILD_CACHE_PATH"
...
...
@@ -33,13 +33,13 @@ setup() {
assert_success
assert [ -e "${RUBY_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" "$RUBY_BUILD_CACHE_PATH"
...
...
@@ -49,7 +49,7 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
unstub
aria2c
unstub
curl
unstub shasum
}
...
...
@@ -59,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 "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz"
...
...
@@ -71,13 +71,13 @@ setup() {
assert [ -e "${RUBY_BUILD_CACHE_PATH}/package-1.0.0.tar.gz" ]
assert diff -q "${RUBY_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 RUBY_BUILD_CACHE_PATH="${TMP}/nonexistent"
...
...
@@ -87,5 +87,5 @@ setup() {
assert [ -x "${INSTALL_ROOT}/bin/package" ]
refute [ -d "$RUBY_BUILD_CACHE_PATH" ]
unstub
aria2c
unstub
curl
}
test/checksum.bats
View file @
b3ba8c86
...
...
@@ -3,107 +3,107 @@
load test_helper
export RUBY_BUILD_SKIP_MIRROR=1
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_
ARIA2
_OPTS=
export RUBY_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 wget false
export -n RUBY_BUILD_CACHE_PATH
...
...
@@ -126,7 +126,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 RUBY_BUILD_CACHE_PATH
export RUBY_BUILD_BUILD_PATH="${TMP}/build"
...
...
@@ -145,7 +145,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 <<DEF
install_package "package-1.0.0" "http://example.com/packages/package-1.0.0.tar.gz#checksum_of_unexpected_length" copy
...
...
test/fetch.bats
View file @
b3ba8c86
...
...
@@ -11,7 +11,7 @@ setup() {
}
@test "failed download displays error message" {
stub
aria2c
false
stub
curl
false
install_fixture definitions/without-checksum
assert_failure
...
...
test/mirror.bats
View file @
b3ba8c86
...
...
@@ -4,12 +4,12 @@ load test_helper
export RUBY_BUILD_SKIP_MIRROR=
export RUBY_BUILD_CACHE_PATH=
export RUBY_BUILD_MIRROR_URL=http://mirror.example.com
export RUBY_BUILD_
ARIA2
_OPTS=
export RUBY_BUILD_
CURL
_OPTS=
@test "package URL without checksum bypasses mirror" {
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
echo "$output" >&2
...
...
@@ -17,21 +17,21 @@ export RUBY_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 RUBY_BUILD_ARIA2_OPTS=
local mirror_url="${RUBY_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 RUBY_BUILD_ARIA2_OPTS=
local mirror_url="${RUBY_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/\${4
##*/} \$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 RUBY_BUILD_ARIA2_OPTS=
local mirror_url="${RUBY_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 RUBY_BUILD_ARIA2_OPTS=
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
aria2c
unstub
curl
unstub shasum
}
...
...
@@ -97,15 +97,15 @@ export RUBY_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 RUBY_BUILD_ARIA2_OPTS=
local checksum="ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5"
stub shasum true "echo $checksum"
stub
aria2c "--allow-overwrite=true -o * https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${4
##*/} \$3"
stub
curl "-q -o * -*S* https://cache.ruby-lang.org/* : cp $FIXTURE_ROOT/\${5
##*/} \$3"
run_inline_definition <<DEF
install_package "package-1.0.0" "https://cache.ruby-lang.org/packages/package-1.0.0.tar.gz#ba988b1bb4250dee0b9dd3d4d722f9c64b2bacfc805d1b6eba7426bda72dd3c5" copy
...
...
@@ -124,6 +124,6 @@ DEF
assert_success
assert [ -x "${INSTALL_ROOT}/bin/package" ]
unstub
aria2c
unstub
curl
unstub shasum
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment