Merge branch 'meson-use-tap-protocol-improvements' into 'main'

TAP: some further cleanups

See merge request GNOME/glib!3221
This commit is contained in:
Philip Withnall 2023-01-20 15:24:50 +00:00
commit e86e559a0f
5 changed files with 34 additions and 21 deletions

View File

@ -4,13 +4,13 @@ set -ex
./.gitlab-ci/check-missing-install-tag.py _build ./.gitlab-ci/check-missing-install-tag.py _build
meson test \ meson test -v \
-C _build \ -C _build \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \ --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
"$@" "$@"
# Run only the flaky tests, so we can log the failures but without hard failing # Run only the flaky tests, so we can log the failures but without hard failing
meson test \ meson test -v \
-C _build \ -C _build \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \ --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
"$@" --setup=unstable_tests --suite=failing --suite=flaky || true "$@" --setup=unstable_tests --suite=failing --suite=flaky || true

View File

@ -17,8 +17,8 @@ meson %args% _build || goto :error
python .gitlab-ci/check-missing-install-tag.py _build || goto :error python .gitlab-ci/check-missing-install-tag.py _build || goto :error
ninja -C _build || goto :error ninja -C _build || goto :error
meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% || goto :error meson test -v -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% || goto :error
meson test -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --setup=unstable_tests --suite=failing --suite=flaky meson test -v -C _build --timeout-multiplier %MESON_TEST_TIMEOUT_MULTIPLIER% --setup=unstable_tests --suite=failing --suite=flaky
:: Workaround meson issue https://github.com/mesonbuild/meson/issues/9894 :: Workaround meson issue https://github.com/mesonbuild/meson/issues/9894
python -c "n = '_build/meson-logs/testlog.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)" || goto :error python -c "n = '_build/meson-logs/testlog.junit.xml'; c = open(n, 'rb').read().replace(b'\x1b', b''); open(n, 'wb').write(c)" || goto :error

View File

@ -54,8 +54,8 @@ if [[ "$CFLAGS" == *"-coverage"* ]]; then
--output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov" --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov"
fi fi
meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" meson test -v --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}"
meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \ meson test -v --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--setup=unstable_tests --suite=failing --suite=flaky || true --setup=unstable_tests --suite=failing --suite=flaky || true
if [[ "$CFLAGS" == *"-coverage"* ]]; then if [[ "$CFLAGS" == *"-coverage"* ]]; then

View File

@ -58,6 +58,7 @@
#include "glib-private.h" #include "glib-private.h"
#include "gutilsprivate.h" #include "gutilsprivate.h"
#define TAP_VERSION G_STRINGIFY (13)
/* FIXME: Remove '#' prefix when we'll depend on a meson version supporting TAP 14 /* FIXME: Remove '#' prefix when we'll depend on a meson version supporting TAP 14
* See https://gitlab.gnome.org/GNOME/glib/-/issues/2885 */ * See https://gitlab.gnome.org/GNOME/glib/-/issues/2885 */
#define TAP_SUBTEST_PREFIX "# " /* a 4-space indented line */ #define TAP_SUBTEST_PREFIX "# " /* a 4-space indented line */
@ -1100,7 +1101,7 @@ g_test_log (GTestLogType lbit,
{ {
if (!is_subtest ()) if (!is_subtest ())
{ {
g_test_tap_print (0, FALSE, "TAP version 13\n"); g_test_tap_print (0, FALSE, "TAP version " TAP_VERSION "\n");
} }
else else
{ {
@ -1218,15 +1219,25 @@ g_test_log (GTestLogType lbit,
while ((line = strchr (line, '\n'))) while ((line = strchr (line, '\n')))
*(line++) = ' '; *(line++) = ' ';
if (is_subtest ()) if (message)
message = g_strstrip (message);
if (test_run_name && *test_run_name != '\0')
{ {
g_test_tap_print (subtest_level, FALSE, "Bail out! %s\n", message); if (message && *message != '\0')
g_test_tap_print (0, FALSE, "Bail out!\n"); g_test_tap_print (subtest_level, FALSE, "not ok %s - %s\n",
test_run_name, message);
else
g_test_tap_print (subtest_level, FALSE, "not ok %s\n",
test_run_name);
g_clear_pointer (&message, g_free);
} }
if (message && *message != '\0')
g_test_tap_print (subtest_level, FALSE, "Bail out! %s\n", message);
else else
{ g_test_tap_print (subtest_level, FALSE, "Bail out!\n");
g_test_tap_print (0, FALSE, "Bail out! %s\n", message);
}
g_free (message); g_free (message);
} }

View File

@ -2676,8 +2676,9 @@ test_tap_error (void)
g_assert_nonnull (interesting_lines); g_assert_nonnull (interesting_lines);
interesting_lines += strlen (expected_tap_header); interesting_lines += strlen (expected_tap_header);
g_assert_cmpstr (interesting_lines, ==, "Bail out! GLib-FATAL-ERROR: This should error out " g_assert_cmpstr (interesting_lines, ==, "not ok /error - GLib-FATAL-ERROR: This should error out "
"Because it's just wrong!\n"); "Because it's just wrong!\n"
"Bail out!\n");
g_free (output); g_free (output);
g_strfreev (envp); g_strfreev (envp);
@ -2721,9 +2722,9 @@ test_tap_subtest_error (void)
interesting_lines += strlen (expected_tap_header); interesting_lines += strlen (expected_tap_header);
g_assert_cmpstr (interesting_lines, ==, g_assert_cmpstr (interesting_lines, ==,
TAP_SUBTEST_PREFIX "Bail out! GLib-FATAL-ERROR: This should error out " TAP_SUBTEST_PREFIX "not ok /error - GLib-FATAL-ERROR: This should error out "
"Because it's just wrong!\n" "Because it's just wrong!\n"
"Bail out!\n"); TAP_SUBTEST_PREFIX "Bail out!\n");
g_free (output); g_free (output);
g_ptr_array_unref (argv); g_ptr_array_unref (argv);
@ -2769,8 +2770,9 @@ test_tap_error_and_pass (void)
g_assert_nonnull (interesting_lines); g_assert_nonnull (interesting_lines);
interesting_lines += strlen (expected_tap_header); interesting_lines += strlen (expected_tap_header);
g_assert_cmpstr (interesting_lines, ==, "Bail out! GLib-FATAL-ERROR: This should error out " g_assert_cmpstr (interesting_lines, ==, "not ok /error - GLib-FATAL-ERROR: This should error out "
"Because it's just wrong!\n"); "Because it's just wrong!\n"
"Bail out!\n");
g_free (output); g_free (output);
g_strfreev (envp); g_strfreev (envp);
@ -2814,9 +2816,9 @@ test_tap_subtest_error_and_pass (void)
interesting_lines += strlen (expected_tap_header); interesting_lines += strlen (expected_tap_header);
g_assert_cmpstr (interesting_lines, ==, g_assert_cmpstr (interesting_lines, ==,
TAP_SUBTEST_PREFIX "Bail out! GLib-FATAL-ERROR: This should error out " TAP_SUBTEST_PREFIX "not ok /error - GLib-FATAL-ERROR: This should error out "
"Because it's just wrong!\n" "Because it's just wrong!\n"
"Bail out!\n"); TAP_SUBTEST_PREFIX "Bail out!\n");
g_free (output); g_free (output);
g_ptr_array_unref (argv); g_ptr_array_unref (argv);