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,6 +3,8 @@
# 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.
begin
err = 0 err = 0
any = nil any = nil
repeat = (ENV["TESTREPEAT"] || "1").to_i repeat = (ENV["TESTREPEAT"] || "1").to_i
@ -34,3 +36,7 @@ if err > 0
raise("Tests failed (#{err} Errors + Failures)") raise("Tests failed (#{err} Errors + Failures)")
end end
ensure
GC.start
end

View File

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