#!/bin/sh

set -e

if [ -n "$SALSA_CI" ]; then
    # pixbuf-fail triggers oom-killer in salsa-ci
    flaky_tests_regex='^gdk-pixbuf/pixbuf-\(randomly-modified\|fail\)\.test$'
else
    flaky_tests_regex='^gdk-pixbuf/pixbuf-randomly-modified\.test$'
fi

# Deliberately word-splitting:
# shellcheck disable=SC2046
set -- $(
    gnome-desktop-testing-runner -l gdk-pixbuf/ |
    cut -f1 -d' ' |
    grep -v "$flaky_tests_regex"
)

exec gnome-desktop-testing-runner \
--report-directory="$AUTOPKGTEST_ARTIFACTS" \
--tap \
-- \
"$@"
