Skip to content
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

first attempt at a common staging class #209

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
34 changes: 34 additions & 0 deletions eessi/testsuite/eessi_staging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from pathlib import Path

import reframe as rfm
from reframe.utility import sanity as sn
from reframe.core.builtins import run_after, sanity_function


@rfm.simple_test
class EESSI_Staging(rfm.RunOnlyRegressionTest):
'''Stage input files'''

valid_systems = ['*']
valid_prog_environs = ['*']
executable = "true"
local = True

@run_after('init')
def remove_modules(self):
"Remove any modules that have been set on the cmd line: they are not needed for staging"
self.modules = []

@sanity_function
def check_stagedir(self):
"Check that all input files have been correctly copied to the stagedir"
ignore = {'rfm_job.sh', 'rfm_job.out', 'rfm_job.err'}
sourcepath = Path(self.sourcesdir)
sourcefiles = {x.relative_to(sourcepath).as_posix() for x in sourcepath.rglob('*')}
stagepath = Path(self.stagedir)
stagefiles = {x.relative_to(stagepath).as_posix() for x in stagepath.rglob('*')} - ignore

return sn.assert_eq(
sourcefiles, stagefiles,
f'sourcesdir {self.sourcesdir} and stagedir {self.stagedir} do not have the same contents'
)
7 changes: 5 additions & 2 deletions eessi/testsuite/tests/apps/cp2k/cp2k.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import os

import reframe as rfm
from reframe.core.builtins import parameter, run_after, performance_function, sanity_function, fixture
import reframe.utility.sanity as sn

from eessi.testsuite.constants import SCALES, COMPUTE_UNIT, DEVICE_TYPES, CPU
from eessi.testsuite.eessi_mixin import EESSI_Mixin
from eessi.testsuite.eessi_staging import EESSI_Staging
from eessi.testsuite.utils import find_modules
from eessi.testsuite.tests.apps.cp2k.cp2k_staging.cp2k_stage_input import EESSI_CP2K_stage_input


@rfm.simple_test
class EESSI_CP2K(rfm.RunOnlyRegressionTest, EESSI_Mixin):

stage_files = fixture(EESSI_CP2K_stage_input, scope='session')
srcdir = os.path.join(os.getcwd(), 'cp2k_staging', 'src')
stage_files = fixture(EESSI_Staging, scope='session', variables={'sourcesdir': srcdir})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this will work. If another test uses EESSI_Staging as a fixture, with scope session, will it then be run twice (i.e. once for each tests invoking it as a fixture)? Or once (because it's once per session scope)?

Also: even if it does run once per test that invokes this as fixture, it'll have the name EESSI_Staging both times, right? That could be confusing. But maybe that can be resolved by overwriting the test name through the variables construct? I don't know, I don't have much experience with variables as an argument to fixture.

Could you try to add the lammps case here as well? That would allow us to easily verify it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in the meeting: maybe we can do something along the lines of:

stage_files = fixture(EESSI_Staging, scope='session', variables={'sourcesdir': srcdir, 'testname': testname + '_staging'})


benchmark_info = parameter([
# (bench_name, energy_ref, energy_tol)
Expand Down
24 changes: 0 additions & 24 deletions eessi/testsuite/tests/apps/cp2k/cp2k_staging/cp2k_stage_input.py

This file was deleted.

Loading