Skip to content

Commit

Permalink
[LTP] Increase timeouts when running with ASan
Browse files Browse the repository at this point in the history
Gramine compiled with ASan builds is 2x slower, and some long-running
tests (such as `sendfile09`) often fail because of that.

Signed-off-by: Paweł Marczewski <pawel@invisiblethingslab.com>
  • Loading branch information
pwmarcz authored and mkow committed Oct 3, 2021
1 parent 1bc9039 commit 8209523
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .ci/lib/config-asan.jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
env.ASAN = '1'
env.LTP_TIMEOUT_FACTOR = '2'
4 changes: 4 additions & 0 deletions LibOS/shim/test/ltp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ ifeq ($(BUILD_VERBOSE),1)
RUNLTPOPTS += -v
endif

ifneq ($(LTP_TIMEOUT_FACTOR),)
RUNLTPOPTS += -T $(LTP_TIMEOUT_FACTOR)
endif

$(SRCDIR)/Makefile:
$(error "$(SRCDIR) is empty. Please run `git submodule update --init $(SRCDIR)` or download the LTP source code (https://github.com/linux-test-project/ltp) into $(SRCDIR).")

Expand Down
16 changes: 11 additions & 5 deletions LibOS/shim/test/ltp/runltp_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
type=argparse.FileType('w'),
help='write XML report to a file (use - for stdout)')

argparser.add_argument('--timeout-factor', '-T', metavar='N',
type=float, default=1,
help='multiply all timeouts by N')

argparser.set_defaults(
config=None,
option=[],
Expand Down Expand Up @@ -118,10 +122,11 @@ class TestRunner:
tag (str): a name of the test
cmd (iterable): the command (full *argv*)
'''
def __init__(self, suite, tag, cmd):
def __init__(self, suite, tag, cmd, timeout_factor=1):
self.suite = suite
self.tag = tag
self.cmd = tuple(cmd)
self.timeout_factor = timeout_factor

try:
self.cfgsection = self.suite.config[self.tag]
Expand Down Expand Up @@ -246,7 +251,7 @@ async def _run_cmd(self):
AbnormalTestResult: for assorted failures
'''
cmd = [self.suite.loader, *self.cmd]
timeout = self.cfgsection.getfloat('timeout')
timeout = int(self.cfgsection.getfloat('timeout') * self.timeout_factor)
self.log.info('starting %r with timeout %d', cmd, timeout)
start_time = time.time()

Expand Down Expand Up @@ -437,8 +442,9 @@ class TestSuite:
Args:
config (configparser.Configparser): configuration
'''
def __init__(self, config):
def __init__(self, config, timeout_factor=1):
self.config = config
self.timeout_factor = timeout_factor
self.fnmatch_names = [
name for name in config
if is_fnmatch_pattern(name)
Expand Down Expand Up @@ -481,7 +487,7 @@ def add_test(self, tag, cmd):
tag (str): test case name
cmd (iterable): command (full *argv*)
'''
self.queue.append(TestRunner(self, tag, cmd))
self.queue.append(TestRunner(self, tag, cmd, self.timeout_factor))

def add_result(self, element):
'''Add a result.
Expand Down Expand Up @@ -615,7 +621,7 @@ def main(args=None):
key, value = token.split('=', maxsplit=1)
config[config.default_section][key] = value

suite = TestSuite(config)
suite = TestSuite(config, args.timeout_factor)
with args.cmdfile as file:
for line in file:
if line[0] in '\n#':
Expand Down

0 comments on commit 8209523

Please sign in to comment.