Commit graph

30 commits

Author SHA1 Message Date
Mislav Marohnić
fe8c6c26c6 Improve test output for failed stubs 2025-01-15 15:24:07 +01:00
Mislav Marohnić
c6f8eb38cf
Print external commands that ruby-build executes
ruby-build now prints the full invocation of (almost) every external
command that it runs. Typically that is something like:

    -> ./configure --prefix=/path/to/ruby
    -> make -j 2
    -> make install

All output of these commands still goes to the log file by default.

This changes the behavior of `--verbose` mode to simply redirect all
command output to the stdout & stderr of the parent process instead of
writing to and then tailing the log file. This allows implementations of
commands like `./configure` or `make` to detect a terminal and output
color.
2023-11-07 09:48:04 +01:00
Mislav Marohnić
a559b30fd8
Improve cached_tarball test helper
- Now only generates a `configure` script if explicitly specified
- Add ability to add arbitrary files to the tarball
- Cache most common tarballs in fixtures directory to speed up tests
2023-10-17 12:40:17 +02:00
Mislav Marohnić
4cc9dc3be8
appease linter 2023-03-06 19:19:31 +01:00
Mislav Marohnić
4079aa75cd
add stub_repeated test helper 2023-03-06 19:15:49 +01:00
Benoit Daloze
a753b24551 Show the log file to make it easy to follow progress
* Fixes https://github.com/rbenv/ruby-build/issues/1721
2022-08-06 13:04:40 +02:00
Benoit Daloze
44729b287f Handle multiple directories in PATH having an executable for remove_commands_from_path
* This is common on Linux where e.g. /bin = /usr/bin and both are in PATH.
2021-07-07 20:04:22 +02:00
Mislav Marohnić
e2b1da83bb Assert error shown when curl, wget, & aria2c are unavailable
Closes #1234
2019-11-04 14:48:46 +01:00
Jason Karns
dc15799456
Only FreeBSD needs extra PATH for bash
For the tests to run on FreeBSD, the bash executable needs to be
available in PATH.

The test_helper PATH was modified by
49a9471758 and f70d958f47
in order to be sure that bash is in PATH on FreeBSD.
(The default location for packages on FreeBSD is /usr/local/bin, and
since bash isn't provided by FreeBSD itself, that means /usr/local/bin
is the most common, if not only, location to find bash on FreeBSD.)

However, adding /usr/local/bin to PATH means that homebrew-managed
packages on macOS are now in PATH for the test suite. This is especially
important due to packages like readline. Since ruby-build prefers
homebrew readline when available, this makes the tests fail on macOS
(because the tests are written assuming no readline configuration.)

While the tests could stub brew in all cases, to ensure the readline
package is ignored by the tests, it seems more prudent to revert the
PATH to be as minimal as possible, and to only include /usr/local/bin by
precisely the OS that depends on it.
2018-11-12 14:26:56 -05:00
Yamashita, Yuu
34652a4fae Allow overriding HTTP client type based on environment variable RUBY_BUILD_HTTP_CLIENT (pyenv/pyenv#1126) 2018-04-26 02:08:59 +00:00
Yuichiro NAITO
f70d958f47 Do not include whole $PATH.
'/usr/local/bin' is used for bash on FreeBSD.
It is the default install path of FreeBSD packages.
2016-12-23 00:55:15 +09:00
Yuichiro NAITO
49a9471758 respect original PATH 2016-12-21 10:51:15 +09:00
Jason Karns
21494ba359 Remove suite-wide setup
Bats doesn't support both suite-wide setup (in helper) *and* file-wide
setup. Which means the existance of any file-level setup() function
overwrites any setup() function from test_helper. This can be confusing,
and (IMO) easier to simply avoid the overwriting and remove any
_implied_ suite-wide setup function from test_helper.

This turns out to not be so bad for the recently added setup function,
because the only test files that actually need aria2c removed from PATH
are those that actually invoke curl. These can be found because they are
the only test files that stub curl; half of which already had
file-specific setup() functions. So the only ones which need a
file-local setup() function added were: checksum.bats and mirror.bats

Along these lines, rbenv.bats and hooks.bats were removing aria2c from
PATH but don't actually need to. (curl isn't stubbed in these tests so
the existance of aria2c wouldn't affect the tests)

Lastly, fixed a tab/spaces whitespace mixup that was introduced by:
750c086d11
2016-08-13 15:53:04 -04:00
Yamashita, Yuu
2d2eef7012 Remove aria2c from PATH to use curl stub during test 2016-06-10 05:09:55 +00:00
Jason Karns
84b49768b9 Add refute test helper 2016-01-20 10:43:46 -05:00
Jason Karns
4ff6d72900 safer teardown 2015-12-02 13:55:36 -05:00
Mislav Marohnić
ff2b5dc90e Ensure that assert_output_contains receives an argument 2014-11-17 15:07:40 -08:00
Adam Harvey
2e6e100a2e Prefer ggrep for grep invocations that use GNU extensions. 2014-04-18 10:51:26 +10:00
Mislav Marohnić
501855c9ac Fix stubbing programs that have dashes in them 2014-01-05 18:58:57 +01:00
Mislav Marohnić
4351c46923 Add --patch flag to apply a Ruby patch from stdin
If `-p|--patch` flag was set while invoking `ruby-build` or
`rbenv install`, ruby-build will use `patch -p0 -i -` to apply a patch
from stdin to Ruby, Rubinius, or JRuby source code before running the
rest of `build_package_*` commands.

References #443
2013-12-11 21:16:47 +01:00
Mislav Marohnić
a6847fdd62 Reduce boilerplate in tests 2013-10-26 17:49:43 +02:00
Mislav Marohnić
c1f506dfd6 Fix unstub cleanup process for failed stubs 2013-10-26 17:43:54 +02:00
Mislav Marohnić
9aab127f75 Install Rake and Bundler in isolation when missing
Some Rubies need Rake or Bundler for the installation process. However,
since the host Ruby version might not have those gems installed, install
them in a temporary GEM_HOME and add their executables to PATH.

Fixes #426
2013-10-26 17:39:55 +02:00
Mislav Marohnić
262eb1658c Clearer error message when HTTP download fails
Previously, if `http get` failed, the `download_tarball` function would
still continue since the ERR trap had no effect at that point.

Given a script in the form of `{ ... } || return 1`, the expressions
that are the part of the first group are not subject to ERR trap since
they are non-last in a chain of expressions.

However, since we still can't count on the ERR trap taking effect in
this phase, better just rewrite the function to manually abort.

Fixes #394
2013-10-26 06:32:03 +02:00
Mislav Marohnić
5a68586740 Remove non-portable ln -h flag
Works on OS X but fails on CI.
2013-10-25 04:21:34 +02:00
Mislav Marohnić
c7851c5123 Add tests for Homebrew libyaml integration 2013-10-25 04:17:53 +02:00
Mislav Marohnić
5b6700cbf9 Simplify stubbing commands in tests
No more awkward juggling of PATH entries and preset stubs in version
control. Commands are stubbed by symlinking the main stub from a
temporary `$TMP/bin` directory that's added once to PATH in tests.
2013-10-25 02:01:50 +02:00
Mislav Marohnić
a9a274e624 Fix broken test suite
Fixes breakage caused by curl arguments change in
d0912e4fb5
2013-10-24 00:32:55 +02:00
Sam Stephenson
d924fceee5 Test package cache 2012-11-19 23:45:00 -06:00
Sam Stephenson
275b2f5919 Test checksumming 2012-11-19 18:14:26 -06:00