tests: Disable ASAN leak checks

Right now we're far from leak free, and I want to use ASAN
as a sanity checker, not a leak checker.

Closes: #576
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-01-17 13:29:48 -05:00 committed by Atomic Bot
parent c6f3c43295
commit 59f34e8a03
10 changed files with 46 additions and 22 deletions

View File

@ -89,8 +89,13 @@ dbusconfdir = ${sysconfdir}/dbus-1/system.d
systemdunit_in_files = $(srcdir)/src/daemon/rpm-ostreed.service.in
systemdunit_DATA = $(systemdunit_in_files:.service.in=.service)
systemdunitdir = $(prefix)/lib/systemd/system/
$(systemdunit_DATA):
$(SED_SUBST) $@.in > $@
if BUILDOPT_ASAN
daemon_asan_options = -e s,@SYSTEMD_ENVIRON\@,Environment=ASAN_OPTIONS=detect_leaks=false,
else
daemon_asan_options = -e /@SYSTEMD_ENVIRON\@/d
endif
$(systemdunit_DATA): Makefile
$(SED_SUBST) $(daemon_asan_options) $@.in > $@
install-daemon-altname-hook:
mv $(DESTDIR)$(libexecdir)/rpm-ostreed $(DESTDIR)$(libexecdir)/$(primaryname)d

View File

@ -15,6 +15,9 @@ AM_TESTS_ENVIRONMENT = \
AM_TESTS_ENVIRONMENT += \
LD_LIBRARY_PATH=$(abs_builddir)/libdnf-build/libdnf \
$(NULL)
if BUILDOPT_ASAN
AM_TESTS_ENVIRONMENT += ASAN_OPTIONS=detect_leaks=false
endif
CLEANFILES += \
tests/common/compose/yum/repo \

View File

@ -48,6 +48,15 @@ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\
])
AC_SUBST(WARN_CFLAGS)
AC_MSG_CHECKING([for -fsanitize=address in CFLAGS])
if echo $CFLAGS | grep -q -e -fsanitize=address; then
AC_MSG_RESULT([yes])
using_asan=yes
else
AC_MSG_RESULT([no])
fi
AM_CONDITIONAL(BUILDOPT_ASAN, [test x$using_asan = xyes])
# Initialize libtool
LT_PREREQ([2.2.4])
LT_INIT([disable-static])

View File

@ -5,4 +5,5 @@ ConditionPathExists=/ostree
[Service]
Type=dbus
BusName=org.projectatomic.rpmostree1
@SYSTEMD_ENVIRON@
ExecStart=@libexecdir@/@primaryname@d

View File

@ -51,6 +51,12 @@ vm_cmd() {
$SSH "$@"
}
# run rpm-ostree in vm
# - $@ args
vm_rpmostree() {
$SSH env ASAN_OPTIONS=detect_leaks=false rpm-ostree "$@"
}
# copy files to a directory in the vm
# - $1 target directory
# - $2.. files & dirs to copy
@ -135,7 +141,7 @@ vm_has_packages() {
# - $1 key to retrieve
vm_get_booted_deployment_info() {
key=$1
vm_cmd rpm-ostree status --json | \
vm_rpmostree status --json | \
python -c "
import sys, json
deployments = json.load(sys.stdin)[\"deployments\"]

View File

@ -40,7 +40,7 @@ if vm_cmd "runuser -u bin rpm-ostree pkg-add foo-1.0"; then
assert_not_reached "Was able to install a package as non-root!"
fi
vm_cmd rpm-ostree pkg-add foo-1.0
vm_rpmostree pkg-add foo-1.0
echo "ok pkg-add foo"
vm_reboot
@ -53,7 +53,7 @@ if ! vm_cmd /usr/bin/foo | grep "Happy foobing!"; then
fi
echo "ok correct output"
vm_cmd rpm-ostree pkg-remove foo-1.0
vm_rpmostree pkg-remove foo-1.0
echo "ok pkg-remove foo"
vm_reboot

View File

@ -31,7 +31,7 @@ vm_send_test_repo
# make sure the package is not already layered
vm_assert_layered_pkg nonrootcap absent
vm_cmd rpm-ostree install nonrootcap
vm_rpmostree install nonrootcap
echo "ok install nonrootcap"
vm_reboot

View File

@ -35,7 +35,7 @@ vm_send_test_repo
# make sure the package is not already layered
vm_assert_layered_pkg foo absent
vm_cmd rpm-ostree pkg-add foo
vm_rpmostree pkg-add foo
echo "ok pkg-add foo"
vm_reboot
@ -55,7 +55,7 @@ reboot_and_assert_base() {
# let's synthesize an upgrade
commit=$(vm_cmd ostree commit -b vmcheck --tree=ref=vmcheck)
vm_cmd rpm-ostree upgrade
vm_rpmostree upgrade
reboot_and_assert_base $commit
echo "ok upgrade"
@ -66,7 +66,7 @@ echo "ok pkg foo relayered on upgrade"
commit=$(vm_cmd ostree commit -b vmcheck \
--tree=ref=vmcheck --add-metadata-string=version=my-commit)
vm_cmd rpm-ostree deploy my-commit
vm_rpmostree deploy my-commit
reboot_and_assert_base $commit
echo "ok deploy"
@ -76,7 +76,7 @@ echo "ok pkg foo relayered on deploy"
# REBASE
commit=$(vm_cmd ostree commit -b rebase_test --tree=ref=vmcheck)
vm_cmd rpm-ostree rebase rebase_test
vm_rpmostree rebase rebase_test
reboot_and_assert_base $commit
echo "ok rebase"

View File

@ -39,7 +39,7 @@ vm_send_test_repo
# make sure the package is not already layered
vm_assert_layered_pkg foo absent
vm_cmd rpm-ostree pkg-add foo
vm_rpmostree pkg-add foo
echo "ok pkg-add foo"
vm_reboot
@ -52,7 +52,7 @@ echo "ok pkg foo added"
csum=$(vm_cmd ostree commit -b vmcheck --tree=ref=$(vm_get_booted_csum))
# check that upgrading to it will elide the layered pkg from the origin
vm_cmd rpm-ostree upgrade | tee out.txt
vm_rpmostree upgrade | tee out.txt
assert_file_has_content out.txt "'foo' .* will no longer be layered"
echo "ok layered pkg foo elision msg"
@ -69,46 +69,46 @@ elif vm_has_layered_packages foo; then
fi
echo "ok layered pkg foo elision"
if vm_cmd rpm-ostree pkg-add foo; then
if vm_rpmostree pkg-add foo; then
assert_not_reached "pkg-add foo succeeded even though it's already in rpmdb"
fi
echo "ok can't layer pkg already in base"
if vm_cmd rpm-ostree pkg-add bar; then
if vm_rpmostree pkg-add bar; then
assert_not_reached "pkg-add bar succeeded but it conflicts with foo in base"
fi
echo "ok can't layer conflicting pkg in base"
# let's go back to that first depl in which foo is really layered
vm_cmd rpm-ostree rollback
vm_rpmostree rollback
vm_reboot
vm_assert_layered_pkg foo present
if vm_cmd rpm-ostree pkg-add foo; then
if vm_rpmostree pkg-add foo; then
assert_not_reached "pkg-add foo succeeded even though it's already layered"
fi
echo "ok can't layer pkg already layered"
if vm_cmd rpm-ostree pkg-add bar; then
if vm_rpmostree pkg-add bar; then
assert_not_reached "pkg-add bar succeeded but it conflicts with layered foo"
fi
echo "ok can't layer conflicting pkg already layered"
# let's go back to the original depl without anything
# XXX: this would be simpler if we had an --onto here
vm_cmd rpm-ostree pkg-remove foo
vm_rpmostree pkg-remove foo
vm_reboot
vm_assert_layered_pkg foo absent
echo "ok pkg-remove foo"
vm_cmd rpm-ostree pkg-add bar
vm_rpmostree pkg-add bar
vm_reboot
vm_assert_layered_pkg bar present
echo "ok pkg-add bar"
# now let's try to do an upgrade -- the latest commit there is still the one we
# created at the beginning of this test, containing foo in the base
if vm_cmd rpm-ostree upgrade; then
if vm_rpmostree upgrade; then
assert_not_reached "upgrade succeeded but new base has conflicting pkg foo"
fi
echo "ok can't upgrade with conflicting layered pkg"

View File

@ -31,7 +31,7 @@ vm_send_test_repo
# make sure the package is not already layered
vm_assert_layered_pkg scriptpkg1 absent
vm_cmd rpm-ostree pkg-add scriptpkg1
vm_rpmostree pkg-add scriptpkg1
echo "ok pkg-add scriptpkg1"
vm_reboot
@ -44,6 +44,6 @@ vm_cmd getent group scriptpkg1
echo "ok group scriptpkg1 active"
# And now, things that should fail
if vm_cmd rpm-ostree install test-post-rofiles-violation; then
if vm_rpmostree install test-post-rofiles-violation; then
assert_not_reached "installed test-post-rofiles-violation!"
fi