diff --git a/tests/graphics.c b/tests/graphics.c index f7d2f7aee7573233e34b47c51ab0cd3727ea8935..4155cc33887bf58748aad1d993416be9bc381550 100644 --- a/tests/graphics.c +++ b/tests/graphics.c @@ -775,6 +775,9 @@ test_mixed_vulkan (Fixture *f, "exit-status", &exit_status, "terminating-signal", &terminating_signal, NULL); + g_assert_cmpstr (srt_graphics_get_messages (graphics), ==, + "failed to create window surface!\n"); + g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_CANNOT_DRAW); g_assert_cmpstr (tuple, ==, "mock-mixed"); g_assert_cmpstr (renderer, ==, SRT_TEST_GOOD_GRAPHICS_RENDERER); @@ -826,6 +829,11 @@ test_mixed_gl (Fixture *f, g_assert_cmpstr (tuple, ==, "mock-mixed"); g_assert_cmpstr (renderer, ==, SRT_TEST_GOOD_GRAPHICS_RENDERER); g_assert_cmpstr (version, ==, SRT_TEST_GOOD_GRAPHICS_VERSION); + g_assert_cmpstr (srt_graphics_get_messages (graphics), ==, + "warning: this warning should always be logged\n" + "Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: XOpenDisplay failed\n" + "info: you used LIBGL_DEBUG=verbose\n"); + g_free (tuple); g_free (renderer); g_free (version); diff --git a/tests/meson.build b/tests/meson.build index 56bf780079f038b450cec8b9d49bec2fab26b1cd..b774e5b74e3869e39545278e9c5943f203649dab 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -209,7 +209,6 @@ executable( foreach helper : [ 'mock-bad-check-gl', 'mock-mixed-check-vulkan', - 'mock-mixed-check-gl', ] executable( helper, @@ -230,6 +229,7 @@ foreach helper : [ 'mock-fedora-64-bit-inspect-library', 'mock-fedora-32-bit-inspect-library', 'mock-good-wflinfo', + 'mock-mixed-check-gl', 'mock-software-wflinfo', ] executable( diff --git a/tests/mock-mixed-check-gl.c b/tests/mock-mixed-check-gl.c new file mode 100644 index 0000000000000000000000000000000000000000..c7caa5e6e6b7d98457a4f7e99f9a475542761874 --- /dev/null +++ b/tests/mock-mixed-check-gl.c @@ -0,0 +1,45 @@ +/* + * Copyright © 2019 Collabora Ltd. + * + * SPDX-License-Identifier: MIT + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include <glib.h> +#include <stdio.h> + +int +main (int argc, + char **argv) +{ + // Give bad output + fprintf (stderr, "warning: this warning should always be logged\n"); + + fprintf (stderr, "Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: XOpenDisplay failed\n"); + + if (g_strcmp0 (g_getenv ("LIBGL_DEBUG"), "verbose") == 0) + { + fprintf (stderr, "info: you used LIBGL_DEBUG=verbose\n"); + } + + return 1; +} +