Skip to content

test(check.rb): add #extra_args instruction #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions check/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def do_test(&block)
nfiles.times do |i|
ENV["FORM"] = FormTest.cfg.form_cmd
@filename = "#{i + 1}.frm"
execute("#{ulimits}#{FormTest.cfg.form_cmd} #{@filename}")
execute("#{ulimits}#{FormTest.cfg.form_cmd}#{extra_args} #{@filename}")
if !finished?
info.status = "TIMEOUT"
assert(false, "timeout (= #{timeout} sec) in #{@filename} of #{info.desc}")
Expand Down Expand Up @@ -533,6 +533,11 @@ def prepare
# Can be overridden in child classes.
end

# Extra command-line arguments to be passed to FORM.
def extra_args
""
end

# The sequence of ulimit commands to set the resource usage limits.
def ulimits
""
Expand Down Expand Up @@ -809,6 +814,7 @@ def make_ruby_file(filename)
requires = nil
pendings = nil
prepares = nil
extra_args = nil
ulimits = nil
time_dilation = nil

Expand Down Expand Up @@ -841,6 +847,7 @@ def make_ruby_file(filename)
requires = nil
pendings = nil
prepares = nil
extra_args = nil
ulimits = nil
time_dilation = nil
if skipping
Expand Down Expand Up @@ -895,6 +902,9 @@ def make_ruby_file(filename)
prepares = prepares.join("; ")
line += "def prepare; #{prepares} end; "
end
if !extra_args.nil?
line += "def extra_args; %(#{extra_args}) end;"
end
if !ulimits.nil?
ulimits.map! { |s| "ulimit #{s}; " }
ulimits = ulimits.join("")
Expand Down Expand Up @@ -948,6 +958,14 @@ def make_ruby_file(filename)
prepares = []
end
prepares << $1
elsif heredoc.nil? && line =~ /^\s*#\s*extra_args\s+(.*)/
# #extra_args <args>
# Example: #extra_args -w2
line = ""
if extra_args.nil?
extra_args = ""
end
extra_args += " " + $1.strip()
elsif heredoc.nil? && line =~ /^\s*#\s*ulimit\s+(.*)/
# #ulimit <limits>
# Example: #ulimit -v 4_000_000
Expand All @@ -967,7 +985,7 @@ def make_ruby_file(filename)
fatal("invalid time_dilation", inname, lineno)
end
info.time_dilation = time_dilation
elsif heredoc.nil? && line =~ /^\*\s*#\s*(require|prepare|pend_if|ulimit|time_dilation)\s+(.*)/
elsif heredoc.nil? && line =~ /^\*\s*#\s*(extra_args|pend_if|prepare|require|time_dilation|ulimit)\s+(.*)/
# *#<special instruction>, commented out in the FORM way
line = ""
else
Expand Down
Loading