2017-06-08 20:47:20 +03:00
#!/usr/bin/bash
# Install build dependencies, run unit tests and installed tests.
set -xeuo pipefail
dn = $( dirname $0 )
2020-06-17 22:48:31 +03:00
. ${ dn } /libbuild.sh
2017-06-08 20:47:20 +03:00
${ dn } /build.sh
2017-09-26 21:05:08 +03:00
topdir = $( git rev-parse --show-toplevel)
resultsdir = $( mktemp -d)
2017-06-08 20:47:20 +03:00
make check
make syntax-check # TODO: do syntax-check under check
2017-09-26 21:05:08 +03:00
# See comment below
for x in test-suite.log config.log; do
mv ${ x } ${ resultsdir }
done
2018-02-22 22:16:33 +03:00
# And now install; we'll run the test suite after we do a clang build first
# (But we don't install that one)
2017-06-08 20:47:20 +03:00
make install
2017-11-27 20:18:56 +03:00
2018-02-22 22:16:33 +03:00
# 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
2018-05-28 22:21:19 +03:00
if grep -q -e 'static inline.*_GLIB_AUTOPTR_LIST_FUNC_NAME' /usr/include/glib-2.0/glib/gmacros.h; then
echo 'Skipping clang check, see https://bugzilla.gnome.org/show_bug.cgi?id=796346'
else
2019-06-19 23:04:39 +03:00
export CFLAGS = " -Wall -Werror ${ CFLAGS :- } "
2018-02-22 22:16:33 +03:00
git clean -dfx && git submodule foreach git clean -dfx
export CC = clang
build
2018-05-28 22:21:19 +03:00
fi
2018-02-22 22:16:33 +03:00
fi
2017-11-27 20:18:56 +03:00
copy_out_gdtr_artifacts( ) {
# Keep this in sync with papr.yml
# TODO; Split the main/clang builds into separate build dirs
2019-10-11 23:25:48 +03:00
local artifactdir
artifactdir = ${ ARTIFACTS :- ${ topdir } }
2019-10-14 17:29:31 +03:00
mkdir -p " ${ artifactdir } "
2017-11-27 20:18:56 +03:00
for x in test-suite.log config.log gdtr-results; do
if test -e ${ resultsdir } /${ x } ; then
2019-10-11 23:25:48 +03:00
mv ${ resultsdir } /${ x } ${ artifactdir }
2017-11-27 20:18:56 +03:00
fi
done
}
2017-06-09 17:57:40 +03:00
if test -x /usr/bin/gnome-desktop-testing-runner; then
2017-09-26 21:05:08 +03:00
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)
2017-11-27 20:18:56 +03:00
# set a trap in case a test fails
trap copy_out_gdtr_artifacts EXIT
2017-09-26 21:05:08 +03:00
# Use the new -L option
gnome-desktop-testing-runner -L ${ resultsdir } /gdtr-results -p 0 ${ INSTALLED_TESTS_PATTERN :- libostree / }
2017-06-09 17:57:40 +03:00
fi