Skip to content

Commit

Permalink
Merge pull request #1 from boegel/bash_completion
Browse files Browse the repository at this point in the history
sync with develop
  • Loading branch information
damienfrancois committed Feb 5, 2016
2 parents e2249e8 + 411431c commit 4e71a0b
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 114 deletions.
2 changes: 1 addition & 1 deletion easybuild/toolchains/compiler/craype.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CrayPECompiler(Compiler):
COMPILER_FAMILY = None

COMPILER_UNIQUE_OPTS = {
'dynamic': (False, "Generate dynamically linked executable"),
'dynamic': (True, "Generate dynamically linked executable"),
'mpich-mt': (False, "Directs the driver to link in an alternate version of the Cray-MPICH library which \
provides fine-grained multi-threading support to applications that perform \
MPI operations within threaded regions."),
Expand Down
3 changes: 1 addition & 2 deletions easybuild/toolchains/craycce.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.toolchains.compiler.craype import CrayPECray
from easybuild.toolchains.fft.crayfftw import CrayFFTW
from easybuild.toolchains.linalg.libsci import LibSci
from easybuild.toolchains.mpi.craympich import CrayMPICH
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME


class CrayCCE(CrayPECray, CrayMPICH, LibSci, CrayFFTW):
class CrayCCE(CrayPECray, CrayMPICH, LibSci):
"""Compiler toolchain for Cray Programming Environment for Cray Compiling Environment (CCE) (PrgEnv-cray)."""
NAME = 'CrayCCE'
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME
Expand Down
3 changes: 1 addition & 2 deletions easybuild/toolchains/craygnu.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.toolchains.compiler.craype import CrayPEGCC
from easybuild.toolchains.fft.crayfftw import CrayFFTW
from easybuild.toolchains.linalg.libsci import LibSci
from easybuild.toolchains.mpi.craympich import CrayMPICH
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME


class CrayGNU(CrayPEGCC, CrayMPICH, LibSci, CrayFFTW):
class CrayGNU(CrayPEGCC, CrayMPICH, LibSci):
"""Compiler toolchain for Cray Programming Environment for GCC compilers (PrgEnv-gnu)."""
NAME = 'CrayGNU'
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME
Expand Down
3 changes: 1 addition & 2 deletions easybuild/toolchains/crayintel.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.toolchains.compiler.craype import CrayPEIntel
from easybuild.toolchains.fft.crayfftw import CrayFFTW
from easybuild.toolchains.linalg.libsci import LibSci
from easybuild.toolchains.mpi.craympich import CrayMPICH
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME


class CrayIntel(CrayPEIntel, CrayMPICH, LibSci, CrayFFTW):
class CrayIntel(CrayPEIntel, CrayMPICH, LibSci):
"""Compiler toolchain for Cray Programming Environment for Intel compilers (PrgEnv-intel)."""
NAME = 'CrayIntel'
SUBTOOLCHAIN = DUMMY_TOOLCHAIN_NAME
Expand Down
71 changes: 0 additions & 71 deletions easybuild/toolchains/fft/crayfftw.py

This file was deleted.

2 changes: 1 addition & 1 deletion easybuild/tools/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def search_file(paths, query, short=False, ignore_dirs=None, silent=False, filen

if terse:
for line in hits:
print line
print(line)
else:
for line in var_lines + hit_lines:
print_msg(line, log=_log, silent=silent, prefix=False)
Expand Down
2 changes: 1 addition & 1 deletion easybuild/tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def postprocess(self):
if not HAVE_AUTOPEP8:
raise EasyBuildError("Python 'autopep8' module required to reformat dumped easyconfigs as requested")

# some options imply enabling --terse
# imply --terse for --last-log to avoid extra output that gets in the way
if self.options.last_log:
self.options.terse = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def find_rel_test():
packages=easybuild_packages,
package_dir={'test.framework': "test/framework"},
package_data={"test.framework": find_rel_test()},
scripts=["eb", "optcomplete.bash", "minimal_bash_completion.bash"],
scripts=["eb", "optcomplete.bash", "minimal_bash_completion.bash", "eb_bash_completion.bash"],
data_files=[('easybuild/scripts', glob.glob('easybuild/scripts/*'))],
long_description=read('README.rst'),
classifiers=[
Expand Down
98 changes: 65 additions & 33 deletions test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,65 +559,97 @@ def test_list_easyblocks(self):
def test_search(self):
"""Test searching for easyconfigs."""

fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
os.close(fd)
test_easyconfigs_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs')

# simple search
args = [
'--search=gzip',
'--robot=%s' % os.path.join(os.path.dirname(__file__), 'easyconfigs'),
'--unittest-file=%s' % self.logfile,
'--robot=%s' % test_easyconfigs_dir,
]
self.eb_main(args, logfile=dummylogfn)
logtxt = read_file(self.logfile)
self.mock_stdout(True)
self.eb_main(args, testing=False)
txt = self.get_stdout()
self.mock_stdout(False)

info_msg = r"Searching \(case-insensitive\) for 'gzip' in"
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
for ec in ["gzip-1.4.eb", "gzip-1.4-GCC-4.6.3.eb"]:
self.assertTrue(re.search(r" \* \S*%s$" % ec, logtxt, re.M), "Found easyconfig %s in '%s'" % (ec, logtxt))

if os.path.exists(dummylogfn):
os.remove(dummylogfn)

write_file(self.logfile, '')
regex = re.compile(r" \* \S*%s$" % ec, re.M)
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))

# search w/ regex
args = [
'--search=^gcc.*2.eb',
'--robot=%s' % os.path.join(os.path.dirname(__file__), 'easyconfigs'),
'--unittest-file=%s' % self.logfile,
'--robot=%s' % test_easyconfigs_dir,
]
self.eb_main(args, logfile=dummylogfn)
logtxt = read_file(self.logfile)
self.mock_stdout(True)
self.eb_main(args, testing=False)
txt = self.get_stdout()
self.mock_stdout(False)

info_msg = r"Searching \(case-insensitive\) for '\^gcc.\*2.eb' in"
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
for ec in ['GCC-4.7.2.eb', 'GCC-4.8.2.eb', 'GCC-4.9.2.eb']:
self.assertTrue(re.search(r" \* \S*%s$" % ec, logtxt, re.M), "Found easyconfig %s in '%s'" % (ec, logtxt))
regex = re.compile(r" \* \S*%s$" % ec, re.M)
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))

if os.path.exists(dummylogfn):
os.remove(dummylogfn)
gcc_ecs = [
'GCC-4.6.3.eb',
'GCC-4.6.4.eb',
'GCC-4.7.2.eb',
'GCC-4.8.2.eb',
'GCC-4.8.3.eb',
'GCC-4.9.2.eb',
]

write_file(self.logfile, '')
# test --search-filename
args = [
'--search-filename=^gcc',
'--robot=%s' % test_easyconfigs_dir,
]
self.mock_stdout(True)
self.eb_main(args, testing=False)
txt = self.get_stdout()
self.mock_stdout(False)

for ec in gcc_ecs:
regex = re.compile(r"^ \* %s$" % ec, re.M)
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))

# test --search-filename --terse
args = [
'--search-filename=^gcc',
'--terse',
'--robot=%s' % test_easyconfigs_dir,
]
self.mock_stdout(True)
self.eb_main(args, testing=False)
txt = self.get_stdout()
self.mock_stdout(False)

for ec in gcc_ecs:
regex = re.compile(r"^%s$" % ec, re.M)
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))

# also test --search-short/-S
for search_arg in ['-S', '--search-short']:
open(self.logfile, 'w').write('')
args = [
search_arg,
'toy-0.0',
'-r',
os.path.join(os.path.dirname(__file__), 'easyconfigs'),
'--unittest-file=%s' % self.logfile,
test_easyconfigs_dir,
]
self.eb_main(args, logfile=dummylogfn, raise_error=True, verbose=True)
logtxt = read_file(self.logfile)
self.mock_stdout(True)
self.eb_main(args, raise_error=True, verbose=True, testing=False)
txt = self.get_stdout()
self.mock_stdout(False)

info_msg = r"Searching \(case-insensitive\) for 'toy-0.0' in"
self.assertTrue(re.search(info_msg, logtxt), "Info message when searching for easyconfigs in '%s'" % logtxt)
self.assertTrue(re.search('INFO CFGS\d+=', logtxt), "CFGS line message found in '%s'" % logtxt)
self.assertTrue(re.search(info_msg, txt), "Info message when searching for easyconfigs in '%s'" % txt)
self.assertTrue(re.search('^CFGS\d+=', txt, re.M), "CFGS line message found in '%s'" % txt)
for ec in ["toy-0.0.eb", "toy-0.0-multiple.eb"]:
self.assertTrue(re.search(" \* \$CFGS\d+/*%s" % ec, logtxt), "Found easyconfig %s in '%s'" % (ec, logtxt))

if os.path.exists(dummylogfn):
os.remove(dummylogfn)
regex = re.compile(r" \* \$CFGS\d+/*%s" % ec, re.M)
self.assertTrue(regex.search(txt), "Found pattern '%s' in: %s" % (regex.pattern, txt))

def test_dry_run(self):
"""Test dry run (long format)."""
Expand Down

0 comments on commit 4e71a0b

Please sign in to comment.