Implement brew test --debug
This commit is contained in:
parent
1abcb0b348
commit
79a6e59e6e
@ -179,8 +179,7 @@ Note that these flags should only appear after a command.
|
|||||||
several different ways. See [SPECIFYING FORMULAE][].
|
several different ways. See [SPECIFYING FORMULAE][].
|
||||||
|
|
||||||
If `--debug` is passed and brewing fails, open an interactive debugging
|
If `--debug` is passed and brewing fails, open an interactive debugging
|
||||||
session with access to IRB, ruby-debug, or a shell inside the temporary
|
session with access to IRB or a shell inside the temporary build directory.
|
||||||
build directory.
|
|
||||||
|
|
||||||
If `--env=std` is passed, use the standard build environment instead of superenv.
|
If `--env=std` is passed, use the standard build environment instead of superenv.
|
||||||
|
|
||||||
@ -332,14 +331,17 @@ Note that these flags should only appear after a command.
|
|||||||
Ensures all tapped formula are symlinked into Library/Formula and prunes dead
|
Ensures all tapped formula are symlinked into Library/Formula and prunes dead
|
||||||
formula from Library/Formula.
|
formula from Library/Formula.
|
||||||
|
|
||||||
* `test` [--devel|--HEAD] <formula>:
|
* `test` [--devel|--HEAD] [--debug] <formula>:
|
||||||
A few formulae provide a test method. `brew test <formula>` runs this
|
A few formulae provide a test method. `brew test <formula>` runs this
|
||||||
test method. There is no standard output or return code, but it should
|
test method. There is no standard output or return code, but it should
|
||||||
generally indicate to the user if something is wrong with the installed
|
generally indicate to the user if something is wrong with the installed
|
||||||
formula.
|
formula.
|
||||||
|
|
||||||
To test the development or head version of a formula, `--devel` or
|
To test the development or head version of a formula, use `--devel` or
|
||||||
`--HEAD` must be passed.,
|
`--HEAD`.
|
||||||
|
|
||||||
|
If `--debug` is passed and the test fails, an interactive debugger will be
|
||||||
|
launched with access to IRB or a shell inside the temporary test directory.
|
||||||
|
|
||||||
Example: `brew install jruby && brew test jruby`
|
Example: `brew install jruby && brew test jruby`
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
require "extend/ENV"
|
require "extend/ENV"
|
||||||
require "timeout"
|
require "timeout"
|
||||||
|
require "debrew"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
TEST_TIMEOUT_SECONDS = 5*60
|
TEST_TIMEOUT_SECONDS = 5*60
|
||||||
@ -50,11 +51,12 @@ module Homebrew
|
|||||||
|
|
||||||
f.extend(Test::Unit::Assertions)
|
f.extend(Test::Unit::Assertions)
|
||||||
f.extend(Homebrew::Assertions)
|
f.extend(Homebrew::Assertions)
|
||||||
|
f.extend(Debrew::Formula) if ARGV.debug?
|
||||||
|
|
||||||
begin
|
begin
|
||||||
# tests can also return false to indicate failure
|
# tests can also return false to indicate failure
|
||||||
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
||||||
raise if f.test == false
|
raise if f.run_test == false
|
||||||
end
|
end
|
||||||
rescue FailedAssertion => e
|
rescue FailedAssertion => e
|
||||||
ofail "#{f.name}: failed"
|
ofail "#{f.name}: failed"
|
||||||
|
|||||||
@ -21,6 +21,10 @@ module Debrew
|
|||||||
def install
|
def install
|
||||||
Debrew.debrew { super }
|
Debrew.debrew { super }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test
|
||||||
|
Debrew.debrew { super }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module Resource
|
module Resource
|
||||||
|
|||||||
@ -473,21 +473,23 @@ class Formula
|
|||||||
active_spec.verify_download_integrity(fn)
|
active_spec.verify_download_integrity(fn)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test
|
def run_test
|
||||||
self.build = Tab.for_formula(self)
|
self.build = Tab.for_formula(self)
|
||||||
ret = nil
|
|
||||||
mktemp do
|
mktemp do
|
||||||
@testpath = Pathname.pwd
|
@testpath = Pathname.pwd
|
||||||
ret = instance_eval(&self.class.test)
|
test
|
||||||
@testpath = nil
|
|
||||||
end
|
end
|
||||||
ret
|
ensure
|
||||||
|
@testpath = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_defined?
|
def test_defined?
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Pretty titles the command and buffers stdout/stderr
|
# Pretty titles the command and buffers stdout/stderr
|
||||||
@ -769,9 +771,8 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test &block
|
def test &block
|
||||||
return @test unless block_given?
|
|
||||||
define_method(:test_defined?) { true }
|
define_method(:test_defined?) { true }
|
||||||
@test = block
|
define_method(:test, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "BREW" "1" "July 2014" "Homebrew" "brew"
|
.TH "BREW" "1" "September 2014" "Homebrew" "brew"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBbrew\fR \- The missing package manager for OS X
|
\fBbrew\fR \- The missing package manager for OS X
|
||||||
@ -197,7 +197,7 @@ Install \fIformula\fR\.
|
|||||||
\fIformula\fR is usually the name of the formula to install, but it can be specified several different ways\. See \fISPECIFYING FORMULAE\fR\.
|
\fIformula\fR is usually the name of the formula to install, but it can be specified several different ways\. See \fISPECIFYING FORMULAE\fR\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
If \fB\-\-debug\fR is passed and brewing fails, open an interactive debugging session with access to IRB, ruby\-debug, or a shell inside the temporary build directory\.
|
If \fB\-\-debug\fR is passed and brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
If \fB\-\-env=std\fR is passed, use the standard build environment instead of superenv\.
|
If \fB\-\-env=std\fR is passed, use the standard build environment instead of superenv\.
|
||||||
@ -353,11 +353,14 @@ Tap a new formula repository from GitHub, or list existing taps\.
|
|||||||
Ensures all tapped formula are symlinked into Library/Formula and prunes dead formula from Library/Formula\.
|
Ensures all tapped formula are symlinked into Library/Formula and prunes dead formula from Library/Formula\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fBtest\fR [\-\-devel|\-\-HEAD] \fIformula\fR
|
\fBtest\fR [\-\-devel|\-\-HEAD] [\-\-debug] \fIformula\fR
|
||||||
A few formulae provide a test method\. \fBbrew test <formula>\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\.
|
A few formulae provide a test method\. \fBbrew test <formula>\fR runs this test method\. There is no standard output or return code, but it should generally indicate to the user if something is wrong with the installed formula\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
To test the development or head version of a formula, \fB\-\-devel\fR or \fB\-\-HEAD\fR must be passed\.,
|
To test the development or head version of a formula, use \fB\-\-devel\fR or \fB\-\-HEAD\fR\.
|
||||||
|
.
|
||||||
|
.IP
|
||||||
|
If \fB\-\-debug\fR is passed and the test fails, an interactive debugger will be launched with access to IRB or a shell inside the temporary test directory\.
|
||||||
.
|
.
|
||||||
.IP
|
.IP
|
||||||
Example: \fBbrew install jruby && brew test jruby\fR
|
Example: \fBbrew install jruby && brew test jruby\fR
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user