Skip to content
Snippets Groups Projects
Commit 61a4f43f authored by Guido Gunther's avatar Guido Gunther :zzz:
Browse files

Merge branch 'valgrind' into 'master'

Use valgrind in CI

See merge request Librem5/phosh!80
parents 6ba7807c 48a039ea
No related branches found
No related tags found
No related merge requests found
variables:
DEPS: build-essential git libwlroots-examples wget gnome-session
gdb weston
gdb weston valgrind
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get -y update
- apt-get -y install wget gnupg
- apt-get -y install wget gnupg eatmydata
- echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
- apt-get -y update
- apt-get -y build-dep .
- apt-get -y install $DEPS
- eatmydata apt-get -y update
- eatmydata apt-get -y build-dep .
- eatmydata apt-get -y install $DEPS
- ulimit -c unlimited
.tags: &tags
......@@ -42,9 +42,13 @@ test:smoke:one-output:
dependencies:
- build:native
script:
- export OUTDIR=output
- export G_DEBUG=fatal-criticals
- export WLR_X11_OUTPUTS=1
- tests/smoke
artifacts:
paths:
- output/*.log
test:smoke:two-outputs:
<<: *tags
......@@ -52,7 +56,26 @@ test:smoke:two-outputs:
dependencies:
- build:native
script:
- export OUTDIR=output
- export G_DEBUG=fatal-criticals
- export WLR_X11_OUTPUTS=2
- tests/smoke
artifacts:
paths:
- output/*.log
test:smoke:valgrind:
<<: *tags
stage: test
dependencies:
- build:native
script:
- export OUTDIR=output
- export G_DEBUG=fatal-criticals
- export WLR_X11_OUTPUTS=1
- tests/smoke -V -T 30
artifacts:
paths:
- vgdump
- output/*.log
# Fontconfig
{
css_fontconfig_FcPatternCreate
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:FcPatternCreate
...
fun:XML_ParseBuffer
...
fun:gtk_label_get_preferred_layout_size
fun:gtk_label_get_preferred_size
fun:gtk_label_measure
fun:gtk_css_custom_gadget_get_preferred_size
fun:gtk_css_gadget_get_preferred_size
...
}
{
css_fontconfig_FcFontRenderPrepare
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
...
fun:FcFontRenderPrepare
fun:FcFontMatch
...
fun:gtk_css_custom_gadget_get_preferred_size
fun:gtk_css_gadget_get_preferred_size
...
}
{
fontconfig_malloc
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/lib/*/libfontconfig.so.*
...
}
{
fontconfig_realloc
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/*/libfontconfig.so.*
...
}
......@@ -62,6 +62,7 @@ add_project_arguments(
run_data = configuration_data()
run_data.set('ABS_BUILDDIR', meson.current_build_dir())
run_data.set('ABS_SRCDIR', meson.current_source_dir())
configure_file(
input: 'run.in',
output: 'run',
......
#!/bin/sh
set -e
EXEC="${EXEC:-exec}"
ABS_BUILDDIR='@ABS_BUILDDIR@'
ABS_SRCDIR='@ABS_SRCDIR@'
if [ "${PHOSH_VALGRIND}" = 1 ]; then
echo "Running phosh under valgrind"
EXEC="valgrind --tool=memcheck --leak-check=full --leak-resolution=high --num-callers=20 --log-file=vgdump"
WRAPPER="valgrind -v \
--tool=memcheck \
--leak-check=full \
--leak-resolution=high \
--num-callers=30 \
--log-file=vgdump \
--suppressions=${ABS_SRCDIR}/data/valgrind.suppressions \
"
fi
ABS_BUILDDIR='@ABS_BUILDDIR@'
# Start up g-s-d, etc.
gnome-session --session=gnome-dummy --disable-acceleration-check &
export GSETTINGS_SCHEMA_DIR="${ABS_BUILDDIR}/data"
export G_MESSAGES_DEBUG=all
set -x
${EXEC} "${ABS_BUILDDIR}/src/phosh" $@
exec ${WRAPPER} "${ABS_BUILDDIR}/src/phosh" $@
......@@ -2,24 +2,60 @@
RET=1
set -x
set -e
WORKDIR=$(mktemp -d)
PHOSH_LOG="${WORKDIR}/phosh.log"
WLROOTS_LOG="${WORKDIR}/rootston.log"
[ -n "${OUTDIR}" ] || OUTDIR="${WORKDIR}"
PHOSH_LOG="${OUTDIR}/phosh.log"
WLROOTS_LOG="${OUTDIR}/rootston.log"
ROOTSTON_CONFIG="${WORKDIR}/rootston.ini"
VGDUMP="./vgdump"
TIMEOUT=5
function cleanup () {
[ ! -f core ] || echo bt | gdb -c core _build/src/phosh
[ "${RET}" -eq 0 ] || cat ${WLROOTS_LOG} || true
[ "${RET}" -eq 0 ] || cat ${PHOSH_LOG} || true
[ -z "${XVFB_PID}" ] || kill -9 "${XVFB_PID}" || true
[ -z "${PHOSH_PID}" ] || kill -9 "${PHOSH_PID}" >& /dev/null || true
[ -z "${WORKDIR}" ] || rm -rf "${WORKDIR}"
[ ! -f core ] || echo bt | gdb -c core _build/src/phosh | tee >& ${OUTDIR}/backtrace.log
[ ! -f "${WLROOTS_LOG}" ] || cat "${WLROOTS_LOG}" || true
[ ! -f "${PHOSH_LOG}" ] || cat "${PHOSH_LOG}" || true
[ -z "${XVFB_PID}" ] || kill -9 "${XVFB_PID}" >& /dev/null || true
[ -z "${PHOSH_PID}" ] || kill -9 "${PHOSH_PID}" >& /dev/null || true
[ -z "${WORKDIR}" ] || rm -rf "${WORKDIR}"
}
trap cleanup EXIT
function usage () {
cat <<EOF
Usage: $0
-h - Display this help message."
-T <seconds> - how long should phosh run (default $TIMEOUT seconds
-V - run under valgrind
EOF
}
while getopts "hT:V" opt; do
case ${opt} in
T)
TIMEOUT=$OPTARG
;;
V)
export PHOSH_VALGRIND=1
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
usage "$0"
RET=1
exit 0
;;
h)
usage "$0"
RET=0
exit 0
;;
esac
done
[ -z "${OUTDIR}" ] || mkdir -p "${OUTDIR}"
cat <<EOF > "${ROOTSTON_CONFIG}"
[output:X11-1]
mode = 768x1024
......@@ -28,6 +64,9 @@ mode = 768x1024
mode = 1280x800
EOF
# Provide output for the interesting parts
set -x
XVFB_OPTS="-screen 0 768x1024x24 -ac +extension GLX +render -noreset"
export WLR_BACKENDS=x11
export XDG_RUNTIME_DIR="${WORKDIR}"
......@@ -54,7 +93,7 @@ _build/run >& "${PHOSH_LOG}" &
PHOSH_PID=$!
echo "Phosh's PID is $PHOSH_PID"
sleep 1 # give it some time to start
sleep "${TIMEOUT}" # give it some time to start
echo -n "Checking if phosh is alive..."
kill -0 $PHOSH_PID
......@@ -62,24 +101,30 @@ echo "yes."
kill -15 $PHOSH_PID
echo -n "Checking if phosh shutted down..."
sleep 1
sleep "${TIMEOUT}"
! kill -0 $PHOSH_PID >&/dev/null
echo "yes."
if grep "WARNING" "${PHOSH_LOG}"; then
echo "Found error log messages"
cat ${PHOSH_LOG}
echo "Started/stopped phosh successfully"
RET=0
if grep -qs "WARNING" "${PHOSH_LOG}"; then
echo "Found warning log messages" 1>&2
# We're having warnings due to missing DBus
# services and gnome-session depending on X11
#exit 1
# services and gnome-session depending on X11.
# python-dbusmock I'm looking at you
#RET=1
fi
if grep -E "CRITICAL" "${PHOSH_LOG}"; then
echo "Found error log messages"
cat ${PHOSH_LOG}
exit 1
if grep -qs "CRITICAL" "${PHOSH_LOG}"; then
echo "Found critical log messages" 1>&2
RET=1
fi
if [ -n "${PHOSH_VALGRIND}" ] && grep -qs "definitely lost in loss record" "${VGDUMP}"; then
echo "Found memory leaks" 1>&2
cat ${VGDUMP}
RET=1
fi
echo "Started/stopped phosh successfully"
RET=0
exit $RET
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment