Skip to content
Snippets Groups Projects
Commit b807ef1f authored by Mick Jordan's avatar Mick Jordan
Browse files

pkgtest: process install/test output online

parent 4b72486b
Branches
No related tags found
No related merge requests found
......@@ -74,6 +74,6 @@ builds = [
${gateTest} {capabilities : [linux, amd64, gate], name: "gate-test-linux-amd64"}
${gateStyle} {capabilities : [linux, amd64, gate], name: "gate-style-linux-amd64"}
# ${gateTest} {capabilities : [linux, sparcv9, gate], name: "gate-test-linux-sparcv9"}
${pkgtest} {capabilities : [linux, amd64, gate], name: "pkgtest-test-linux-amd64"}
${pkginstall} {capabilities : [linux, amd64, gate], name: "pkginstall-test-linux-amd64"}
# ${pkgtest} {capabilities : [linux, amd64, gate], name: "pkgtest-test-linux-amd64"}
# ${pkginstall} {capabilities : [linux, amd64, gate], name: "pkginstall-test-linux-amd64"}
]
\ No newline at end of file
......@@ -378,7 +378,7 @@ install.pkgs <- function(pkgnames, dependents.install=F) {
install.total <- length(pkgnames)
result <- TRUE
for (pkgname in pkgnames) {
cat("processing:", pkgname, "\n")
cat("BEGIN processing:", pkgname, "\n")
dependent.install.ok <- T
if (install.dependents.first && !dependents.install) {
dependents <- install.order(avail.pkgs, avail.pkgs[pkgname, ])
......@@ -439,6 +439,8 @@ install.pkgs <- function(pkgnames, dependents.install=F) {
}
}
}
cat("END processing:", pkgname, "\n")
install.count = install.count + 1
}
return(result)
......@@ -489,13 +491,18 @@ do.it <- function() {
cat("END package installation\n")
if (print.ok.installs) {
cat("BEGIN install status\n")
for (pkgname.i in names(install.status)) {
cat(paste0(pkgname.i, ":"), ifelse(install.status[pkgname.i], "OK", "FAILED"), "\n")
}
cat("END install status\n")
}
}
if (run.tests) {
if (no.install) {
check.installed.packages()
}
cat("BEGIN package tests\n")
test.count = 1
test.total = length(test.pkgnames)
......@@ -504,8 +511,10 @@ do.it <- function() {
if (dry.run) {
cat("would test:", pkgname, "\n")
} else {
cat("testing:", pkgname, "(", test.count, "of", test.total, ")", "\n")
cat("BEGIN testing:", pkgname, "(", test.count, "of", test.total, ")", "\n")
test.package(pkgname)
cat("END testing:", pkgname, "\n")
}
} else {
cat("install failed, not testing:", pkgname, "\n")
......
......@@ -23,7 +23,8 @@
from argparse import ArgumentParser
from os.path import join, abspath
import shutil, os
import shutil, os, re
import mx
import mx_fastr
def pkgtest(args):
......@@ -65,12 +66,62 @@ def pkgtest(args):
if args.invert_pkgset:
install_args += ['--invert-pkgset']
class TestStatus:
def __init__(self):
self.status = "unknown"
self.filelist = []
class OutputCapture:
def __init__(self):
self.data = ""
self.install_data = None
self.pkg = None
self.mode = None
self.start_install_pattern = re.compile(r"^BEGIN processing: (?P<package>[a-zA-Z0-9\.\-]+) .*")
self.test_pattern = re.compile(r"^(?P<status>BEGIN|END) testing: (?P<package>[a-zA-Z0-9\.\-]+) .*")
self.status_pattern = re.compile(r"^(?P<package>[a-zA-Z0-9\.\-]+): (?P<status>OK|FAILED).*")
self.install_data = dict()
self.install_status = dict()
self.test_info = dict()
def __call__(self, data):
print data,
self.data += data
if data == "BEGIN package installation\n":
self.mode = "install"
return
elif data == "BEGIN install status\n":
self.mode = "install_status"
return
elif data == "BEGIN package tests\n":
self.mode = "test"
return
if self.mode == "install":
start_install = re.match(self.start_install_pattern, data)
if start_install:
pkg_name = start_install.group(1)
self.pkg = pkg_name
self.install_data[self.pkg] = ""
if self.pkg:
self.install_data[self.pkg] += data
elif self.mode == "install_status":
if data == "END install status\n":
self.mode = None
return
status = re.match(self.status_pattern, data)
pkg_name = status.group(1)
self.install_status[pkg_name] = status.group(2) == "OK"
elif self.mode == "test":
test_match = re.match(self.test_pattern, data)
if test_match:
begin_end = test_match.group(1)
pkg_name = test_match.group(2)
if begin_end == "END":
pkg_testdir = join(mx.suite('fastr').dir, 'test', pkg_name)
for root, _, files in os.walk(pkg_testdir):
if not self.test_info.has_key(pkg_name):
self.test_info[pkg_name] = TestStatus()
for f in files:
self.test_info[pkg_name].filelist.append(join(root, f))
out = OutputCapture()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment