[PATCH] opencl/tests: Add initial tests

Detlef Riekenberg wine.dev at web.de
Sun Jul 14 22:34:51 CDT 2013


--
By by .. Detlef
---
 dlls/opencl/Makefile.in       |    1 +
 dlls/opencl/tests/Makefile.in |    6 ++++
 dlls/opencl/tests/opencl.c    |   63 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 70 insertions(+), 0 deletions(-)
 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 72f9d1c..d08cab9 100644
--- a/dlls/opencl/Makefile.in
+++ b/dlls/opencl/Makefile.in
@@ -1,4 +1,5 @@
 MODULE    = opencl.dll
+IMPORTLIB = opencl
 EXTRALIBS = @LIBOPENCL@
 
 C_SRCS = \
diff --git a/dlls/opencl/tests/Makefile.in b/dlls/opencl/tests/Makefile.in
new file mode 100644
index 0000000..dfab2c3
--- /dev/null
+++ b/dlls/opencl/tests/Makefile.in
@@ -0,0 +1,6 @@
+TESTDLL = opencl.dll
+IMPORTS = opencl
+
+C_SRCS = opencl.c
+
+ at MAKE_TEST_RULES@
diff --git a/dlls/opencl/tests/opencl.c b/dlls/opencl/tests/opencl.c
new file mode 100644
index 0000000..54c5b60
--- /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_platform(void)
+{
+    PVOID platform[16];
+
+    UINT num_entries;
+    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);
+    trace("got %d, num entries: %d\n", res, num_entries);
+
+    if (!num_entries)
+    {
+        skip("No opencl platform installed on this system (got %d)\n", res);
+        return;
+    }
+
+    test_platform();
+}
-- 
1.7.5.4




More information about the wine-patches mailing list