diff --git a/check/check.rb b/check/check.rb index f664a40b..e126d420 100755 --- a/check/check.rb +++ b/check/check.rb @@ -696,12 +696,14 @@ def initialize @foldname = nil # fold name of the test @enabled = nil # enabled or not @sources = [] # FORM sources + @time_dilation = nil @status = nil # status @times = nil # elapsed time (array) end - attr_accessor :classname, :where, :foldname, :enabled, :sources, :status, :times + attr_accessor :classname, :where, :foldname, :enabled, :sources, :time_dilation, + :status, :times # Return the description of the test. def desc @@ -762,6 +764,7 @@ def make_ruby_file(filename) requires = nil pendings = nil prepares = nil + time_dilation = nil infile.each_line do |line| line.chop! @@ -792,6 +795,7 @@ def make_ruby_file(filename) requires = nil pendings = nil prepares = nil + time_dilation = nil if skipping line = "" else @@ -844,6 +848,9 @@ def make_ruby_file(filename) prepares = prepares.join("; ") line += "def prepare; #{prepares} end; " end + if !time_dilation.nil? + line += "def timeout; super() * #{time_dilation} end;" + end line += "end" end level = 0 @@ -889,8 +896,19 @@ def make_ruby_file(filename) prepares = [] end prepares << $1 - elsif heredoc.nil? && line =~ /^\*\s*#\s*(require|prepare|pend_if)\s+(.*)/ - # *#require/prepare/pend_if, commented out in the FORM way + elsif heredoc.nil? && line =~ /^\s*#\s*time_dilation\s+(.*)/ + # #time_dilation + line = "" + if !time_dilation.nil? + fatal("attempted to set time_dilation twice", inname, lineno) + end + time_dilation = $1.to_f + if time_dilation <= 0 + fatal("invalid time_dilation", inname, lineno) + end + info.time_dilation = time_dilation + elsif heredoc.nil? && line =~ /^\*\s*#\s*(require|prepare|pend_if|time_dilation)\s+(.*)/ + # *#require/prepare/pend_if/time_dilation, commented out in the FORM way line = "" else if heredoc.nil? @@ -1462,7 +1480,7 @@ def finalize bar_width = 40 end - puts("timeout: #{FormTest.cfg.timeout}s") + puts("default timeout: #{FormTest.cfg.timeout}s") infos.each do |info| (0..info.sources.length - 1).each do |i| @@ -1470,20 +1488,24 @@ def finalize if !info.times.nil? && i < info.times.length t = info.times[i] end + timeout = FormTest.cfg.timeout + if !info.time_dilation.nil? + timeout *= info.time_dilation + end if i == 0 puts(format("%s %s %s %s%s", lpad(info.foldname, max_foldname_width), lpad("(#{info.where})", max_where_width), lpad(info.status.nil? ? "UNKNOWN" : info.status, status_width), - bar_str(t, FormTest.cfg.timeout, bar_width), - format_time(t, FormTest.cfg.timeout))) + bar_str(t, timeout, bar_width), + format_time(t, timeout))) else puts(format("%s %s %s %s%s", lpad("", max_foldname_width), lpad("", max_where_width), lpad("", status_width), - bar_str(t, FormTest.cfg.timeout, bar_width), - format_time(t, FormTest.cfg.timeout))) + bar_str(t, timeout, bar_width), + format_time(t, timeout))) end end end diff --git a/check/examples.frm b/check/examples.frm index 2444b4e4..cd7a82ce 100644 --- a/check/examples.frm +++ b/check/examples.frm @@ -1905,6 +1905,7 @@ Print; #define LOOPS "6" Local F = topologies_(`LOOPS',-2,{3,},QQ,PP); .end + #time_dilation 2.0 assert succeeded? assert nterms("F") == 2793 *--#] Diagrams_4 : diff --git a/check/features.frm b/check/features.frm index a8fbdd26..7379d560 100644 --- a/check/features.frm +++ b/check/features.frm @@ -159,6 +159,41 @@ assert result("F") =~ expr(" x^203 - x^205 - x^206 + x^207 + x^209 + x^210 ") *--#] moebius_2 : +*--#[ moebius_3 : +* corner cases, see #430 +#do i=1,9 + L F`i' = moebius_(2^15-`i'); +#enddo +#do i=1,9 + L G`i' = moebius_(2^31-`i'); +#enddo +P; +.end +#time_dilation 4.0 +assert succeeded? +if wordsize >= 2 + assert result("F1") =~ expr("-1") + assert result("F2") =~ expr("1") + assert result("F3") =~ expr("1") + assert result("F4") =~ expr("0") + assert result("F5") =~ expr("-1") + assert result("F6") =~ expr("1") + assert result("F7") =~ expr("0") + assert result("F8") =~ expr("0") + assert result("F9") =~ expr("-1") +end +if wordsize >= 4 + assert result("G1") =~ expr("-1") + assert result("G2") =~ expr("0") + assert result("G3") =~ expr("-1") + assert result("G4") =~ expr("0") + assert result("G5") =~ expr("1") + assert result("G6") =~ expr("-1") + assert result("G7") =~ expr("1") + assert result("G8") =~ expr("0") + assert result("G9") =~ expr("-1") +end +*--#] moebius_3 : *--#[ partitions_ : * Test partitions function #- diff --git a/check/fixes.frm b/check/fixes.frm index 568086e7..ed00e021 100644 --- a/check/fixes.frm +++ b/check/fixes.frm @@ -1474,6 +1474,7 @@ P; .end # Too slow on Travis CI. ParFORM didn't have this bug. #pend_if travis? && (!linux? || valgrind? || mpi?) +#time_dilation 2.0 assert succeeded? assert result("F1") =~ expr("2027025") *--#] Issue154 :