Merge branch 'ci-catch-segfaults' into 'main'

testsuite: Use catch as testwrapper

See merge request GNOME/gtk!7406
This commit is contained in:
Matthias Clasen 2024-07-02 02:59:46 +00:00
commit 28c91bf767
3 changed files with 102 additions and 2 deletions

View File

@ -117,10 +117,11 @@ release-build:
EXTRA_MESON_FLAGS: "--buildtype=release" EXTRA_MESON_FLAGS: "--buildtype=release"
script: script:
- .gitlab-ci/show-info-linux.sh - .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH" - mkdir _install
- export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
- .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
- meson subprojects download - meson subprojects download
- meson subprojects update --reset - meson subprojects update --reset
- mkdir _install
- meson setup - meson setup
--prefix=${CI_PROJECT_DIR}/_install --prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS} ${COMMON_MESON_FLAGS}

View File

@ -0,0 +1,91 @@
#!/bin/bash
set -e
usage() {
cat <<-EOF
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
Check out and install a meson project
Options:
-Dkey=val Option to pass on to meson
--prefix Prefix to install to
--subdir Build subdirectory instead of whole project
--prepare Script to run before build
-h, --help Display this help
EOF
}
TEMP=$(getopt \
--name=$(basename $0) \
--options='D:h' \
--longoptions='prefix:' \
--longoptions='subdir:' \
--longoptions='prepare:' \
--longoptions='help' \
-- "$@")
eval set -- "$TEMP"
unset TEMP
MESON_OPTIONS=()
PREFIX=/usr
SUBDIR=.
PREPARE=:
while true; do
case "$1" in
-D)
MESON_OPTIONS+=( -D$2 )
shift 2
;;
--prefix)
PREFIX=$2
shift 2
;;
--subdir)
SUBDIR=$2
shift 2
;;
--prepare)
PREPARE=$2
shift 2
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
esac
done
if [[ $# -lt 2 ]]; then
usage
exit 1
fi
REPO_URL="$1"
COMMIT="$2"
CHECKOUT_DIR=$(mktemp --directory)
trap "rm -rf $CHECKOUT_DIR" EXIT
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
pushd "$CHECKOUT_DIR/$SUBDIR"
sh -c "$PREPARE"
meson setup --prefix "$PREFIX" _build "${MESON_OPTIONS[@]}"
meson compile -C _build
meson install -C _build
popd

View File

@ -2,6 +2,12 @@ gtk_libexecdir = join_paths(gtk_prefix, get_option('libexecdir'))
installed_test_bindir = join_paths(gtk_libexecdir, 'installed-tests', 'gtk-4.0') installed_test_bindir = join_paths(gtk_libexecdir, 'installed-tests', 'gtk-4.0')
installed_test_datadir = join_paths(gtk_datadir, 'installed-tests', 'gtk-4.0') installed_test_datadir = join_paths(gtk_datadir, 'installed-tests', 'gtk-4.0')
test_wrappers = []
catch = find_program('catch', required: false)
if catch.found()
test_wrappers += [ catch ]
endif
common_env = [ common_env = [
'GIO_USE_VOLUME_MONITOR=unix', 'GIO_USE_VOLUME_MONITOR=unix',
'GIO_USE_VFS=local', 'GIO_USE_VFS=local',
@ -56,12 +62,14 @@ foreach setup : setups
env: env + ['TEST_OUTPUT_SUBDIR=@0@'.format(name)], env: env + ['TEST_OUTPUT_SUBDIR=@0@'.format(name)],
exclude_suites: exclude_unstable + exclude, exclude_suites: exclude_unstable + exclude,
is_default: setup.get('is_default', false), is_default: setup.get('is_default', false),
exe_wrapper: test_wrappers,
) )
add_test_setup( add_test_setup(
'@0@_unstable'.format(name), '@0@_unstable'.format(name),
env: env + ['TEST_OUTPUT_SUBDIR=@0@_unstable'.format(name)], env: env + ['TEST_OUTPUT_SUBDIR=@0@_unstable'.format(name)],
exclude_suites: exclude, exclude_suites: exclude,
exe_wrapper: test_wrappers,
) )
endif endif
endforeach endforeach