Skip to content
Snippets Groups Projects
Commit 2bdb0d30 authored by Jeremy Whiting's avatar Jeremy Whiting
Browse files

Use -check-gl in graphics test when testing gl.

Also added mock-mixed gl test to test scenario of wflinfo working
but check-gl failing.
parent eaa5e546
No related branches found
No related tags found
No related merge requests found
Pipeline #1971 failed
This commit is part of merge request !83. Comments created here will be created in the context of that merge request.
......@@ -561,6 +561,28 @@ _argv_for_check_vulkan (const char *helpers_path,
return argv;
}
static GPtrArray *
_argv_for_check_gl (const char *helpers_path,
SrtTestFlags test_flags,
const char *multiarch_tuple,
GError **error)
{
GPtrArray *argv;
SrtHelperFlags flags = SRT_HELPER_FLAGS_TIME_OUT;
if (test_flags & SRT_TEST_FLAGS_TIME_OUT_SOONER)
flags |= SRT_HELPER_FLAGS_TIME_OUT_SOONER;
argv = _srt_get_helper (helpers_path, multiarch_tuple, "check-gl",
flags, error);
if (argv == NULL)
return NULL;
g_ptr_array_add (argv, NULL);
return argv;
}
/**
* _srt_check_library_vendor:
* @multiarch_tuple: A multiarch tuple to check e.g. i386-linux-gnu
......@@ -763,6 +785,53 @@ _srt_check_graphics (const char *helpers_path,
if (parse_wflinfo)
{
issues |= _srt_process_wflinfo (parser, &version_string, &renderer_string);
/* Now perform *-check-gl drawing test */
g_ptr_array_unref (argv);
g_clear_pointer (&output, g_free);
argv = _argv_for_check_gl (helpers_path,
test_flags,
multiarch_tuple,
&error);
if (argv == NULL)
{
issues |= SRT_GRAPHICS_ISSUES_CANNOT_DRAW;
/* Put the error message in the 'messages' */
child_stderr2 = g_strdup (error->message);
goto out;
}
/* Now run and report exit code/messages if failure */
if (!g_spawn_sync (NULL, /* working directory */
(gchar **) argv->pdata,
my_environ, /* envp */
G_SPAWN_SEARCH_PATH, /* flags */
NULL, /* child setup */
NULL, /* user data */
&output, /* stdout */
&child_stderr2,
&exit_status,
&error))
{
g_debug ("An error occurred calling the helper: %s", error->message);
issues |= SRT_GRAPHICS_ISSUES_CANNOT_DRAW;
goto out;
}
if (exit_status != 0)
{
g_debug ("... wait status %d", exit_status);
issues |= SRT_GRAPHICS_ISSUES_CANNOT_DRAW;
// TERM signal gives us 124 from timeout man page
if (WIFEXITED (exit_status) && WEXITSTATUS (exit_status) == 124) // timeout command killed the helper
{
g_debug ("helper killed by timeout command");
issues |= SRT_GRAPHICS_ISSUES_TIMEOUT;
}
}
}
else
{
......
......@@ -697,6 +697,50 @@ test_mixed_vulkan (Fixture *f,
g_object_unref (info);
}
/*
* Test a mock system with gl driver but check-gl failure
*/
static void
test_mixed_gl (Fixture *f,
gconstpointer context)
{
SrtGraphics *graphics = NULL;
SrtGraphicsIssues issues;
gchar *tuple;
gchar *renderer;
gchar *version;
SrtSystemInfo *info = srt_system_info_new (NULL);
srt_system_info_set_helpers_path (info, f->builddir);
issues = srt_system_info_check_graphics (info,
"mock-mixed",
SRT_WINDOW_SYSTEM_GLX,
SRT_RENDERING_INTERFACE_GL,
&graphics);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_CANNOT_DRAW);
g_assert_cmpstr (srt_graphics_get_renderer_string (graphics), ==,
SRT_TEST_GOOD_GRAPHICS_RENDERER);
g_assert_cmpstr (srt_graphics_get_version_string (graphics), ==,
SRT_TEST_GOOD_GRAPHICS_VERSION);
g_object_get (graphics,
"multiarch-tuple", &tuple,
"issues", &issues,
"renderer-string", &renderer,
"version-string", &version,
NULL);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_CANNOT_DRAW);
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_free (tuple);
g_free (renderer);
g_free (version);
g_object_unref (graphics);
g_object_unref (info);
}
/*
* Assert that @icd is internally consistent.
*/
......@@ -1535,6 +1579,8 @@ main (int argc,
setup, test_software_rendering, teardown);
g_test_add ("/graphics/normalize_window_system", Fixture, NULL,
setup, test_normalize_window_system, teardown);
g_test_add ("/graphics/gl-mixed", Fixture, NULL,
setup, test_mixed_gl, teardown);
g_test_add ("/graphics/vulkan", Fixture, NULL,
setup, test_good_vulkan, teardown);
......
......@@ -177,6 +177,13 @@ executable(
install_dir: tests_dir
)
executable(
'mock-software-check-gl',
join_paths('..', 'helpers', 'true.c'),
install: true,
install_dir: tests_dir
)
executable(
'mock-good-vulkaninfo',
'mock-good-vulkaninfo.c',
......@@ -225,4 +232,32 @@ executable(
install_dir: tests_dir
)
executable(
'mock-good-check-gl',
join_paths('..', 'helpers', 'true.c'),
install: true,
install_dir: tests_dir
)
executable(
'mock-bad-check-gl',
'mock-bad-check-vulkan.c',
install: true,
install_dir: tests_dir
)
executable(
'mock-mixed-wflinfo',
'mock-good-wflinfo.c',
install: true,
install_dir: tests_dir
)
executable(
'mock-mixed-check-gl',
'mock-bad-check-vulkan.c',
install: true,
install_dir: tests_dir
)
# vim:set sw=2 sts=2 et:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment