Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Rework installed tests to use Fedora Standard Test interface #1462

Closed
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 23 additions & 59 deletions .papr.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,44 @@
# https://fedoraproject.org/wiki/CI/Tests
branches:
- master
- auto
- try

context: FAH27-insttests
required: true
context: f27-primary

container:
image: registry.fedoraproject.org/fedora:27

env:
# Enable all the sanitizers for this primary build.
# We only use -Werror=maybe-uninitialized here with a "fixed" toolchain
CFLAGS: '-fsanitize=undefined -fsanitize-undefined-trap-on-error -fsanitize=address -O2 -Wp,-D_FORTIFY_SOURCE=2'
# Only for CI with a known g-ir-scanner
GI_SCANNERFLAGS: '--warn-error'
ASAN_OPTIONS: 'detect_leaks=0' # Right now we're not fully clean, but this gets us use-after-free etc
# TODO when we're doing leak checks: G_SLICE: "always-malloc"
CONFIGOPTS: '--with-curl --with-openssl'
image: registry.fedoraproject.org/fedora:27

tests:
- ci/ci-commitmessage-submodules.sh
- ci/build-check.sh
- ci/ci-release-build.sh

timeout: 30m
- cd tests/fedora-str && ../../ci/build-rpm.sh
- ./tests/fedora-str/provision.sh
# TODO: enhance papr to have caching, a bit like https://docs.travis-ci.com/user/caching/
- curl -Lo fedora-atomic-host.qcow2 https://getfedora.org/atomic_qcow2_latest
- env "TEST_SUBJECTS=$(pwd)/fedora-atomic-host.qcow2" ./tests/fedora-str/run.sh

# Keep this in sync with build-check.sh
artifacts:
- test-suite.log
- config.log
- gdtr-results
- tests/fedora-str/artifacts/fedora-atomic-host.qcow2.log
- tests/fedora-str/artifacts/installed-tests.log

---

context: c7-primary
# This suite skips the RPMs and does the build+unit tests in a container
inherit: true
required: true

host:
distro: centos/7/atomic

context: f27-primary
env:
CFLAGS: ''
CONFIGOPTS: '--with-curl --with-openssl'
# We only use -Werror=maybe-uninitialized here with a "fixed" toolchain
CFLAGS: '-fsanitize=undefined -fsanitize-undefined-trap-on-error -fsanitize=address -O2 -Wp,-D_FORTIFY_SOURCE=2'
# Only for CI with a known g-ir-scanner
GI_SCANNERFLAGS: '--warn-error'
ASAN_OPTIONS: 'detect_leaks=0' # Right now we're not fully clean, but this gets us use-after-free etc
# TODO when we're doing leak checks: G_SLICE: "always-malloc"
CONFIGOPTS: '--with-curl --with-openssl'

tests:
- docker run --privileged -v $PWD:$PWD --workdir $PWD
registry.centos.org/centos/centos:7 sh -c
'yum install -y git && ci/build-check.sh'
- ci/ci-commitmessage-submodules.sh
- ci/build-check.sh
- ci/ci-release-build.sh

---

Expand Down Expand Up @@ -132,33 +123,6 @@ tests:

---

inherit: false
branches:
- master
- auto
- try

context: f27ah-insttest
required: false

cluster:
hosts:
- name: vmcheck
distro: fedora/27/atomic
container:
image: registry.fedoraproject.org/fedora:27

# Copy the build from the container to the host; ideally down the line
# this is installing an RPM via https://github.com/jlebon/redhat-ci/issues/10
tests:
- ci/build.sh
- make install DESTDIR=$(pwd)/insttree
- yum -y install rsync
- rsync -rl -e 'ssh -o User=root' . vmcheck:ostree/
- ssh root@vmcheck './ostree/tests/installed/fah-prep.sh && ./ostree/tests/installed/run.sh'

---

inherit: false
branches:
- master
Expand Down
27 changes: 14 additions & 13 deletions ci/build-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
set -xeuo pipefail

dn=$(dirname $0)
. ${dn}/libbuild.sh
. ${dn}/libpaprci/libbuild.sh
${dn}/build.sh
topdir=$(git rev-parse --show-toplevel)
resultsdir=$(mktemp -d)
Expand All @@ -14,9 +14,21 @@ make syntax-check # TODO: do syntax-check under check
for x in test-suite.log config.log; do
mv ${x} ${resultsdir}
done
# And now run the installed tests
# And now install; we'll run the test suite after we do a clang build first
# (But we don't install that one)
make install

# And now a clang build to find unused variables because it does a better
# job than gcc for vars with cleanups; perhaps in the future these could
# parallelize
if test -x /usr/bin/clang; then
# Except for clang-4.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
export CFLAGS="-Wall -Werror -Wno-error=unused-command-line-argument ${CFLAGS:-}"
git clean -dfx && git submodule foreach git clean -dfx
export CC=clang
build
fi

copy_out_gdtr_artifacts() {
# Keep this in sync with papr.yml
# TODO; Split the main/clang builds into separate build dirs
Expand All @@ -40,14 +52,3 @@ if test -x /usr/bin/gnome-desktop-testing-runner; then
# Use the new -L option
gnome-desktop-testing-runner -L ${resultsdir}/gdtr-results -p 0 ${INSTALLED_TESTS_PATTERN:-libostree/}
fi

# And now a clang build to find unused variables because it does a better
# job than gcc for vars with cleanups; perhaps in the future these could
# parallelize
if test -x /usr/bin/clang; then
# Except for clang-4.0: error: argument unused during compilation: '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' [-Werror,-Wunused-command-line-argument]
export CFLAGS="-Wall -Werror -Wno-error=unused-command-line-argument ${CFLAGS:-}"
git clean -dfx && git submodule foreach git clean -dfx
export CC=clang
build
fi
46 changes: 46 additions & 0 deletions ci/build-rpm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/bash
# Install build dependencies, run unit tests and installed tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: this looks like the wrong description, right?


set -xeuo pipefail

dn=$(dirname $0)
paprcidir=${dn}/libpaprci
. ${paprcidir}/libbuild.sh

# Auto-provision bootstrap resources if run as root (normally in CI)
if test "$(id -u)" == 0; then
pkg_install_buildroot
pkg_install make /usr/bin/rpmbuild git
fi

# PAPR really should do this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, good catch! Filed: projectatomic/papr#90.

if ! test -f libglnx/README.md || ! test -f bsdiff/README.md; then
git submodule update --init
fi

# Default libcurl on by default in fedora unless libsoup is enabled
if test "${OS_ID}" = 'fedora'; then
case "${CONFIGOPTS:-}" in
*--with-soup*|*--without-curl*) ;;
*) CONFIGOPTS="${CONFIGOPTS:-} --with-curl"
esac
fi
case "${CONFIGOPTS:-}" in
*--with-curl*|--with-soup*)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it's missing a * after the |.

if test -x /usr/bin/gnome-desktop-testing-runner; then
CONFIGOPTS="${CONFIGOPTS} --enable-installed-tests=exclusive"
fi
;;
esac

# TODO: Use some form of rpm's --build-in-place to skip archive-then-unpack?
make -f ${paprcidir}/Makefile.dist-packaging srpm PACKAGE=libostree DISTGIT_NAME=ostree
if test "$(id -u)" == 0; then
pkg_builddep *.src.rpm
else
echo "NOTE: Running as non-root, assuming build dependencies are installed"
fi
if ! ${paprcidir}/rpmbuild-cwd --rebuild *.src.rpm; then
find . -type f -name config.log -exec cat {} \;
exit 1
fi
19 changes: 8 additions & 11 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
set -xeuo pipefail

dn=$(dirname $0)
. ${dn}/libbuild.sh
. ${dn}/libpaprci/libbuild.sh

pkg_upgrade
pkg_install_builddeps ostree
# Until this propagates farther
pkg_install 'pkgconfig(libcurl)' 'pkgconfig(openssl)'
pkg_install_buildroot
pkg_builddep ostree
pkg_install sudo which attr fuse strace \
libubsan libasan libtsan PyYAML redhat-rpm-config \
elfutils
Expand All @@ -18,15 +17,13 @@ if test -n "${CI_PKGS:-}"; then
fi
pkg_install_if_os fedora gjs gnome-desktop-testing parallel coccinelle clang \
python3-PyYAML
(. /etc/os-release;
if test "${ID}" = "centos"; then
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
pkg_install python34{,-PyYAML}
fi
)
if test "${OS_ID}" = "centos"; then
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
pkg_install python34{,-PyYAML}
fi

# Default libcurl on by default in fedora unless libsoup is enabled
if sh -c '. /etc/os-release; test "${ID}" = fedora'; then
if test "${OS_ID}" = 'fedora'; then
case "${CONFIGOPTS:-}" in
*--with-soup*|*--without-curl*) ;;
*) CONFIGOPTS="${CONFIGOPTS:-} --with-curl"
Expand Down
2 changes: 1 addition & 1 deletion ci/ci-commitmessage-submodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ set -euo pipefail
# being tested rather than the merge sha
HEAD=${PAPR_COMMIT:-HEAD}
dn=$(dirname $0)
. ${dn}/libbuild.sh
. ${dn}/libpaprci/libbuild.sh

tmpd=$(mktemp -d)
touch ${tmpd}/.tmpdir
Expand Down
6 changes: 3 additions & 3 deletions ci/flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ set -xeuo pipefail
FLATPAK_TAG=0.10.2.1

dn=$(dirname $0)
. ${dn}/libbuild.sh
. ${dn}/libpaprci/libbuild.sh

codedir=$(pwd)

pkg_upgrade
pkg_install_builddeps ostree
pkg_install_builddeps flatpak
pkg_install_buildroot
pkg_builddep ostree flatpak
pkg_install gettext-devel # A new dependency
# Copy of builddeps from build.sh in flatpak
pkg_install sudo which attr fuse \
Expand Down
69 changes: 0 additions & 69 deletions ci/libbuild.sh

This file was deleted.

39 changes: 39 additions & 0 deletions ci/libpaprci/Makefile.dist-packaging
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- mode: Makefile -*-

mypath = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
topsrcdir = $(shell git rev-parse --show-toplevel)
GITREV = $(shell git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')

PACKAGE ?= $(shell basename $(topsrcdir))
DISTGIT_NAME ?= $(PACKAGE)
DISTGIT ?= https://src.fedoraproject.org/rpms/$(DISTGIT_NAME)
SPEC ?= $(topsrcdir)/$(DISTGIT_NAME).spec

PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
PKG_CLIENT_VER = $(PACKAGE)-client-$(GITREV_FOR_PKG)

dist-snapshot:
if ! test -f $(PKG_VER).tar.xz; then \
$(mypath)/make-git-snapshot.sh "$(topsrcdir)" "$(PKG_VER)" "$(GITREV)" && \
rm -f $(PKG_VER).tar.xz && \
xz $(PKG_VER).tar; \
fi

srpm: dist-snapshot
if test -f "$(SPEC)"; then \
sed -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(SPEC) > $(DISTGIT_NAME).spec && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, does this not work for some reason? (Judging by the comment in overlay-git.yaml).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works, I was just trying to proactively prevent any "not testing what was built" type issues like we've had once or twice. Basically I was thinking the very first test should be checking the binary's built version in some way. Which we now have.

$(mypath)/rpmbuild-cwd -bs $(DISTGIT_NAME).spec ; \
else \
test -d $(DISTGIT_NAME) || git clone --depth=1 $(DISTGIT) && \
mv $(PKG_VER).tar.xz $(DISTGIT_NAME) && \
origdir=$$(pwd); \
cd $(DISTGIT_NAME) && \
git stash && git pull -r && \
sed -i -e "s,^Version:.*,Version: $(GITREV_FOR_PKG)," $(DISTGIT_NAME).spec && \
rm -f *.src.rpm && \
$(mypath)/rpmbuild-cwd -bs $(DISTGIT_NAME).spec && mv *.src.rpm $${origdir}; \
fi

rpm: srpm
./rpmbuild-cwd --rebuild $(PKG_VER)*.src.rpm
Loading