Source code for benchbuild.projects.lnt.lnt

"""
LNT based measurements.

"""
from glob import glob
from os import path

import logging

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.wrapping import wrap_dynamic
from benchbuild.utils.cmd import virtualenv, mkdir, rm, cat

from plumbum import local, FG


LOG = logging.getLogger(__name__)


[docs]class LNTGroup(Project): """LNT ProjectGroup for running the lnt test suite.""" DOMAIN = 'lnt' GROUP = 'lnt' VERSION = '9.0.1.13' NAME_FILTERS = [ r'(?P<name>.+)\.simple', r'(?P<name>.+)-(dbl|flt)', ] 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] def configure(self): sandbox_dir = path.join(self.builddir, "run") if path.exists(sandbox_dir): rm("-rf", sandbox_dir) mkdir(sandbox_dir)
[docs] def before_run_tests(self, experiment, run): exp = wrap_dynamic(self, "lnt_runner", experiment, name_filters=LNTGroup.NAME_FILTERS) 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) return (exp, lnt, sandbox_dir, clang, clang_cxx)
[docs] def after_run_tests(self, sandbox_dir): logfiles = glob(path.join(sandbox_dir, "./*/test.log")) for log in logfiles: LOG.info("Dumping contents of: %s", log) cat[log] & FG
[docs] def build(self): pass
[docs]class SingleSourceBenchmarks(LNTGroup): NAME = 'SingleSourceBenchmarks' DOMAIN = 'LNT (SSB)'
[docs] def run_tests(self, experiment, run): exp, lnt, sandbox_dir, clang, clang_cxx = \ self.before_run_tests(experiment, run) 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")]) self.after_run_tests(sandbox_dir)
[docs]class MultiSourceBenchmarks(LNTGroup): NAME = 'MultiSourceBenchmarks' DOMAIN = 'LNT (MSB)'
[docs] def run_tests(self, experiment, run): exp, lnt, sandbox_dir, clang, clang_cxx = \ self.before_run_tests(experiment, run) 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")]) self.after_run_tests(sandbox_dir)
[docs]class MultiSourceApplications(LNTGroup): NAME = 'MultiSourceApplications' DOMAIN = 'LNT (MSA)'
[docs] def run_tests(self, experiment, run): exp, lnt, sandbox_dir, clang, clang_cxx = \ self.before_run_tests(experiment, run) 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")]) self.after_run_tests(sandbox_dir)
[docs]class SPEC2006(LNTGroup): NAME = 'SPEC2006' DOMAIN = 'LNT (Ext)'
[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, run): exp, lnt, sandbox_dir, clang, clang_cxx = \ self.before_run_tests(experiment, run) 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-externals", self.builddir, "--make-param=RUNUNDER=" + str(exp), "--only-test=" + path.join("External", "SPEC")]) self.after_run_tests(sandbox_dir) self.after_run_tests(sandbox_dir)
[docs]class Povray(LNTGroup): NAME = 'Povray' DOMAIN = 'LNT (Ext)' 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, run): exp, lnt, sandbox_dir, clang, clang_cxx = \ self.before_run_tests(experiment, run) 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-externals", self.builddir, "--make-param=RUNUNDER=" + str(exp), "--only-test=" + path.join("External", "Povray")]) self.after_run_tests(sandbox_dir)