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

Added mock-graphics to give specified json output for testing.

In order to test SrtGraphics on CI systems that likely aren't running
X we needed a mock-graphics to return most of what wflinfo gives in
different settings.

Use mock-bad-wflinfo, mock-good-wflinfo and mock-software-wflinfo
in srt_check_graphics.

Use mock-good-wflinfo for good output, mock-bad-wflinfo for
error output and mock-software-wflinfo for software rendering
test output.
parent fdf0ee0a
Branches
Tags
1 merge request!24Add SrtGraphics wrapper to wrap graphics checker.
...@@ -93,4 +93,25 @@ foreach test_name : tests ...@@ -93,4 +93,25 @@ foreach test_name : tests
endif endif
endforeach endforeach
executable(
'mock-good-wflinfo',
'mock-good-wflinfo.c',
install: true,
install_dir : tests_dir
)
executable(
'mock-bad-wflinfo',
'mock-bad-wflinfo.c',
install: true,
install_dir : tests_dir
)
executable(
'mock-software-wflinfo',
'mock-software-wflinfo.c',
install: true,
install_dir : tests_dir
)
# vim:set sw=2 sts=2 et: # 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, "Waffle error: 0x2 WAFFLE_ERROR_UNKNOWN: XOpenDisplay 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>
void usage(void);
int
main (int argc,
char **argv)
{
// Give good output
printf ("{\n\t\"waffle\": {\n\t\t\"platform\": \"glx\",\n\t\t\"api\": \"gl\"\n\t},\n\t\"OpenGL\": {\n\t\t\"vendor string\": \"Intel Open Source Technology Center\",\n"
"\t\t\"renderer string\": \"Mesa DRI Intel(R) Haswell Desktop \",\n\t\t\"version string\": \"3.0 Mesa 19.1.3\",\n\t\t\"shading language version string\": \"1.30\",\n"
"\t\t\"extensions\": [\n"
"\t\t]\n\t}\n}\n");
return 0;
}
/*
* 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 software renderer output
printf ("{\n\t\"waffle\": {\n\t\t\"platform\": \"glx\",\n\t\t\"api\": \"gl\"\n\t\t},\n\t\"OpenGL\": {\n\t\t\"vendor string\": \"VMware, Inc.\",\n"
"\t\t\"renderer string\": \"llvmpipe (LLVM 8.0, 256 bits)\",\n\t\t\"version string\": \"3.1 Mesa 19.1.3\",\n\t\t\"shading language version string\": \"1.40\",\n"
"\t\t\"extensions\": [\n"
"\t\t]\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