ostree/ci/build-check.sh
Colin Walters 6e9d00dbeb ci: Rework installed tests to use Fedora Standard Test interface
Reusing the way `standard-test-roles` has support for booting
a qcow2 actually gets us to the "VM-in-container" flow.  Plus
Ansible over shell script is sometimes nicer.

https://fedoraproject.org/wiki/CI/Tests#Testing_an_Atomic_Host

It's better than what we were doing before for installed tests,
and moreover using Ansible more broadly for testing is going
to align us better with Fedora's CI.

As part of this I split off a "libpaprci" which I intend to maintain
as a "copylib" for a little bit between ostree/rpm-ostree, and then
we'll figure out how to expand from there (maybe some of the patterns
get "baked in" to PAPR for example).

Note the `FAH27-insttests` context moves to the top since it's now
of primary importance, and I expect that we start expanding it.

Closes: #1462
Approved by: jlebon
2018-03-08 20:51:42 +00:00

55 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/bash
# Install build dependencies, run unit tests and installed tests.
set -xeuo pipefail
dn=$(dirname $0)
. ${dn}/libpaprci/libbuild.sh
${dn}/build.sh
topdir=$(git rev-parse --show-toplevel)
resultsdir=$(mktemp -d)
make check
make syntax-check # TODO: do syntax-check under check
# See comment below
for x in test-suite.log config.log; do
mv ${x} ${resultsdir}
done
# 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
for x in test-suite.log config.log gdtr-results; do
if test -e ${resultsdir}/${x}; then
mv ${resultsdir}/${x} ${topdir}
fi
done
}
if test -x /usr/bin/gnome-desktop-testing-runner; then
mkdir ${resultsdir}/gdtr-results
# Temporary hack
(git clone --depth=1 https://git.gnome.org/browse/gnome-desktop-testing
cd gnome-desktop-testing
env NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib64
make && rm -f /usr/bin/ginsttest-runner && make install)
# set a trap in case a test fails
trap copy_out_gdtr_artifacts EXIT
# Use the new -L option
gnome-desktop-testing-runner -L ${resultsdir}/gdtr-results -p 0 ${INSTALLED_TESTS_PATTERN:-libostree/}
fi