From 72bad39f8a21c3be33b17134d2e3ca11f5e0d58f Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 2 Sep 2014 22:02:41 -0700 Subject: tests: make warnings not produce a non-zero exit code, add 'ignore' command to tests, make shorewall optional. --- bin/run_tests | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/run_tests b/bin/run_tests index 2ee027f4..e026b5f7 100755 --- a/bin/run_tests +++ b/bin/run_tests @@ -41,6 +41,7 @@ end ## # this class is raised if a test file wants to be skipped entirely. +# (to skip an individual test, MiniTest::Skip is used instead) class SkipTest < Exception end @@ -62,6 +63,8 @@ end class LeapTest < MiniTest::Unit::TestCase class Pass < MiniTest::Assertion end + class Ignore < MiniTest::Assertion + end def initialize(name) super(name) @@ -100,6 +103,13 @@ class LeapTest < MiniTest::Unit::TestCase raise LeapTest::Pass end + # + # Called when the test should be silently ignored. + # + def ignore + raise LeapTest::Ignore + end + # # the default fail() is part of the kernel and it just throws a runtime exception. for tests, # we want the same behavior as assert(false) @@ -332,6 +342,7 @@ class LeapRunner < MiniTest::Unit def initialize @passes = 0 @warnings = 0 + @ignores = 0 super end @@ -372,9 +383,12 @@ class LeapRunner < MiniTest::Unit case e when MiniTest::Skip then @skips += 1 - #if @verbose - report_line("SKIP", klass, meth, e, e.message) - #end + report_line("SKIP", klass, meth, e, e.message) + when LeapTest::Ignore then + @ignores += 1 + if @verbose + report_line("IGNORE", klass, meth, e, e.message) + end when LeapTest::Pass then @passes += 1 report_line("PASS", klass, meth) @@ -414,7 +428,8 @@ class LeapRunner < MiniTest::Unit elsif @failures > 0 :failure elsif @warnings > 0 - :warning + # :warning << warnings don't warrant a non-zero exit code. + :success else :success end -- cgit v1.2.3