"""
LNT based measurements.
"""
from benchbuild.project import Project
from benchbuild.settings import CFG
from benchbuild.utils.compiler import lt_clang, lt_clang_cxx
from benchbuild.utils.downloader import Git, CopyNoFail
from benchbuild.utils.run import run
from benchbuild.utils.wrapping import wrap_dynamic
from plumbum import local
from benchbuild.utils.cmd import virtualenv
from benchbuild.utils.cmd import mkdir, rm
from os import path
[docs]class LNTGroup(Project):
"""LNT ProjectGroup for running the lnt test suite."""
DOMAIN = 'lnt'
GROUP = 'lnt'
VERSION = '9.0.1.13'
def __init__(self, exp):
super(LNTGroup, self).__init__(exp, "lnt")
src_dir = "lnt"
src_uri = "http://llvm.org/git/lnt"
test_suite_dir = "test-suite"
test_suite_uri = "http://llvm.org/git/test-suite"
[docs] def download(self):
Git(self.src_uri, self.src_dir)
Git(self.test_suite_uri, self.test_suite_dir)
virtualenv("local", "--python=python2", )
python = local[path.join("local", "bin", "python")]
python(path.join(self.src_dir, "setup.py"), "develop")
[docs]class SingleSourceBenchmarks(LNTGroup):
NAME = 'SingleSourceBenchmarks'
[docs] def run_tests(self, experiment):
exp = wrap_dynamic(self, "lnt_runner", experiment)
lnt = local[path.join("local", "bin", "lnt")]
sandbox_dir = path.join(self.builddir, "run")
clang = lt_clang(self.cflags, self.ldflags, self.compiler_extension)
clang_cxx = lt_clang_cxx(self.cflags, self.ldflags,
self.compiler_extension)
run(lnt["runtest", "nt", "-v", "-j1", "--sandbox", sandbox_dir, "--cc",
str(clang), "--cxx", str(clang_cxx), "--test-suite", path.join(
self.builddir, self.test_suite_dir), "--test-style",
"simple", "--make-param=RUNUNDER=" + str(exp), "--only-test=" +
path.join("SingleSource", "Benchmarks"), "-v"])
[docs]class MultiSourceBenchmarks(LNTGroup):
NAME = 'MultiSourceBenchmarks'
[docs] def run_tests(self, experiment):
exp = wrap_dynamic("lnt_runner", experiment)
lnt = local[path.join("local", "bin", "lnt")]
sandbox_dir = path.join(self.builddir, "run")
clang = lt_clang(self.cflags, self.ldflags, self.compiler_extension)
clang_cxx = lt_clang_cxx(self.cflags, self.ldflags,
self.compiler_extension)
run(lnt["runtest", "nt", "-v", "-j1", "--sandbox", sandbox_dir, "--cc",
str(clang), "--cxx", str(clang_cxx), "--test-suite", path.join(
self.builddir, self.test_suite_dir), "--test-style",
"simple", "--make-param=RUNUNDER=" + str(exp), "--only-test=" +
path.join("MultiSource", "Benchmarks")])
[docs]class MultiSourceApplications(LNTGroup):
NAME = 'MultiSourceApplications'
[docs] def run_tests(self, experiment):
exp = wrap_dynamic(self, "lnt_runner", experiment)
lnt = local[path.join("local", "bin", "lnt")]
sandbox_dir = path.join(self.builddir, "run")
clang = lt_clang(self.cflags, self.ldflags, self.compiler_extension)
clang_cxx = lt_clang_cxx(self.cflags, self.ldflags,
self.compiler_extension)
run(lnt["runtest", "nt", "-v", "-j1", "--sandbox", sandbox_dir, "--cc",
str(clang), "--cxx", str(clang_cxx), "--test-suite", path.join(
self.builddir, self.test_suite_dir), "--test-style",
"simple", "--make-param=RUNUNDER=" + str(exp), "--only-test=" +
path.join("MultiSource", "Applications")])
[docs]class SPEC2006(LNTGroup):
NAME = 'SPEC2006'
[docs] def download(self):
if CopyNoFail('speccpu2006'):
super(SPEC2006, self).download()
else:
print('======================================================')
print(('SPECCPU2006 not found in %s. This project will fail.', CFG[
'tmp_dir']))
print('======================================================')
[docs] def run_tests(self, experiment):
exp = wrap_dynamic(self, "lnt_runner", experiment)
lnt = local[path.join("local", "bin", "lnt")]
sandbox_dir = path.join(self.builddir, "run")
clang = lt_clang(self.cflags, self.ldflags, self.compiler_extension)
clang_cxx = lt_clang_cxx(self.cflags, self.ldflags,
self.compiler_extension)
run(lnt["runtest", "nt", "-v", "-j1", "--sandbox", sandbox_dir, "--cc",
str(clang), "--cxx", str(clang_cxx), "--test-suite", path.join(
self.builddir, self.test_suite_dir), "--test-style",
"simple", "--test-external", self.builddir,
"--make-param=RUNUNDER=" + str(
exp), "--only-test=" + path.join("External", "SPEC")])
[docs]class Povray(LNTGroup):
NAME = 'Povray'
povray_url = "https://github.com/POV-Ray/povray"
povray_src_dir = "Povray"
[docs] def download(self):
super(Povray, self).download()
Git(self.povray_url, self.povray_src_dir)
[docs] def run_tests(self, experiment):
exp = wrap_dynamic(self, "lnt_runner", experiment)
lnt = local[path.join("local", "bin", "lnt")]
sandbox_dir = path.join(self.builddir, "run")
clang = lt_clang(self.cflags, self.ldflags, self.compiler_extension)
clang_cxx = lt_clang_cxx(self.cflags, self.ldflags,
self.compiler_extension)
run(lnt["runtest", "nt", "-v", "-j1", "--sandbox", sandbox_dir, "--cc",
str(clang), "--cxx", str(clang_cxx), "--test-suite", path.join(
self.builddir, self.test_suite_dir), "--test-style",
"simple", "--test-external", self.builddir,
"--make-param=RUNUNDER=" + str(
exp), "--only-test=" + path.join("External", "Povray")])