Skip to content

Commit ef2279f

Browse files
tuedajodavies
authored andcommitted
test(check.rb): add --fake-valgrind and --fake-no-valgrind options
Add options to override behaviour related to Valgrind (as checked by valgrind?). The option --fake-valgrind makes the test suite behave as if running under Valgrind, while --fake-no-valgrind makes it behave as if Valgrind were not present, regardless of the actual environment.
1 parent 1bf3798 commit ef2279f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

check/check.rb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,11 @@ def mpi?
266266
end
267267

268268
def valgrind?
269-
!FormTest.cfg.valgrind.nil?
269+
if FormTest.cfg.fake_valgrind.nil?
270+
!FormTest.cfg.valgrind.nil?
271+
else
272+
FormTest.cfg.fake_valgrind
273+
end
270274
end
271275

272276
def wordsize
@@ -1147,12 +1151,13 @@ def delete(classname)
11471151
11481152
# FORM configuration.
11491153
class FormConfig
1150-
def initialize(form, mpirun, mpirun_opts, valgrind, valgrind_opts, wordsize, ncpu, timeout, retries, stat, full, verbose, show_newlines)
1154+
def initialize(form, mpirun, mpirun_opts, valgrind, valgrind_opts, fake_valgrind, wordsize, ncpu, timeout, retries, stat, full, verbose, show_newlines)
11511155
@form = form
11521156
@mpirun = mpirun
11531157
@mpirun_opts = mpirun_opts
11541158
@valgrind = valgrind
11551159
@valgrind_opts = valgrind_opts
1160+
@fake_valgrind = fake_valgrind
11561161
@ncpu = ncpu
11571162
@timeout = timeout
11581163
@retries = retries
@@ -1174,7 +1179,7 @@ def initialize(form, mpirun, mpirun_opts, valgrind, valgrind_opts, wordsize, ncp
11741179
@form_cmd = nil
11751180
end
11761181
1177-
attr_reader :form, :mpirun, :mpirun_opts, :valgrind, :valgrind_opts, :ncpu, :timeout, :retries, :stat, :full, :verbose, :show_newlines,
1182+
attr_reader :form, :mpirun, :mpirun_opts, :valgrind, :valgrind_opts, :fake_valgrind, :ncpu, :timeout, :retries, :stat, :full, :verbose, :show_newlines,
11781183
:form_bin, :mpirun_bin, :valgrind_bin, :valgrind_supp, :head, :wordsize, :form_cmd
11791184
11801185
def serial?
@@ -1446,6 +1451,7 @@ def main
14461451
opts.enable_valgrind = false
14471452
opts.valgrind = "valgrind"
14481453
opts.valgrind_opts = nil
1454+
opts.fake_valgrind = nil
14491455
opts.wordsize = nil
14501456
opts.dir = nil
14511457
opts.name_patterns = []
@@ -1482,6 +1488,10 @@ def main
14821488
"Full test, ignoring pending") { opts.full = true }
14831489
parser.on("--enable-valgrind",
14841490
"Enable Valgrind") { opts.enable_valgrind = true }
1491+
parser.on("--fake-valgrind",
1492+
"Pretend to run under Valgrind") { opts.fake_valgrind = true }
1493+
parser.on("--fake-no-valgrind",
1494+
"Pretend not to run under Valgrind") { opts.fake_valgrind = false }
14851495
parser.on("--valgrind BIN",
14861496
"Use BIN as Valgrind executable") { |bin| opts.enable_valgrind = true; opts.valgrind = bin }
14871497
parser.on("--valgrind-opts OPTS",
@@ -1624,6 +1634,7 @@ def main
16241634
opts.mpirun_opts,
16251635
opts.enable_valgrind ? opts.valgrind : nil,
16261636
opts.valgrind_opts,
1637+
opts.fake_valgrind,
16271638
opts.wordsize,
16281639
opts.ncpu,
16291640
[opts.timeout, 1].max,

0 commit comments

Comments
 (0)