mirror of https://github.com/KLayout/klayout.git
Consistent Ruby test environment - removed duplicate headers.
This commit is contained in:
parent
0f42ebe385
commit
d305ee0cae
|
|
@ -17,8 +17,9 @@
|
|||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
if !$:.member?(File::dirname($0))
|
||||
$:.push(File::dirname($0))
|
||||
ruby_dir = File.join(File::dirname($0), "..", "ruby")
|
||||
if !$:.member?(ruby_dir)
|
||||
$:.push(ruby_dir)
|
||||
end
|
||||
|
||||
load("test_prologue.rb")
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
# In the test environment, we cannot make sure that we destroy the ruby interpreter before the RBA
|
||||
# environment is shut down. Therefore we must release all RBA objects by explicitly calling the GC
|
||||
# and start the test suite manually.
|
||||
|
||||
err = 0
|
||||
any = nil
|
||||
repeat = (ENV["TESTREPEAT"] || "1").to_i
|
||||
|
||||
class MyTestRunner < Test::Unit::UI::Console::TestRunner
|
||||
def initialize(suite, *args)
|
||||
super(suite, *args)
|
||||
end
|
||||
def test_started(name)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
Object.constants.each do |c|
|
||||
if c.to_s =~ /_TestClass$/
|
||||
repeat.times do
|
||||
r = MyTestRunner::new(Object.const_get(c)).start
|
||||
err += r.error_count + r.failure_count
|
||||
end
|
||||
any = true
|
||||
end
|
||||
end
|
||||
|
||||
if !any
|
||||
raise("No test class defined (any ending with _TestClass)")
|
||||
end
|
||||
|
||||
if err > 0
|
||||
raise("Tests failed (#{err} Errors + Failures)")
|
||||
end
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
# in MSVC environment:
|
||||
if ENV["RUBY"]
|
||||
ruby_libs = "#{ENV["RUBY"]}/lib/ruby/#{RUBY_VERSION}"
|
||||
if !$:.member?(ruby_libs)
|
||||
$:.push(ruby_libs)
|
||||
end
|
||||
end
|
||||
|
||||
# Set this to true to disable some tests involving exceptions
|
||||
$leak_check = ENV["TEST_LEAK_CHECK"]
|
||||
|
||||
# Fetch location of source files and the temp files
|
||||
$ut_testsrc = ENV["TESTSRC"] || raise("Environment variable $TESTSRC not set")
|
||||
$ut_testtmp = ENV["TESTTMP_WITH_NAME"] || ENV["TESTTMP"] || raise("Environment variable $TESTTMP not set")
|
||||
|
||||
# Pull packages from vendor drop-in
|
||||
vendor = File.join($ut_testsrc, "testdata", "vendor", "ruby")
|
||||
if !$:.member?(vendor)
|
||||
$:.unshift(vendor)
|
||||
end
|
||||
|
||||
# Require Test::Unit
|
||||
require 'test/unit/ui/console/testrunner'
|
||||
|
||||
# TestBase is an alias for "TestCase"
|
||||
Object.const_defined?(:TestBase) && Object.send(:remove_const, :TestBase)
|
||||
TestBase = Test::Unit::TestCase
|
||||
|
||||
# undefine existing classes
|
||||
|
||||
Object.constants.each do |c|
|
||||
if c.to_s =~ /_TestClass$/
|
||||
Object.send(:remove_const, c)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue