Compatibility with ruby 1.8, force garbage cleanup for LVS/DRC and tests.

This commit is contained in:
Matthias Koefferlein 2019-07-21 10:23:08 +02:00
parent 6e6e449eef
commit df7195b81f
5 changed files with 167 additions and 143 deletions

View File

@ -1,5 +1,7 @@
# $autorun-early # $autorun-early
require 'pathname'
module DRC module DRC
# The DRC engine # The DRC engine
@ -1335,6 +1337,8 @@ CODE
def _finish(final = true) def _finish(final = true)
begin
_flush _flush
view = RBA::LayoutView::current view = RBA::LayoutView::current
@ -1435,6 +1439,8 @@ CODE
end end
ensure
@output_layout = nil @output_layout = nil
@output_layout_file = nil @output_layout_file = nil
@output_cell = nil @output_cell = nil
@ -1457,6 +1463,11 @@ CODE
@log_file = nil @log_file = nil
end end
# force garbage collection
GC.start
end
end end
def _take_data def _take_data
@ -1498,7 +1509,11 @@ CODE
# resolves the file path relative to the source's path # resolves the file path relative to the source's path
sp = self.source.path sp = self.source.path
if sp if sp
if File.respond_to?(:absolute_path)
return File::absolute_path(file, File::dirname(sp)) return File::absolute_path(file, File::dirname(sp))
else
return (Pathname::new(File::dirname(sp)) + Pathname.new(file)).to_s
end
else else
return file return file
end end

View File

@ -41,7 +41,7 @@ module DRC
ensure ensure
# cleans up and creates layout views # cleans up and creates layout and report views
_drc._finish _drc._finish
end end

View File

@ -41,7 +41,7 @@ module LVS
ensure ensure
# cleans up and creates layout views # cleans up and creates layout and report views
_lvs._finish _lvs._finish
end end

View File

@ -3,20 +3,22 @@
# environment is shut down. Therefore we must release all RBA objects by explicitly calling the GC # environment is shut down. Therefore we must release all RBA objects by explicitly calling the GC
# and start the test suite manually. # and start the test suite manually.
err = 0 begin
any = nil
repeat = (ENV["TESTREPEAT"] || "1").to_i
class MyTestRunner < Test::Unit::UI::Console::TestRunner err = 0
any = nil
repeat = (ENV["TESTREPEAT"] || "1").to_i
class MyTestRunner < Test::Unit::UI::Console::TestRunner
def initialize(suite, *args) def initialize(suite, *args)
super(suite, *args) super(suite, *args)
end end
def test_started(name) def test_started(name)
super super
end end
end end
Object.constants.each do |c| Object.constants.each do |c|
if c.to_s =~ /_TestClass$/ if c.to_s =~ /_TestClass$/
repeat.times do repeat.times do
r = MyTestRunner::new(Object.const_get(c)).start r = MyTestRunner::new(Object.const_get(c)).start
@ -24,13 +26,17 @@ Object.constants.each do |c|
end end
any = true any = true
end end
end end
if !any if !any
raise("No test class defined (any ending with _TestClass)") raise("No test class defined (any ending with _TestClass)")
end end
if err > 0 if err > 0
raise("Tests failed (#{err} Errors + Failures)") raise("Tests failed (#{err} Errors + Failures)")
end
ensure
GC.start
end end

View File

@ -35,3 +35,6 @@ Object.constants.each do |c|
end end
end end
# Some cleanup ahead
GC.start