diff --git a/tests/meson.build b/tests/meson.build index 5e5f11f2e056c8baa2687c21b0adb043fce6f699..a8deb031cfd550ba271500b5618da4beaf2e0140 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -93,4 +93,25 @@ foreach test_name : tests endif 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: diff --git a/tests/mock-bad-wflinfo.c b/tests/mock-bad-wflinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..2311ddb839299f78c4b8e9421152b2b03e0a5067 --- /dev/null +++ b/tests/mock-bad-wflinfo.c @@ -0,0 +1,36 @@ +/* + * 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; +} + diff --git a/tests/mock-good-wflinfo.c b/tests/mock-good-wflinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..9be7fabd8920db4c393caecde5c96cb43b0daa93 --- /dev/null +++ b/tests/mock-good-wflinfo.c @@ -0,0 +1,41 @@ +/* + * 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; +} + diff --git a/tests/mock-software-wflinfo.c b/tests/mock-software-wflinfo.c new file mode 100644 index 0000000000000000000000000000000000000000..7814889e0658dcfb7950fecefbbf7c04a24ffd8b --- /dev/null +++ b/tests/mock-software-wflinfo.c @@ -0,0 +1,39 @@ +/* + * 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; +} +