[PATCH] opencl/tests: Add initial tests
Detlef Riekenberg
wine.dev at web.de
Tue Mar 8 06:14:59 CST 2016
--
Bye bye .. Detlef
Signed-off-by: Detlef Riekenberg <wine.dev at web.de>
---
dlls/opencl/Makefile.in | 1 +
dlls/opencl/tests/Makefile.in | 4 +++
dlls/opencl/tests/opencl.c | 63 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 68 insertions(+)
create mode 100644 dlls/opencl/tests/Makefile.in
create mode 100644 dlls/opencl/tests/opencl.c
diff --git a/dlls/opencl/Makefile.in b/dlls/opencl/Makefile.in
index 1f6e76c..04c9504 100644
--- a/dlls/opencl/Makefile.in
+++ b/dlls/opencl/Makefile.in
@@ -1,4 +1,5 @@
MODULE = opencl.dll
+IMPORTLIB = opencl
EXTRALIBS = $(OPENCL_LIBS)
C_SRCS = \
diff --git a/dlls/opencl/tests/Makefile.in b/dlls/opencl/tests/Makefile.in
new file mode 100644
index 0000000..416c516
--- /dev/null
+++ b/dlls/opencl/tests/Makefile.in
@@ -0,0 +1,4 @@
+TESTDLL = opencl.dll
+IMPORTS = opencl
+
+C_SRCS = opencl.c
diff --git a/dlls/opencl/tests/opencl.c b/dlls/opencl/tests/opencl.c
new file mode 100644
index 0000000..cabd94b
--- /dev/null
+++ b/dlls/opencl/tests/opencl.c
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2013 Detlef Riekenberg
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <stdarg.h>
+#include <stdio.h>
+
+#include <windef.h>
+#include <winbase.h>
+
+#include <wine/test.h>
+
+INT WINAPI clGetPlatformIDs(UINT, PVOID*, UINT*);
+
+static void test_GetPlatformIDs(void)
+{
+ PVOID platform[16];
+
+ UINT num_entries = 0xdeafbeef;
+ INT res;
+
+ /* Only the last parameter is needed, when asking for the number of platforms */
+ res = clGetPlatformIDs(0, NULL, &num_entries);
+ ok(!res && num_entries > 0, "got %d and %d (expected 0 and >0)\n", res, num_entries);
+
+ res = clGetPlatformIDs(sizeof(platform)/sizeof(platform[0]), platform, &num_entries);
+ ok(!res && num_entries > 0, "got %d and %d (expected 0 and >0)\n", res, num_entries);
+
+ /* the last parameter is optional */
+ res = clGetPlatformIDs(sizeof(platform)/sizeof(platform[0]), platform, NULL);
+ ok(!res, "got %d (expected 0)\n", res);
+}
+
+START_TEST(opencl)
+{
+ UINT num_entries = 0;
+ INT res;
+
+ res = clGetPlatformIDs(0, NULL, &num_entries);
+
+ if (res || !num_entries)
+ {
+ skip("No opencl platform installed on this system (got %d and %d)\n", res, num_entries);
+ return;
+ }
+
+ trace("got %d, num entries: %d\n", res, num_entries);
+ test_GetPlatformIDs();
+}
--
2.5.0
More information about the wine-patches
mailing list