tests: Skip running introspection tests if built with ASAN

This is the rpm-ostree equivalent of
<47b4dd1b38>

Unfortunately, introspection uses `dlopen(), which doesn't quite
work when the DSO is compiled with ASAN but the outer executable
isn't.

Prep for syncing PAPR config with ostree.

Closes: #1000
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-09-21 16:59:28 -04:00 committed by Atomic Bot
parent 167fd4c1dd
commit e066dc93c8
3 changed files with 30 additions and 12 deletions

View File

@ -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

View File

@ -202,7 +202,8 @@ 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")
@ -210,14 +211,17 @@ 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"
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
cat >test-rpmostree-gi <<EOF
if ! skip_one_with_asan; then
cat >test-rpmostree-gi <<EOF
#!/usr/bin/python2
import gi
gi.require_version("RpmOstree", "1.0")
@ -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

View File

@ -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