Skip to content

Commit

Permalink
Merge pull request #724 from vkarak/refactor/unroll-test-cases
Browse files Browse the repository at this point in the history
[refactor] Refactor frontend to execute directly test cases
  • Loading branch information
vkarak committed Apr 2, 2019
2 parents 558cbdd + f6be78e commit 4be70db
Show file tree
Hide file tree
Showing 7 changed files with 220 additions and 208 deletions.
14 changes: 9 additions & 5 deletions reframe/core/systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import reframe.core.debug as debug
import reframe.core.fields as fields
import reframe.utility as utility
import reframe.utility.typecheck as typ
from reframe.core.environments import Environment


class SystemPartition:
"""A representation of a system partition inside ReFrame."""
"""A representation of a system partition inside ReFrame.
This class is immutable.
"""

_name = fields.TypedField('_name', typ.Str['(\w|-)+'])
_descr = fields.TypedField('_descr', str)
Expand Down Expand Up @@ -37,7 +41,7 @@ def __init__(self, name, descr=None, scheduler=None, launcher=None,

@property
def access(self):
return self._access
return utility.SequenceView(self._access)

@property
def descr(self):
Expand All @@ -46,7 +50,7 @@ def descr(self):

@property
def environs(self):
return self._environs
return utility.SequenceView(self._environs)

@property
def fullname(self):
Expand Down Expand Up @@ -80,7 +84,7 @@ def name(self):

@property
def resources(self):
return self._resources
return utility.MappingView(self._resources)

@property
def scheduler(self):
Expand Down Expand Up @@ -243,7 +247,7 @@ def resourcesdir(self):
@property
def partitions(self):
"""All the system partitions associated with this system."""
return self._partitions
return utility.SequenceView(self._partitions)

def add_partition(self, partition):
partition._system = self
Expand Down
27 changes: 15 additions & 12 deletions reframe/frontend/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from reframe.core.exceptions import (EnvironError, ConfigError, ReframeError,
ReframeFatalError, format_exception,
SystemAutodetectionError)
from reframe.frontend.executors import Runner
from reframe.frontend.executors import Runner, generate_testcases
from reframe.frontend.executors.policies import (SerialExecutionPolicy,
AsynchronousExecutionPolicy)
from reframe.frontend.loader import RegressionCheckLoader
Expand Down Expand Up @@ -451,13 +451,18 @@ def main():
elif options.cpu_only:
checks_matched = filter(filters.have_cpu_only(), checks_matched)

checks_matched = [c for c in checks_matched]
# Determine the allowed programming environments
allowed_environs = {e.name
for env_patt in options.prgenv
for p in rt.system.partitions
for e in p.environs if re.match(env_patt, e.name)}

# Determine the programming environments to run with
run_environs = {e.name
for env_patt in options.prgenv
for p in rt.system.partitions
for e in p.environs if re.match(env_patt, e.name)}
# Generate the test cases
checks_matched = list(checks_matched)
testcases = generate_testcases(checks_matched,
options.skip_system_check,
options.skip_prgenv_check,
allowed_environs)

# Act on checks

Expand Down Expand Up @@ -500,10 +505,8 @@ def main():
exec_policy.skip_system_check = options.skip_system_check
exec_policy.force_local = options.force_local
exec_policy.strict_check = options.strict
exec_policy.skip_environ_check = options.skip_prgenv_check
exec_policy.skip_sanity_check = options.skip_sanity_check
exec_policy.skip_performance_check = options.skip_performance_check
exec_policy.only_environs = run_environs
exec_policy.keep_stage_files = options.keep_stage_files
try:
errmsg = "invalid option for --flex-alloc-tasks: '{0}'"
Expand Down Expand Up @@ -532,14 +535,14 @@ def main():
max_retries) from None
runner = Runner(exec_policy, printer, max_retries)
try:
runner.runall(checks_matched)
runner.runall(testcases)
finally:
# Print a retry report if we did any retries
if runner.stats.num_failures(run=0):
if runner.stats.failures(run=0):
printer.info(runner.stats.retry_report())

# Print a failure report if we had failures in the last run
if runner.stats.num_failures():
if runner.stats.failures():
printer.info(runner.stats.failure_report())
success = False

Expand Down

0 comments on commit 4be70db

Please sign in to comment.