Commit a6847fdd by Mislav Marohnić

Reduce boilerplate in tests

parent c1f506df
...@@ -128,24 +128,18 @@ OUT ...@@ -128,24 +128,18 @@ OUT
} }
@test "mruby strategy overwrites non-writable files" { @test "mruby strategy overwrites non-writable files" {
mkdir -p "$RUBY_BUILD_CACHE_PATH" cached_tarball "mruby-1.0" build/host/bin/{mruby,mirb}
cd "$RUBY_BUILD_CACHE_PATH"
mkdir -p "mruby-1.0/build/host/bin"
touch "mruby-1.0/build/host/bin"/{mruby,mirb}
tar czf "mruby-1.0.tar.gz" "mruby-1.0"
mkdir -p "$INSTALL_ROOT/bin" mkdir -p "$INSTALL_ROOT/bin"
touch "$INSTALL_ROOT/bin/mruby" touch "$INSTALL_ROOT/bin/mruby"
chmod -w "$INSTALL_ROOT/bin/mruby" chmod -w "$INSTALL_ROOT/bin/mruby"
cat > "definition" <<DEF
install_package "mruby-1.0" "http://ruby-lang.org/pub/mruby-1.0.tar.gz" mruby
DEF
stub gem false stub gem false
stub rake '--version : true' true stub rake '--version : true' true
run ruby-build "definition" "$INSTALL_ROOT" run_inline_definition <<DEF
install_package "mruby-1.0" "http://ruby-lang.org/pub/mruby-1.0.tar.gz" mruby
DEF
assert_success assert_success
unstub rake unstub rake
...@@ -158,11 +152,6 @@ DEF ...@@ -158,11 +152,6 @@ DEF
@test "rbx uses bundle then rake" { @test "rbx uses bundle then rake" {
cached_tarball "rubinius-2.0.0" "Gemfile" cached_tarball "rubinius-2.0.0" "Gemfile"
cd "$TMP"
cat > "definition" <<DEF
install_package "rubinius-2.0.0" "http://releases.rubini.us/rubinius-2.0.0.tar.gz" rbx
DEF
stub gem false stub gem false
stub rake false stub rake false
stub bundle \ stub bundle \
...@@ -171,7 +160,9 @@ DEF ...@@ -171,7 +160,9 @@ DEF
'--version : true' \ '--version : true' \
" exec rake install : { cat build.log; echo bundle \"\$@\"; } >> '$INSTALL_ROOT/build.log'" " exec rake install : { cat build.log; echo bundle \"\$@\"; } >> '$INSTALL_ROOT/build.log'"
run ruby-build "definition" "$INSTALL_ROOT" run_inline_definition <<DEF
install_package "rubinius-2.0.0" "http://releases.rubini.us/rubinius-2.0.0.tar.gz" rbx
DEF
assert_success assert_success
unstub bundle unstub bundle
......
...@@ -44,6 +44,12 @@ unstub() { ...@@ -44,6 +44,12 @@ unstub() {
return "$STATUS" return "$STATUS"
} }
run_inline_definition() {
local definition="${TMP}/build-definition"
cat > "$definition"
run ruby-build "$definition" "${1:-$INSTALL_ROOT}"
}
install_fixture() { install_fixture() {
local name="$1" local name="$1"
local destination="$2" local destination="$2"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment