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: Sync with ostree #1000

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
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
13 changes: 8 additions & 5 deletions .papr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ cluster:
container:
image: registry.fedoraproject.org/fedora:26

# https://bugzilla.redhat.com/show_bug.cgi?id=1483553
#packages:
# - git
# - rsync

env:
HOSTS: vmcheck1 vmcheck2 vmcheck3
# TODO use -fsanitize=address
CFLAGS: '-fsanitize=undefined -fsanitize-undefined-trap-on-error -O2 -Wp,-D_FORTIFY_SOURCE=2'
ASAN_OPTIONS: 'detect_leaks=0' # Right now we're not fully clean, but this gets us use-after-free etc
CI_PKGS: rsync

tests:
Expand All @@ -37,6 +35,7 @@ timeout: 60m

artifacts:
- test-suite.log
- config.log
- vmcheck

---
Expand All @@ -59,6 +58,10 @@ cluster:
# FIXME remove this version binding when rpm-md repos are updated
image: registry.centos.org/centos/centos:7.3.1611

# We only want the sanitizers on Fedora
env:
CFLAGS: ''

extra-repos:
- name: atomic-centos-continuous
baseurl: https://ci.centos.org/artifacts/sig-atomic/rdgo/centos-continuous/build
Expand Down
2 changes: 1 addition & 1 deletion Makefile-tests.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AM_TESTS_ENVIRONMENT += \
GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \
$(NULL)
if BUILDOPT_ASAN
AM_TESTS_ENVIRONMENT += ASAN_OPTIONS=detect_leaks=false
AM_TESTS_ENVIRONMENT += BUILDOPT_ASAN=yes ASAN_OPTIONS=detect_leaks=false
endif

testbin_cppflags = $(AM_CPPFLAGS) -I $(srcdir)/src/libpriv -I $(srcdir)/libglnx -I $(srcdir)/tests/common
Expand Down
13 changes: 0 additions & 13 deletions ci/build-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,3 @@ ${dn}/build.sh
# support parallel runs right now
/usr/bin/make check
make install

# And now a clang build to find unused variables, but only run on Fedora because
# the CentOS version is ancient anyway and doesn't support all the flags that
# might get passed to it.
id=$(. /etc/os-release && echo $ID)
if [ "$id" == fedora ]; then
git clean -dfx
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 turns out that libdnf is not ready to build with clang, and we'd subtly been avoiding that by not doing a git submodule foreach git clean -dfx like ostree does. For now let's just back this out while I try to unwind that.

export CC=clang
export CFLAGS='-Werror=unused-variable -Werror=maybe-uninitialized'
build_default
# don't actually run the tests, just compile them
/usr/bin/make check TESTS=
fi
9 changes: 3 additions & 6 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@ elif [ "$id" == centos ]; then
fi

pkg_upgrade

install_builddeps rpm-ostree

yum install -y /usr/bin/g-ir-scanner # Accidentally omitted
pkg_install_builddeps rpm-ostree
# Mostly dependencies for tests
yum install -y ostree{,-devel,-grub2} createrepo_c /usr/bin/jq PyYAML clang \
pkg_install ostree{,-devel,-grub2} createrepo_c /usr/bin/jq PyYAML clang \
libubsan libasan libtsan elfutils fuse sudo python-gobject-base

if [ -n "${CI_PKGS:-}" ]; then
Expand All @@ -33,5 +30,5 @@ fi
# create an unprivileged user for testing
adduser testuser

rpm -q ostree{,-devel,-grub2}
export LSAN_OPTIONS=verbosity=1:log_threads=1
build --enable-installed-tests --enable-gtk-doc
65 changes: 41 additions & 24 deletions ci/libbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,68 @@

pkg_upgrade() {
# https://bugzilla.redhat.com/show_bug.cgi?id=1483553
if ! yum -y upgrade 2>err.txt; then
ecode=$?
if grep -q -F -e "BDB1539 Build signature doesn't match environment" err.txt; then
rpm --rebuilddb
yum -y upgrade
else
ecode=0
yum -y distro-sync 2>err.txt || ecode=$?
if test ${ecode} '!=' 0 && grep -q -F -e "BDB1539 Build signature doesn't match environment" err.txt; then
rpm --rebuilddb
yum -y distro-sync
else
if test ${ecode} '!=' 0; then
cat err.txt
exit ${ecode}
fi
fi
}

pkg_install() {
yum -y install "$@"
}

make() {
/usr/bin/make -j $(getconf _NPROCESSORS_ONLN) "$@"
}

build() {
env NOCONFIGURE=1 ./autogen.sh
./configure --prefix=/usr --libdir=/usr/lib64 "$@"
make
make V=1
}

build_default() {
export CFLAGS="${CFLAGS:-} -fsanitize=undefined"
build
pkg_install() {
yum -y install "$@"
}

install_builddeps() {
pkg=$1
pkg_install_if_os() {
os=$1
shift
(. /etc/os-release;
if test "${os}" = "${ID}"; then
pkg_install "$@"
else
echo "Skipping installation on OS ${ID}: $@"
fi
)
}

if [ -x /usr/bin/dnf ]; then
dnf -y install dnf-plugins-core
dnf install -y @buildsys-build
dnf install -y 'dnf-command(builddep)'
dnf builddep -y $pkg
pkg_builddep() {
# This is sadly the only case where it's a different command
if test -x /usr/bin/dnf; then
dnf builddep -y "$@"
else
yum install -y make rpm-build
yum-builddep -y rpm-ostree
yum-builddep -y "$@"
fi
}

pkg_install_builddeps() {
pkg=$1
if test -x /usr/bin/dnf; then
yum -y install dnf-plugins-core
yum install -y 'dnf-command(builddep)'
# Base buildroot
pkg_install @buildsys-build
else
yum -y install yum-utils
# Base buildroot, copied from the mock config sadly
yum -y install bash bzip2 coreutils cpio diffutils system-release findutils gawk gcc gcc-c++ grep gzip info make patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which xz
fi
# builddeps+runtime deps
yum install -y $pkg
pkg_builddep $pkg
pkg_install $pkg
rpm -e $pkg
}
29 changes: 17 additions & 12 deletions tests/check/test-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,22 +202,26 @@ fi
assert_file_has_content err.txt 'Unknown.*command'
echo "ok error on unknown command"

cat >test-rpmostree-gi-arch <<EOF
if ! skip_one_with_asan; then
cat >test-rpmostree-gi-arch <<EOF
#!/usr/bin/python2
import gi
gi.require_version("RpmOstree", "1.0")
from gi.repository import RpmOstree
assert RpmOstree.get_basearch() == 'x86_64'
assert RpmOstree.varsubst_basearch('http://example.com/foo/\${basearch}/bar') == 'http://example.com/foo/x86_64/bar'
EOF
chmod a+x test-rpmostree-gi-arch
case $(arch) in
x86_64) ./test-rpmostree-gi-arch;;
*) echo "Skipping RPM architecture test on $(arch)"
esac
echo "ok rpmostree arch"

cat >test-rpmostree-gi <<EOF
chmod a+x test-rpmostree-gi-arch
case $(arch) in
x86_64) ./test-rpmostree-gi-arch
echo "ok rpmostree arch"
;;
*) echo "ok # SKIP Skipping RPM architecture test on $(arch)"
esac
fi

if ! skip_one_with_asan; then
cat >test-rpmostree-gi <<EOF
#!/usr/bin/python2
import gi
gi.require_version("RpmOstree", "1.0")
Expand All @@ -226,6 +230,7 @@ assert RpmOstree.check_version(2017, 6)
# If this fails for you, please come back in a time machine and say hi
assert not RpmOstree.check_version(3000, 1)
EOF
chmod a+x test-rpmostree-gi
./test-rpmostree-gi
echo "ok rpmostree version"
chmod a+x test-rpmostree-gi
./test-rpmostree-gi
echo "ok rpmostree version"
fi
13 changes: 13 additions & 0 deletions tests/common/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,19 @@ ensure_dbus ()
fi
}

# https://github.com/ostreedev/ostree/commit/47b4dd1b38e422254afa67756873957c25aeab6d
# Unfortunately, introspection uses dlopen(), which doesn't quite
# work when the DSO is compiled with ASAN but the outer executable
# isn't.
skip_one_with_asan () {
if test -n "${BUILDOPT_ASAN:-}"; then
echo "ok # SKIP - built with ASAN"
return 0
else
return 1
fi
}

assert_status_file_jq() {
status_file=$1; shift
for expression in "$@"; do
Expand Down