ci: More flatpak ci fixes

We need our `make install` to override the ostree RPM, so do it all in one txn.
This sort of thing is where a more rigorous model like rdgo/gcontinuous use
becomes better, but we'll hack it with shell for now.

Closes: #824
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-05-01 18:02:27 -04:00 committed by Atomic Bot
parent af7fed94ed
commit 7c88161044
3 changed files with 61 additions and 11 deletions

View File

@ -153,6 +153,8 @@ required: false
# docker --privileged run. # docker --privileged run.
host: host:
distro: fedora/25/atomic distro: fedora/25/atomic
specs:
ram: 4096 # build-bundle is a static delta, which needs RAM right now
tests: tests:
- docker run --rm --privileged -v $(pwd):/srv/code registry.fedoraproject.org/fedora:25 /bin/sh -c "cd /srv/code && ./ci/flatpak.sh" - docker run --rm --privileged -v $(pwd):/srv/code registry.fedoraproject.org/fedora:25 /bin/sh -c "cd /srv/code && ./ci/flatpak.sh"

View File

@ -0,0 +1,44 @@
From 6197e6922e3ba3c8881733a6a3253e8ae12eb538 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Fri, 5 May 2017 16:36:04 -0400
Subject: [PATCH] tests: Fix race condition in tmp webserver
I was seeing this when trying to run flatpak's tests in ostree's CI:
https://github.com/ostreedev/ostree/pull/824
The race here is that the python process can still be writing to the output
while sed is reading it, and hence we'll find a difference on the next line.
Fix this by making a tmp copy of the file, which then both sed and cmp will
read consistently.
I'm not *entirely* sure this will fix the problem as I couldn't easily reproduce
the race locally, but I believe it at least fixes *a* race.
---
tests/test-webserver.sh | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tests/test-webserver.sh b/tests/test-webserver.sh
index 3291b06..2964ce9 100755
--- a/tests/test-webserver.sh
+++ b/tests/test-webserver.sh
@@ -10,9 +10,15 @@ env PYTHONUNBUFFERED=1 setsid python -m SimpleHTTPServer 0 >${test_tmpdir}/httpd
child_pid=$!
for x in $(seq 50); do
- sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output > ${test_tmpdir}/httpd-port
- if ! cmp ${test_tmpdir}/httpd-output ${test_tmpdir}/httpd-port 1>/dev/null; then
- break
+ # Snapshot the output
+ cp ${test_tmpdir}/httpd-output{,.tmp}
+ # If it's non-empty, see whether it matches our regexp
+ if test -s ${test_tmpdir}/httpd-output.tmp; then
+ sed -e 's,Serving HTTP on 0.0.0.0 port \([0-9]*\) \.\.\.,\1,' < ${test_tmpdir}/httpd-output.tmp > ${test_tmpdir}/httpd-port
+ if ! cmp ${test_tmpdir}/httpd-output.tmp ${test_tmpdir}/httpd-port 1>/dev/null; then
+ # If so, we've successfully extracted the port
+ break
+ fi
fi
sleep 0.1
done
--
2.9.3

View File

@ -12,23 +12,27 @@ build() {
codedir=$(pwd) codedir=$(pwd)
# Core prep # Core prep
dnf -y install dnf-plugins-core yum -y install dnf-plugins-core @buildsys-build 'dnf-command(builddep)'
dnf install -y @buildsys-build # build+install ostree, and build deps for both, so that our
dnf install -y 'dnf-command(builddep)' # make install overrides the ostree via rpm
dnf builddep -y ostree flatpak
yum -y install flatpak && rpm -e flatpak
# we use yaml below
yum -y install python3-PyYAML
# build+install ostree # Now get flatpak's deps from rhci file
dnf builddep -y ostree
build
make install
tmpd=$(mktemp -d) tmpd=$(mktemp -d)
cd ${tmpd} cd ${tmpd}
# Frozen to a tag for now on general principle # Frozen to a tag for now on general principle
git clone --recursive --depth=1 -b 0.9.3 https://github.com/flatpak/flatpak git clone --recursive --depth=1 -b 0.9.3 https://github.com/flatpak/flatpak
cd flatpak cd flatpak
dnf builddep -y flatpak python3 -c 'import yaml; y = list(yaml.load_all(open(".redhat-ci.yml")))[0]; print("\0".join(y["packages"]))' | xargs -0 yum install -y
# And runtime deps # back to ostree and build
dnf install -y flatpak && rpm -e flatpak cd ${codedir}
dnf install -y which attr fuse parallel # for the test suite build
make install
cd ${tmpd}/flatpak
patch -p1 < ${codedir}/ci/*.patch
build build
# We want to capture automake results from flatpak # We want to capture automake results from flatpak
cleanup() { cleanup() {