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

significantly speed up verifying of dumped easyconfig by resorting to 'shallow' parsing #3520

Merged
merged 4 commits into from
Sep 5, 2016
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ easyblock = 'PerlModule'

name = 'YAML-Syck'
version = '1.27'
versionsuffix = '-Perl-%(perlver)s'

homepage = 'http://search.cpan.org/perldoc?YAML%3A%3ASyck'
description = """Fast, lightweight YAML loader and dumper.
Expand All @@ -21,21 +22,15 @@ toolchain = {'name': 'goolf', 'version': '1.4.10'}
source_urls = ['http://www.cpan.org/modules/by-module/YAML']
sources = [SOURCE_TAR_GZ]

perl = 'Perl'
perlver = '5.16.3'
perlverextra = ''
versionsuffix = '-%s-%s%s' % (perl, perlver, perlverextra)

dependencies = [
(perl, perlver, perlverextra),
('Perl', '5.16.3'),
]

options = {'modulename': 'YAML::Syck'}

perlmajver = perlver.split('.')[0]
sanity_check_paths = {
'files': [],
'dirs': ['lib/perl%s/site_perl/%s/x86_64-linux-thread-multi/YAML' % (perlmajver, perlver)],
'dirs': ['lib/perl5/site_perl/%(perlver)s/x86_64-linux-thread-multi/YAML'],
}

moduleclass = 'data'
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ easyblock = 'PerlModule'

name = 'YAML-Syck'
version = '1.27'
versionsuffix = '-Perl-%(perlver)s'

homepage = 'http://search.cpan.org/perldoc?YAML%3A%3ASyck'
description = """Fast, lightweight YAML loader and dumper.
Expand All @@ -21,21 +22,15 @@ toolchain = {'name': 'ictce', 'version': '4.1.13'}
source_urls = ['http://www.cpan.org/modules/by-module/YAML']
sources = [SOURCE_TAR_GZ]

perl = 'Perl'
perlver = '5.16.3'
perlverextra = ''
versionsuffix = '-%s-%s%s' % (perl, perlver, perlverextra)

dependencies = [
(perl, perlver, perlverextra),
('Perl', '5.16.3'),
]

options = {'modulename': 'YAML::Syck'}

perlmajver = perlver.split('.')[0]
sanity_check_paths = {
'files': [],
'dirs': ['lib/perl%s/site_perl/%s/x86_64-linux-thread-multi/YAML' % (perlmajver, perlver)],
'dirs': ['lib/perl5/site_perl/%(perlver)s/x86_64-linux-thread-multi/YAML'],
}

moduleclass = 'data'
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ easyblock = 'PerlModule'

name = 'YAML-Syck'
version = '1.27'
versionsuffix = '-Perl-%(perlver)s'

homepage = 'http://search.cpan.org/perldoc?YAML%3A%3ASyck'
description = """Fast, lightweight YAML loader and dumper.
Expand All @@ -21,21 +22,15 @@ toolchain = {'name': 'ictce', 'version': '5.3.0'}
source_urls = ['http://www.cpan.org/modules/by-module/YAML']
sources = [SOURCE_TAR_GZ]

perl = 'Perl'
perlver = '5.16.3'
perlverextra = ''
versionsuffix = '-%s-%s%s' % (perl, perlver, perlverextra)

dependencies = [
(perl, perlver, perlverextra),
('Perl', '5.16.3'),
]

options = {'modulename': 'YAML::Syck'}

perlmajver = perlver.split('.')[0]
sanity_check_paths = {
'files': [],
'dirs': ['lib/perl%s/site_perl/%s/x86_64-linux-thread-multi/YAML' % (perlmajver, perlver)],
'dirs': ['lib/perl5/site_perl/%(perlver)s/x86_64-linux-thread-multi/YAML'],
}

moduleclass = 'data'
31 changes: 24 additions & 7 deletions test/easyconfigs/easyconfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@
import easybuild.tools.options as eboptions
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig.default import DEFAULT_CONFIG
from easybuild.framework.easyconfig.easyconfig import EasyConfig
from easybuild.framework.easyconfig.easyconfig import get_easyblock_class
from easybuild.framework.easyconfig.parser import fetch_parameters_from_easyconfig
from easybuild.framework.easyconfig.easyconfig import get_easyblock_class, resolve_template
from easybuild.framework.easyconfig.parser import EasyConfigParser, fetch_parameters_from_easyconfig
from easybuild.framework.easyconfig.tools import dep_graph, get_paths_for, process_easyconfig
from easybuild.tools import config
from easybuild.tools.config import build_option
Expand Down Expand Up @@ -258,7 +259,8 @@ def template_easyconfig_test(self, spec):
self.assertTrue(os.path.isfile(ext_patch_full), msg)

# check whether all extra_options defined for used easyblock are defined
for key in app.extra_options():
extra_opts = app.extra_options()
for key in extra_opts:
self.assertTrue(key in app.cfg)

app.close_log()
Expand All @@ -269,7 +271,7 @@ def template_easyconfig_test(self, spec):
os.close(handle)

ec.dump(test_ecfile)
dumped_ec = EasyConfig(test_ecfile)
dumped_ec = EasyConfigParser(test_ecfile).get_config_dict()
os.remove(test_ecfile)

# inject dummy values for templates that are only known at a later stage
Expand All @@ -278,17 +280,32 @@ def template_easyconfig_test(self, spec):
'installdir': '/dummy/installdir',
}
ec.template_values.update(dummy_template_values)
dumped_ec.template_values.update(dummy_template_values)

for key in sorted(ec._config):
self.assertEqual(ec[key], dumped_ec[key])
ec_dict = ec.parser.get_config_dict()
keys = []
for key in ec_dict:
# skip parameters for which value is equal to default value
orig_val = ec_dict[key]
if key in DEFAULT_CONFIG and orig_val == DEFAULT_CONFIG[key][0]:
continue
if key in extra_opts and orig_val == extra_opts[key][0]:
continue
if key not in DEFAULT_CONFIG and key not in extra_opts:
continue

keys.append(key)
orig_val = resolve_template(ec_dict[key], ec.template_values)
dumped_val = resolve_template(dumped_ec[key], ec.template_values)

self.assertEqual(orig_val, dumped_val)

# cache the parsed easyconfig, to avoid that it is parsed again
self.parsed_easyconfigs.append(ecs[0])

# test passed, so set back to True
single_tests_ok = True and prev_single_tests_ok


def suite():
"""Return all easyblock initialisation tests."""
# dynamically generate a separate test for each of the available easyconfigs
Expand Down