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

Add mock-good-vulkaninfo and mock-bad-vulkaninfo.

Also add using vulkaninfo mock executables to graphics test.
parent 6729dc07
No related branches found
No related tags found
1 merge request!44Add calling vulkaninfo to get vulkan device and version.
Pipeline #1582 passed
......@@ -31,4 +31,6 @@
#define SRT_TEST_SOFTWARE_GRAPHICS_RENDERER "llvmpipe (LLVM 8.0, 256 bits)"
#define SRT_TEST_GOOD_GRAPHICS_VERSION "3.0 Mesa 19.1.3"
#define SRT_TEST_SOFTWARE_GRAPHICS_VERSION "3.1 Mesa 19.1.3"
#define SRT_TEST_GOOD_VULKAN_DRIVER_VERSION "79695877"
#define SRT_TEST_GOOD_VULKAN_VERSION "1.1.102 (device 8086:0412) (driver 19.1.5)"
......@@ -291,6 +291,94 @@ test_software_rendering (Fixture *f,
g_object_unref (info);
}
/*
* Test a mock system with good vulkan drivers
*/
static void
test_good_vulkan (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-good",
SRT_WINDOW_SYSTEM_X11,
SRT_RENDERING_INTERFACE_VULKAN,
&graphics);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_NONE);
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_VULKAN_VERSION);
g_object_get (graphics,
"multiarch-tuple", &tuple,
"issues", &issues,
"renderer-string", &renderer,
"version-string", &version,
NULL);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_NONE);
g_assert_cmpstr (tuple, ==, "mock-good");
g_assert_cmpstr (renderer, ==, SRT_TEST_GOOD_GRAPHICS_RENDERER);
g_assert_cmpstr (version, ==, SRT_TEST_GOOD_VULKAN_VERSION);
g_free (tuple);
g_free (renderer);
g_free (version);
g_object_unref (graphics);
g_object_unref (info);
}
/*
* Test a mock system with no vulkan graphics driver
*/
static void
test_bad_vulkan (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-bad",
SRT_WINDOW_SYSTEM_X11,
SRT_RENDERING_INTERFACE_VULKAN,
&graphics);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_CANNOT_LOAD);
g_assert_cmpstr (srt_graphics_get_renderer_string (graphics), ==,
NULL);
g_assert_cmpstr (srt_graphics_get_version_string (graphics), ==,
NULL);
g_object_get (graphics,
"multiarch-tuple", &tuple,
"issues", &issues,
"renderer-string", &renderer,
"version-string", &version,
NULL);
g_assert_cmpint (issues, ==, SRT_GRAPHICS_ISSUES_CANNOT_LOAD);
g_assert_cmpstr (tuple, ==, "mock-bad");
g_assert_cmpstr (renderer, ==, NULL);
g_assert_cmpstr (version, ==, NULL);
g_free (tuple);
g_free (renderer);
g_free (version);
g_object_unref (graphics);
g_object_unref (info);
}
int
main (int argc,
char **argv)
......@@ -309,5 +397,10 @@ main (int argc,
g_test_add ("/software", Fixture, NULL,
setup, test_software_rendering, teardown);
g_test_add ("/vulkan", Fixture, NULL,
setup, test_good_vulkan, teardown);
g_test_add ("/vulkan-bad", Fixture, NULL,
setup, test_bad_vulkan, teardown);
return g_test_run ();
}
......@@ -142,7 +142,7 @@ executable(
'mock-good-wflinfo',
'mock-good-wflinfo.c',
install: true,
install_dir : tests_dir
install_dir: tests_dir
)
executable(
......@@ -156,14 +156,29 @@ executable(
'mock-bad-wflinfo',
'mock-bad-wflinfo.c',
install: true,
install_dir : tests_dir
install_dir: tests_dir
)
executable(
'mock-software-wflinfo',
'mock-software-wflinfo.c',
install: true,
install_dir : tests_dir
install_dir: tests_dir
)
executable(
'mock-good-vulkaninfo',
'mock-good-vulkaninfo.c',
install: true,
install_dir: tests_dir
)
executable(
'mock-bad-vulkaninfo',
'mock-bad-vulkaninfo.c',
install: true,
install_dir: tests_dir
)
# vim:set sw=2 sts=2 et:
/*
* 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 <stdio.h>
int
main (int argc,
char **argv)
{
// Give bad output
fprintf (stderr, "/build/vulkan-tools/src/Vulkan-Tools-1.1.114/vulkaninfo/vulkaninfo.c:5884: failed with VK_ERROR_INITIALIZATION_FAILED\n");
return 1;
}
/*
* 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 <stdio.h>
#include "../steam-runtime-tools/graphics-test-defines.h"
int
main (int argc,
char **argv)
{
// Give good output
printf ("{\n\t\"$schema\": \"https://schema.khronos.org/vulkan/devsim_1_0_0.json#\",\n"
"\t\"comments\": {\n\t\t\"desc\": \"JSON configuration file describing GPU 0. Generated using the vulkaninfo program.\","
"\"vulkanApiVersion\": \"1.1.121\"\n\t},\n\t\"ArrayOfVkLayerProperties\": [\n\t\t{\n"
"\t\t\t\"layerName\": \"VK_LAYER_LUNARG_standard_validation\",\n"
"\t\t\t\"specVersion\": 4194425,\n"
"\t\t\t\"implementationVersion\": 1,\n"
"\t\t\t\"description\": \"LunarG Standard Validation Layer\"\n"
"\t\t},\n"
"\t\t{\n"
"\t\t\t\"layerName\": \"VK_LAYER_VALVE_steam_fossilize_32\",\n"
"\t\t\t\"specVersion\": 4198473,\n"
"\t\t\t\"implementationVersion\": 1,\n"
"\t\t\t\"description\": \"Steam Pipeline Caching Layer\"\n"
"\t\t},\n"
"\t\t{\n"
"\t\t\t\"layerName\": \"VK_LAYER_VALVE_steam_fossilize_64\",\n"
"\t\t\t\"specVersion\": 4198473,\n"
"\t\t\t\"implementationVersion\": 1,\n"
"\t\t\t\"description\": \"Steam Pipeline Caching Layer\"\n"
"\t\t},\n"
"\t\t{\n"
"\t\t\t\"layerName\": \"VK_LAYER_VALVE_steam_overlay_32\",\n"
"\t\t\t\"specVersion\": 4198473,\n"
"\t\t\t\"implementationVersion\": 1,\n"
"\t\t\t\"description\": \"Steam Overlay Layer\"\n"
"\t\t},\n"
"\t\t{\n"
"\t\t\t\"layerName\": \"VK_LAYER_VALVE_steam_overlay_64\",\n"
"\t\t\t\"specVersion\": 4198473,\n"
"\t\t\t\"implementationVersion\": 1,\n"
"\t\t\t\"description\": \"Steam Overlay Layer\"\n"
"\t\t}\n"
"\t],\n"
"\t\"VkPhysicalDeviceProperties\": {\n"
"\t\t\"apiVersion\": 4198502,\n"
"\t\t\"driverVersion\": "
SRT_TEST_GOOD_VULKAN_DRIVER_VERSION
",\n"
"\t\t\"vendorID\": 32902,\n"
"\t\t\"deviceID\": 1042,\n"
"\t\t\"deviceType\": 1,\n"
"\t\t\"deviceName\": \""
SRT_TEST_GOOD_GRAPHICS_RENDERER
"\"\n"
"\t}\n"
"}\n");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment