-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'azure-pipeline-tests' of https://github.com/andreasgers…
…tmayr/pcp into andreasgerstmayr-azure-pipeline-tests
- Loading branch information
Showing
9 changed files
with
228 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
jobs: | ||
- job: fedora30 | ||
displayName: Fedora 30 | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: build/containers/qa/qa.yml | ||
parameters: | ||
distribution: fedora30 | ||
- job: fedora_rawhide | ||
displayName: Fedora Rawhide | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: build/containers/qa/qa.yml | ||
parameters: | ||
distribution: fedora-rawhide | ||
- job: debian_stable | ||
displayName: Debian Stable | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: build/containers/qa/qa.yml | ||
parameters: | ||
distribution: debian-stable | ||
- job: debian_testing | ||
displayName: Debian Testing | ||
pool: | ||
vmImage: 'ubuntu-latest' | ||
steps: | ||
- template: build/containers/qa/qa.yml | ||
parameters: | ||
distribution: debian-testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM debian:stable | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
pkg-config make gcc g++ libc6-dev flex bison \ | ||
sudo hostname findutils bc git cppcheck \ | ||
man procps \ | ||
perl \ | ||
python-dev python3 python3-dev pylint \ | ||
e2fsprogs xfsprogs systemd-sysv \ | ||
dpkg-dev gawk debhelper libreadline-dev chrpath python-all python3-all python-dev \ | ||
libnspr4-dev libnss3-dev libsasl2-dev libmicrohttpd-dev libavahi-common-dev \ | ||
zlib1g-dev libclass-dbi-perl libdbd-mysql-perl python3-psycopg2 libcairo2-dev \ | ||
libextutils-autoinstall-perl libxml-tokeparser-perl librrds-perl libjson-perl \ | ||
libwww-perl libnet-snmp-perl libnss3-tools \ | ||
python3-requests libspreadsheet-read-perl libdata-peek-perl time libncurses5-dev | ||
|
||
RUN useradd -c "Performance Co-Pilot" -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp | ||
COPY . /pcp | ||
|
||
RUN cd /pcp && ./Makepkgs | ||
RUN mkdir /packages && cd /packages && mv /pcp/build/deb/*.deb . && dpkg -i *.deb | ||
RUN sed -ie '/\[Service\]/aTimeoutSec=120' /lib/systemd/system/{pmcd,pmlogger,pmie,pmproxy}.service | ||
CMD ["/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM debian:testing | ||
SHELL ["/bin/bash", "-c"] | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
pkg-config make gcc g++ libc6-dev flex bison \ | ||
sudo hostname findutils bc git cppcheck \ | ||
man procps \ | ||
perl \ | ||
python2-dev python3 python3-dev pylint \ | ||
e2fsprogs xfsprogs systemd-sysv \ | ||
dpkg-dev gawk debhelper libreadline-dev chrpath python-all python3-all python-dev \ | ||
libnspr4-dev libnss3-dev libsasl2-dev libmicrohttpd-dev libavahi-common-dev \ | ||
zlib1g-dev libclass-dbi-perl libdbd-mysql-perl python3-psycopg2 libcairo2-dev \ | ||
libextutils-autoinstall-perl libxml-tokeparser-perl librrds-perl libjson-perl \ | ||
libwww-perl libnet-snmp-perl libnss3-tools \ | ||
python3-requests libspreadsheet-read-perl libdata-peek-perl time \ | ||
python3-bpfcc | ||
|
||
RUN useradd -c "Performance Co-Pilot" -d /var/lib/pcp -M -r -s /usr/sbin/nologin pcp | ||
COPY . /pcp | ||
|
||
RUN cd /pcp && ./Makepkgs | ||
RUN mkdir /packages && cd /packages && mv /pcp/build/deb/*.deb . && dpkg -i *.deb | ||
RUN sed -ie '/\[Service\]/aTimeoutSec=120' /lib/systemd/system/{pmcd,pmlogger,pmie,pmproxy}.service | ||
CMD ["/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM fedora:rawhide | ||
|
||
RUN dnf -y install \ | ||
pkg-config make gcc flex bison \ | ||
which sudo hostname findutils bc git cppcheck \ | ||
rpm-build redhat-rpm-config initscripts man procps \ | ||
avahi-devel ncurses-devel readline-devel zlib-devel \ | ||
perl perl-devel perl-generators perl-ExtUtils-MakeMaker \ | ||
python2-devel python3 python3-devel pylint \ | ||
bcc-tools e2fsprogs xfsprogs | ||
|
||
COPY . /pcp | ||
RUN cd /pcp && ./Makepkgs --check --verbose \ | ||
--without-qt --without-qt3d --without-webapi --without-manager | ||
RUN mkdir /packages && cd /pcp/pcp-*/build/rpm && \ | ||
VER=$(pwd | cut -d- -f2 | cut -d/ -f1) && \ | ||
mv *-$VER-*.{x86_64,noarch}.rpm /packages | ||
RUN cd /packages && dnf -y install *.rpm | ||
RUN sed -ie '/\[Service\]/aTimeoutSec=120' /usr/lib/systemd/system/{pmcd,pmlogger,pmie,pmproxy}.service | ||
CMD ["/usr/sbin/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import os.path | ||
import glob | ||
import re | ||
from xml.sax.saxutils import escape | ||
|
||
def read_logfile(testsuite_path, no, ext): | ||
fn = str(no) + '.' + ext | ||
try: | ||
with open(os.path.join(testsuite_path, fn)) as f: | ||
return f.read() | ||
except IOError as e: | ||
return 'could not open {}: {}'.format(fn, e) | ||
|
||
def parse_log_line(line, testsuite_path): | ||
success_m = re.match(r'^\[\d+%\] (\d+)$', line) | ||
notrun_m = re.match(r'^\[\d+%\] (\d+) \[not run\] (.+)$', line) | ||
failed_m = re.match(r'^\[\d+%\] (\d+) (.+)$', line) | ||
if success_m: | ||
return { | ||
"no": success_m.group(1), | ||
"stdout": read_logfile(testsuite_path, success_m.group(1), "out") | ||
} | ||
elif notrun_m: | ||
return { | ||
"no": notrun_m.group(1), | ||
"skipped": notrun_m.group(2), | ||
"stdout": "" | ||
} | ||
elif failed_m: | ||
return { | ||
"no": failed_m.group(1), | ||
"failed": failed_m.group(2).replace("- ", ""), | ||
"failed_reason": read_logfile(testsuite_path, failed_m.group(1), "full"), | ||
"stdout": read_logfile(testsuite_path, failed_m.group(1), "out.bad") | ||
} | ||
else: | ||
return {} | ||
|
||
def parse_testsuite(log_fn, testsuite_path): | ||
testsuite = { | ||
"name": os.path.splitext(os.path.basename(log_fn))[0], | ||
"tests": [] | ||
} | ||
with open(log_fn) as f: | ||
for line in f: | ||
test = parse_log_line(line.rstrip(), testsuite_path) | ||
if test: | ||
testsuite["tests"].append(test) | ||
testsuite["tests_cnt"] = len(testsuite["tests"]) | ||
testsuite["skipped_cnt"] = len([test for test in testsuite["tests"] if "skipped" in test]) | ||
testsuite["failed_cnt"] = len([test for test in testsuite["tests"] if "failed" in test]) | ||
return testsuite | ||
|
||
def create_report(log_path, testsuite_path): | ||
testsuites = [] | ||
for fn in glob.glob(log_path + '/*.log'): | ||
testsuites.append(parse_testsuite(fn, testsuite_path)) | ||
|
||
print('<?xml version="1.0" encoding="UTF-8"?>') | ||
print('<testsuites>') | ||
|
||
for testsuite in testsuites: | ||
print('<testsuite name="{name}" tests="{tests_cnt}" skipped="{skipped_cnt}" failures="{failed_cnt}" errors="0">'.format(**testsuite)) | ||
for test in testsuite["tests"]: | ||
print('<testcase classname="{no}" name="{no}">'.format(**test)) | ||
if "skipped" in test: | ||
print('<skipped message="{skipped}"/>'.format(**test)) | ||
if "failed" in test: | ||
print('<failure message="{failed}">{failed_reason}</failure>'.format(failed=test["failed"], failed_reason=escape(test["failed_reason"]))) | ||
print('<system-out>{stdout}</system-out>'.format(stdout=escape(test["stdout"]))) | ||
print('</testcase>') | ||
print('</testsuite>') | ||
|
||
print('</testsuites>') | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) != 3: | ||
print('usage: {} log_path testsuite_path'.format(sys.argv[0])) | ||
sys.exit(1) | ||
|
||
create_report(sys.argv[1], sys.argv[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
parameters: | ||
distribution: '' | ||
|
||
steps: | ||
- script: | | ||
docker build -f build/containers/qa/Dockerfile.${{ parameters.distribution }} -t pcp-qa . | ||
docker run -d --privileged \ | ||
-v /lib/modules:/lib/modules:ro \ | ||
-v /usr/src:/usr/src:ro \ | ||
-v $(Build.ArtifactStagingDirectory):/artifacts \ | ||
--name pcp-qa pcp-qa | ||
docker exec pcp-qa bash -c 'touch /var/lib/pcp/pmdas/{simple,sample}/.NeedInstall' | ||
docker exec pcp-qa bash -c 'systemctl restart pmcd || journalctl -xe' | ||
docker exec pcp-qa bash -c 'mkdir /artifacts/{test-logs,pcp-logs}' | ||
displayName: 'Build Performance Co-Pilot' | ||
- script: docker exec pcp-qa bash -c 'cd /var/lib/pcp/testsuite && ./check -g sanity | tee /artifacts/test-logs/sanity.log' | ||
displayName: 'Run tests: Sanity' | ||
- script: docker exec pcp-qa bash -c 'cd /var/lib/pcp/testsuite && ./check -g pmda.bcc | tee /artifacts/test-logs/pmda.bcc.log' | ||
displayName: 'Run tests: BCC PMDA' | ||
- script: | | ||
docker exec pcp-qa bash -c 'cp -r /var/log/pcp/* /artifacts/pcp-logs' | ||
docker exec pcp-qa bash -c 'cp -r /packages /artifacts' | ||
docker exec pcp-qa bash -c 'python /pcp/build/containers/qa/gen_junit_report.py /artifacts/test-logs /var/lib/pcp/testsuite > /artifacts/test-logs/test.xml' | ||
displayName: 'Copy artifacts' | ||
- task: PublishTestResults@2 | ||
inputs: | ||
testResultsFormat: JUnit | ||
testResultsFiles: '*.xml' | ||
searchFolder: '$(Build.ArtifactStagingDirectory)/test-logs' | ||
failTaskOnFailedTests: true | ||
testRunTitle: ${{ parameters.distribution }} | ||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
pathtoPublish: $(Build.ArtifactStagingDirectory) | ||
artifactName: ${{ parameters.distribution }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters