Skip to content

Commit

Permalink
tests: Skip running introspection tests if built with ASAN
Browse files Browse the repository at this point in the history
This is the rpm-ostree equivalent of
<ostreedev/ostree@47b4dd1>

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
  • Loading branch information
cgwalters authored and rh-atomic-bot committed Sep 24, 2017
1 parent 167fd4c commit e066dc9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
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
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

0 comments on commit e066dc9

Please sign in to comment.