Author: boisvert
Date: Thu Jul 15 17:27:45 2010
New Revision: 964499
URL: http://svn.apache.org/viewvc?rev=964499&view=rev
Log:
BUILDR-469 test:failed causes all transitive tests to run
Modified:
buildr/trunk/CHANGELOG
buildr/trunk/lib/buildr/core/test.rb
buildr/trunk/spec/core/test_spec.rb
Modified: buildr/trunk/CHANGELOG
URL:
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=964499&r1=964498&r2=964499&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Jul 15 17:27:45 2010
@@ -13,6 +13,7 @@
* Fixed: BUILDR-464 Improve the versioning of Buildr (Rhett Sutphin)
* Fixed: BUILDR-466 Rendering issue with IE on the website (Shane Witbeck)
* Fixed: BUILDR-468 test:failed does not respect test.exclude
+* Fixed: BUILDR-469 test:failed causes all transitive tests to run
* Fixed: BUILDR-472 ECJ dependency now required to build any java project
1.4.1 (2010-07-07)
Modified: buildr/trunk/lib/buildr/core/test.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/test.rb?rev=964499&r1=964498&r2=964499&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/test.rb (original)
+++ buildr/trunk/lib/buildr/core/test.rb Thu Jul 15 17:27:45 2010
@@ -501,7 +501,7 @@ module Buildr
# Returns true if the specified test name matches the inclusion/exclusion
pattern. Used to determine
# which tests to execute.
def include?(name)
- (@include.empty? || @include.any? { |pattern| File.fnmatch(pattern,
name) }) &&
+ ((@include.empty? && !...@forced_need)|| @include.any? { |pattern|
File.fnmatch(pattern, name) }) &&
[email protected]? { |pattern| File.fnmatch(pattern, name) }
end
@@ -642,9 +642,11 @@ module Buildr
if excludes.empty?
TestTask.only_run includes
else
+ # remove leading '-'
excludes.map! { |t| t[1..-1] }
+
TestTask.clear
- TestTask.include includes
+ TestTask.include (includes.empty? ? '*' : includes)
TestTask.exclude excludes
end
task('test').invoke
Modified: buildr/trunk/spec/core/test_spec.rb
URL:
http://svn.apache.org/viewvc/buildr/trunk/spec/core/test_spec.rb?rev=964499&r1=964498&r2=964499&view=diff
==============================================================================
--- buildr/trunk/spec/core/test_spec.rb (original)
+++ buildr/trunk/spec/core/test_spec.rb Thu Jul 15 17:27:45 2010
@@ -1034,6 +1034,31 @@ describe 'test failed' do
project('foo').test.tests.should_not include('ExcludedTest')
end
+ it 'should run only the tests that failed the last time, even when failed
tests have dependencies' do
+ define 'parent' do
+ define 'foo' do
+ test.using(:junit)
+ test.instance_eval do
+ @framework.stub!(:tests).and_return(['PassingTest'])
+ @framework.stub!(:run).and_return(['PassingTest'])
+ end
+ end
+ define 'bar' do
+ test.using(:junit)
+ test.enhance ["parent:foo:test"]
+ test.instance_eval do
+ @framework.stub!(:tests).and_return(['FailingTest', 'PassingTest'])
+ @framework.stub!(:run).and_return(['PassingTest'])
+ end
+ end
+ end
+ write project('parent:bar').path_to(:target, "junit-failed"), "FailingTest"
+ task('test:failed').invoke rescue nil
+ project('parent:foo').test.tests.should_not include('PassingTest')
+ project('parent:bar').test.tests.should include('FailingTest')
+ project('parent:bar').test.tests.should_not include('PassingTest')
+ end
+
end