=== modified file 'lava_test/commands.py'
@@ -289,7 +289,8 @@
self.args.skip_software_context,
self.args.skip_hardware_context,
self.args.trusted_time,
- self.args.analyzer_assigned_uuid)
+ self.args.analyzer_assigned_uuid,
+ test)
except ImportError as exc:
msg_template = (
"Unable to probe for software context. Install the '%s'"
=== modified file 'lava_test/core/artifacts.py'
@@ -138,7 +138,8 @@
skip_software_context=False,
skip_hardware_context=False,
time_check_performed=False,
- analyzer_assigned_uuid=None):
+ analyzer_assigned_uuid=None,
+ test=None):
"""
Create the bundle object.
@@ -166,7 +167,8 @@
}
# Store hardware and software context if requested
if not skip_software_context:
- test_run['software_context'] = swprofile.get_software_context()
+ test_run['software_context'] = swprofile.get_software_context(
+ test=test)
if not skip_hardware_context:
test_run['hardware_context'] = hwprofile.get_hardware_context()
# Create the bundle object
=== modified file 'lava_test/core/installers.py'
@@ -15,10 +15,11 @@
import hashlib
import os
+import subprocess
from lava_test.api.delegates import ITestInstaller
from lava_test.extcmd import ExternalCommandWithDelegate
-from lava_test.utils import geturl
+from lava_test.utils import changed_directory, geturl
class TestInstaller(ITestInstaller):
@@ -40,12 +41,25 @@
:ivar md5:
The md5sum to check the integrety of the download
+
+ :ivar git_repos:
+ A list of git urls to clone for the test definition. These will be
+ cloned befre the install steps are executed for the test definition.
+ The repo information will then be included in the bundle's source data
+
+ :ivar bzr_repos:
+ A list of git urls to clone for the test definition. These will be
+ cloned befre the install steps are executed for the test definition.
+ The repo information will then be included in the bundle's source data
"""
- def __init__(self, steps=None, deps=None, url=None, md5=None, **kwargs):
+ def __init__(self, steps=None, deps=None, url=None, md5=None,
+ git_repos=None, bzr_repos=None, **kwargs):
self.steps = steps or []
self.deps = deps or []
self.url = url
self.md5 = md5
+ self.git_repos = git_repos
+ self.bzr_repos = bzr_repos
def __repr__(self):
return "<%s steps=%r deps=%r url=%r md5=%r>" % (
@@ -101,6 +115,110 @@
filename, checkmd5.hexdigest(), self.md5))
return filename
+ def _git_local(self, repo):
+ """
+ convert git url into the local name, it git://foo.com/blah.git to blah
+ """
+ return os.path.splitext(os.path.basename(repo))[0]
+
+ def _git_clone(self, observer):
+ if not self.git_repos:
+ return
+
+ for repo in self.git_repos:
+ if observer:
+ observer.about_to_download_file(repo)
+
+ self._run_shell_cmd("git clone %s" % repo, observer)
+
+ if not os.path.exists(self._git_local(repo)):
+ raise RuntimeError("Failed to clone %s" % repo)
+ if observer:
+ observer.did_download_file(repo)
+
+ @staticmethod
+ def _git_source(testdir, dirname):
+ with changed_directory('%s/%s' % (testdir, dirname)):
+ commit_id = subprocess.check_output(
+ ['git', 'log', '-1', '--pretty=%H']).strip()
+ url = subprocess.check_output(
+ ['git', 'config', '--get', 'remote.origin.url']).strip()
+ return {
+ 'project_name': url.rsplit('/')[-1],
+ 'branch_vcs': 'git',
+ 'branch_revision': commit_id,
+ 'branch_url': url,
+ }
+
+ def _git_sources(self, testdir):
+ """
+ Pulls git information from the given local repositories and formats
+ them as needed by the software_context's "sources" attribute
+ """
+ sources = []
+ for d in self.git_repos:
+ d = self._git_local(d)
+ sources.append(self._git_source(testdir, d))
+ return sources
+
+ def _bzr_local(self, repo):
+ """
+ convert bzr url into the local name, it lp:lava-test to lava-test
+ """
+ repo = repo.replace('lp:', '')
+ return repo.split('/')[-1]
+
+ @staticmethod
+ def _bzr_source(testdir, dirname):
+ with changed_directory('%s/%s' % (testdir, dirname)):
+ revno = subprocess.check_output(
+ ['bzr', 'log', '-r', '-1', '--log-format=line']).split(':')[0]
+ info = subprocess.check_output(['bzr', 'info'])
+ for line in info.split('\n'):
+ line = line.strip()
+ if line.startswith('parent branch:'):
+ url = line.split(':', 1)[-1]
+ return {
+ 'project_name': dirname,
+ 'branch_vcs': 'bzr',
+ 'branch_revision': revno,
+ 'branch_url': url,
+ }
+
+ def _bzr_sources(self, testdir):
+ """
+ Pulls bzr information from the given local repositories and formats
+ them as needed by the software_context's "sources" attribute
+ """
+ sources = []
+ for d in self.bzr_repos:
+ d = self._bzr_local(d)
+ sources.append(self._bzr_source(testdir, d))
+ return sources
+
+ def _bzr_branch(self, observer):
+ if not self.bzr_repos:
+ return
+
+ for repo in self.bzr_repos:
+ if observer:
+ observer.about_to_download_file(repo)
+
+ self._run_shell_cmd("bzr branch %s" % repo, observer)
+
+ if not os.path.exists(self._bzr_local(repo)):
+ raise RuntimeError("Failed to clone %s" % repo)
+ if observer:
+ observer.did_download_file(repo)
+
+ def get_software_sources(self, testdir):
+ sources = []
+ if self.git_repos:
+ sources.extend(self._git_sources(testdir))
+ if self.bzr_repos:
+ sources.extend(self._bzr_sources(testdir))
+ return sources
+
def _runsteps(self, observer):
for cmd in self.steps:
self._run_shell_cmd(cmd, observer)
@@ -108,4 +226,6 @@
def install(self, observer=None):
self._installdeps(observer)
self._download(observer)
+ self._git_clone(observer)
+ self._bzr_branch(observer)
self._runsteps(observer)
=== modified file 'lava_test/core/swprofile.py'
@@ -38,7 +38,7 @@
return packages
-def get_software_context(apt_cache=None, lsb_information=None):
+def get_software_context(apt_cache=None, lsb_information=None, test=None):
""" Return dict used for storing software_context information
test_id - Unique identifier for this test
@@ -50,6 +50,10 @@
software_context = {}
software_context['image'] = get_image(lsb_information)
software_context['packages'] = get_packages(apt_cache)
+ if test and test.installer:
+ sources = test.installer.get_software_sources(test.install_dir)
+ if sources:
+ software_context['sources'] = sources
return software_context
@@ -69,3 +73,4 @@
lsb_information = lsb_release.get_distro_information()
name = lsb_information['DESCRIPTION']
return {"name": name}
+
=== modified file 'lava_test/test_definitions/bluetooth_enablement.py'
@@ -31,18 +31,17 @@
from lava_test.core.tests import Test
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = [(
- "bzr branch lp:~linaro-foundations/linaro-ubuntu/lava-test-bt-enablement"
- " bluetooth-enablement")]
+BZR_REPOS = ["lp:~linaro-foundations/linaro-ubuntu/lava-test-bt-enablement"]
+INSTALLSTEPS = []
DEPS = ["bzr", "bluez"]
-RUNSTEPS = ["cd bluetooth-enablement; sudo bash -x ./run-test.sh"]
+RUNSTEPS = ["cd lava-test-bt-enablement; sudo bash -x ./run-test.sh"]
PATTERN = "(?P<test_case_id>[a-zA-Z0-9_-]+):\s(?P<result>\w+)"
FIXUPS = {
"PASS": "pass",
"FAIL": "fail"
}
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, fixupdict=FIXUPS)
=== modified file 'lava_test/test_definitions/bootchart.py'
@@ -29,12 +29,13 @@
from lava_test.core.tests import Test
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = ['bzr branch lp:~linaro-foundations/lava-test/bootchartscript']
+BZR_REPOS = ['lp:~linaro-foundations/lava-test/bootchartscript']
+INSTALLSTEPS = []
DEPS = ['bootchart', 'pybootchartgui', 'bzr']
RUNSTEPS = ['./bootchartscript/bootchartscript.sh $(OPTIONS)']
PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+\.\d+)"
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, appendall={'units': 'sec', 'result': 'pass'})
=== modified file 'lava_test/test_definitions/e2eaudiotest.py'
@@ -20,13 +20,15 @@
**Default options:** None
"""
-INSTALLSTEPS = ['git clone git://git.linaro.org/people/kurt-r-taylor/e2eaudiotest.git']
+GIT_REPOS = ['git://git.linaro.org/people/kurt-r-taylor/e2eaudiotest.git']
+
+INSTALLSTEPS = ['cd e2eaudiotest; gcc testfreq.c utils_alsa.c -lasound -lfftw3 -o testfreq ']
DEPS = ['git-core', 'libasound2-dev', 'libfftw3-dev', 'gcc']
DEFAULT_OPTIONS = ""
-RUNSTEPS = ['cd e2eaudiotest; gcc testfreq.c utils_alsa.c -lasound -lfftw3 -o testfreq ; ./e2eaudiotest.sh']
+RUNSTEPS = ['cd e2eaudiotest; ./e2eaudiotest.sh']
PATTERN = "^(?P<test_case_id>\w+):\W+(?P<result>\w+)\W+(?P<measurement>\d+)\W+sinewave"
-e2einst = TestInstaller(INSTALLSTEPS, deps=DEPS)
+e2einst = TestInstaller(INSTALLSTEPS, deps=DEPS, git_repos=GIT_REPOS)
e2erun = TestRunner(RUNSTEPS,default_options=DEFAULT_OPTIONS)
e2eparser = TestParser(PATTERN,
appendall={'units':'Hz'})
=== modified file 'lava_test/test_definitions/firefox.py'
@@ -27,14 +27,16 @@
from lava_test.core.tests import Test
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = ['git clone git://github.com/janimo/firefox-startup-timing.git']
+
+GIT_REPOS = ['git://github.com/janimo/firefox-startup-timing.git']
+INSTALLSTEPS = []
DEPS = ['firefox', 'git-core', 'gcalctool']
RUNSTEPS = [(
'cd firefox-startup-timing;'
' ./firefox_startup_timing.sh $(OPTIONS)')]
PATTERN = "^(?P<test_case_id>\w+):(?P<measurement>\d+)"
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, git_repos=GIT_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, appendall={'units': 'ms', 'result': 'pass'})
=== modified file 'lava_test/test_definitions/leb_basic_graphics.py'
@@ -30,19 +30,17 @@
from lava_test.core.tests import Test
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = [
- ("bzr branch"
- " lp:~linaro-foundations/linaro-ubuntu/lava-test-basic-graphics"
- " leb-basic-graphics")]
+BZR_REPOS = ["lp:~linaro-foundations/linaro-ubuntu/lava-test-basic-graphics"]
+INSTALLSTEPS = []
DEPS = ["bzr", "mesa-utils-extra", "ubuntu-desktop"]
-RUNSTEPS = ["cd leb-basic-graphics; sudo bash -x ./run-test.sh"]
+RUNSTEPS = ["cd lava-test-basic-graphics; sudo bash -x ./run-test.sh"]
PATTERN = "(?P<test_case_id>[a-zA-Z0-9_-]+):\s(?P<result>\w+)"
FIXUPS = {
"PASS": "pass",
"FAIL": "fail"
}
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, fixupdict=FIXUPS)
=== modified file 'lava_test/test_definitions/lt_ti_lava.py'
@@ -29,8 +29,9 @@
# Continue the test run in case of failures
DEFAULT_OPTIONS = "-k"
-INSTALLSTEPS = ['git clone git://git.linaro.org/people/davelong/lt_ti_lava.git',
- 'cd lt_ti_lava && make -C utils']
+GIT_REPOS = ['git://git.linaro.org/people/davelong/lt_ti_lava.git']
+
+INSTALLSTEPS = ['cd lt_ti_lava && make -C utils']
RUNSTEPS = ['cd lt_ti_lava && make $(OPTIONS) check']
DEPS = ['git-core', 'linux-libc-dev', 'build-essential']
@@ -51,7 +52,7 @@
"\.\.\.\s+"
"(?P<result>\w+)")
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, git_repos=GIT_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN)
=== modified file 'lava_test/test_definitions/ltp-snowball-tests.py'
@@ -28,8 +28,8 @@
from lava_test.core.runners import TestRunner
from lava_test.core.tests import Test
-INSTALLSTEPS = ['git clone git://igloocommunity.org/git/testing/snowball-ltp-tests.git',
- 'cd snowball-ltp-tests; make config; make tests; make install']
+GIT_REPOS = ['git://igloocommunity.org/git/testing/snowball-ltp-tests.git']
+INSTALLSTEPS = ['cd snowball-ltp-tests; make config; make tests; make install']
DEPS = ['git-core', 'make', 'build-essential']
@@ -69,7 +69,7 @@
self.results['test_results'].append(
self.analyze_test_result(results))
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, git_repos=GIT_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = LTPParser(PATTERN, fixupdict=FIXUPS)
=== modified file 'lava_test/test_definitions/lttng.py'
@@ -28,14 +28,13 @@
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = [
- "apt-get build-dep lttng-tools --yes",
- "bzr branch lp:~linaro-foundations/linaro-ubuntu/lava-test-lttng"]
+BZR_REPOS=["lp:~linaro-foundations/linaro-ubuntu/lava-test-lttng"]
+INSTALLSTEPS = ["apt-get build-dep lttng-tools --yes"]
DEPS = ["bzr", "linux-headers-$(uname -r)", "lttng-modules-dkms"]
RUNSTEPS = ["cd lava-test-lttng; sudo bash -x ./run-test.sh"]
PATTERN = "^(?P<test_case_id>[\w:()]+)\s+\-\s+(?P<result>\w+$)"
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN)
=== modified file 'lava_test/test_definitions/perf.py'
@@ -29,7 +29,8 @@
DEFAULT_OPTIONS = ""
DEPS = ["bzr", "linux-tools", "stress-dbgsym"]
-INSTALLSTEPS = ["bzr branch lp:~linaro-maintainers/lava-test/lava-test-perf"]
+BZR_REPOS = ["lp:~linaro-maintainers/lava-test/lava-test-perf"]
+INSTALLSTEPS = []
RUNSTEPS = ["./lava-test-perf/run-perf-test.sh"]
PATTERN = "^(?P<test_case_id>perf[\w\s-]+)\s+:\s+(?P<result>\w+)"
FIXUPS = {
@@ -37,7 +38,7 @@
"FAIL": "fail"
}
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, fixupdict=FIXUPS)
=== modified file 'lava_test/test_definitions/pwrmgmt.py'
@@ -29,8 +29,8 @@
# Continue the test run in case of failures
DEFAULT_OPTIONS = "-k"
-INSTALLSTEPS = ['git clone git://git.linaro.org/tools/pm-qa.git',
- 'cd pm-qa && make -C utils']
+GIT_REPOS = ['git://git.linaro.org/tools/pm-qa.git']
+INSTALLSTEPS = ['cd pm-qa && make -C utils']
RUNSTEPS = ['cd pm-qa && make $(OPTIONS) check']
DEPS = ['git-core', 'linux-libc-dev', 'build-essential']
@@ -55,7 +55,7 @@
"\.\.\.\s+"
"(?P<result>\w+)")
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, git_repos=GIT_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, appendall={'result': 'pass'})
=== modified file 'lava_test/test_definitions/tjbench.py'
@@ -22,11 +22,12 @@
ppm="nightshot_iso_100.ppm"
URL_ppm="http://people.linaro.org/~qzhang/streams/nightshot_iso_100.ppm"
+BZR_REPOS = ['lp:~qzhang/libjpeg-turbo/tjbench']
+
# For the url is from wiki, its name will be saved as with some extra characters
# so it doesn't pass as parameter but use a separate install step.
-INSTALLSTEPS = ['wget --no-check-certificate -q "%s" -O %s' % (URL_ppm, ppm),
- 'bzr branch lp:~qzhang/libjpeg-turbo/tjbench']
-DEPS = ['libjpeg-turbo-progs', 'libjpeg-turbo62', 'wget']
+INSTALLSTEPS = ['wget --no-check-certificate -q "%s" -O %s' % (URL_ppm, ppm)]
+DEPS = ['bzr', 'libjpeg-turbo-progs', 'libjpeg-turbo62', 'wget']
DEFAULT_OPTIONS =""
RUNSTEPS = ['./tjbench/tjbench.sh %s' % ppm]
@@ -71,7 +72,7 @@
#RGB TD 4:2:0 95 3136 2352 19.45 15.53 23.30
PATTERN = "^(?P<format>\S+)\s+(?P<bitorder>\w+)\s+(?P<subsamp>[:\w]+)\s+(?P<qual>\d+)\s+\d+\s+\d+\s+(?P<comp_perf>\d+\.\d+)\s+(?P<comp_ratio>\d+\.\d+)\s+(?P<dcomp_perf>\d+\.\d+)"
-tjbench_inst = TestInstaller(INSTALLSTEPS, deps=DEPS, url=None)
+tjbench_inst = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
tjbench_run = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
tjbench_parser = TjbenchParser(PATTERN, appendall={'result':'pass'})
testobj = Test(test_id="tjbench",
=== modified file 'lava_test/test_definitions/wifi_enablement.py'
@@ -31,24 +31,22 @@
from lava_test.core.tests import Test
DEFAULT_OPTIONS = ""
-INSTALLSTEPS = [(
- "bzr branch"
- " lp:~linaro-foundations/linaro-ubuntu/lava-test-wifi-enablement"
- " wifi-enablement")]
+BZR_REPOS = ["lp:~linaro-foundations/linaro-ubuntu/lava-test-wifi-enablement"]
+INSTALLSTEPS = []
DEPS = [
"bzr",
"wpasupplicant",
"isc-dhcp-client",
"wireless-tools",
"net-tools"]
-RUNSTEPS = ["cd wifi-enablement; sudo bash -x ./run-test.sh"]
+RUNSTEPS = ["cd lava-test-wifi-enablement; sudo bash -x ./run-test.sh"]
PATTERN = "(?P<test_case_id>[a-zA-Z0-9_-]+):\s(?P<result>\w+)"
FIXUPS = {
"PASS": "pass",
"FAIL": "fail"
}
-installer = TestInstaller(INSTALLSTEPS, deps=DEPS)
+installer = TestInstaller(INSTALLSTEPS, deps=DEPS, bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, fixupdict=FIXUPS)
=== modified file 'lava_test/test_definitions/xrestop.py'
@@ -16,7 +16,7 @@
"""
xrestop - test for X11 server resource usage monitor
-**URL:** None
+**URL:** http://code.launchpad.net/~linaro-foundations/lava-test/xrestopscript
**Default options:** None
"""
@@ -26,12 +26,13 @@
from lava_test.core.runners import TestRunner
from lava_test.core.tests import Test
-INSTALLSTEPS = ['bzr branch lp:~linaro-foundations/lava-test/xrestopscript']
+BZR_REPOS = ['lp:~linaro-foundations/lava-test/xrestopscript']
+INSTALLSTEPS = []
RUNSTEPS = ["./xrestopscript/xrestop.sh $(OPTIONS)"]
PATTERN = "^(?P<test_case_id>\w+):\W+(?P<measurement>\d+)"
DEFAULT_OPTIONS = ""
-installer = TestInstaller(INSTALLSTEPS, deps=["xrestop"])
+installer = TestInstaller(INSTALLSTEPS, deps=["xrestop"], bzr_repos=BZR_REPOS)
runner = TestRunner(RUNSTEPS, default_options=DEFAULT_OPTIONS)
parser = TestParser(PATTERN, appendall={'units': 'KB', 'result': 'pass'})