Unverified Commit 1c8689b9 authored by Mislav Marohnić's avatar Mislav Marohnić
Browse files

Add tests for extra configure flags on the command-line

parent 6b6fa457
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -261,7 +261,10 @@ OUT
@test "readline is not linked from Homebrew when explicitly defined" {
  cached_tarball "ruby-2.0.0"

  stub_repeated brew false
  readline_libdir="$TMP/homebrew-readline"
  mkdir -p "$readline_libdir"

  stub_repeated brew "--prefix readline : echo '$readline_libdir'" ' : false'
  stub_make_install

  export RUBY_CONFIGURE_OPTS='--with-readline-dir=/custom'
@@ -280,6 +283,29 @@ make install
OUT
}

@test "forward extra command-line arguments as configure flags" {
  cached_tarball "ruby-2.0.0"

  stub_repeated brew false
  stub_make_install

  cat > "$TMP/build-definition" <<DEF
install_package "ruby-2.0.0" "http://ruby-lang.org/ruby/2.0/ruby-2.0.0.tar.gz"
DEF

  RUBY_CONFIGURE_OPTS='--with-readline-dir=/custom' run ruby-build "$TMP/build-definition" "$INSTALL_ROOT" -- cppflags="-DYJIT_FORCE_ENABLE -DRUBY_PATCHLEVEL_NAME=test" --with-openssl-dir=/path/to/openssl
  assert_success

  unstub brew
  unstub make

  assert_build_log <<OUT
ruby-2.0.0: [--prefix=$INSTALL_ROOT,cppflags=-DYJIT_FORCE_ENABLE -DRUBY_PATCHLEVEL_NAME=test,--with-openssl-dir=/path/to/openssl,--with-readline-dir=/custom]
make -j 2
make install
OUT
}

@test "number of CPU cores defaults to 2" {
  cached_tarball "ruby-2.0.0"

+11 −0
Original line number Diff line number Diff line
@@ -26,6 +26,17 @@ stub_ruby_build() {
  unstub rbenv-rehash
}

@test "install with flags" {
  stub_ruby_build 'echo "ruby-build $(inspect_args "$@")"'

  run rbenv-install -kpv 2.1.2 -- --with-configure-opt="hello world"
  assert_success "ruby-build --keep --verbose --patch 2.1.2 ${RBENV_ROOT}/versions/2.1.2 -- \"--with-configure-opt=hello world\""

  unstub ruby-build
  unstub rbenv-hooks
  unstub rbenv-rehash
}

@test "suggest running rbenv global after install" {
  rm -rf "$RBENV_ROOT/version"
  stub_ruby_build 'echo ruby-build "$@"'