Daniel Lehman : concrt140/tests: Add _Context::_CurrentContext tests.
Alexandre Julliard
julliard at winehq.org
Tue Nov 3 15:55:54 CST 2020
Module: wine
Branch: master
Commit: c56bddf94e737565d9165d4261960e18c07c9e2a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c56bddf94e737565d9165d4261960e18c07c9e2a
Author: Daniel Lehman <dlehman25 at gmail.com>
Date: Mon Nov 2 20:12:10 2020 -0800
concrt140/tests: Add _Context::_CurrentContext tests.
Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
configure | 1 +
configure.ac | 1 +
dlls/concrt140/tests/Makefile.in | 4 ++
dlls/concrt140/tests/concrt140.c | 79 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 85 insertions(+)
diff --git a/configure b/configure
index ac6a7985cc7..4e76dbf9d02 100755
--- a/configure
+++ b/configure
@@ -20363,6 +20363,7 @@ wine_fn_config_makefile dlls/compstui enable_compstui
wine_fn_config_makefile dlls/comsvcs enable_comsvcs
wine_fn_config_makefile dlls/comsvcs/tests enable_tests
wine_fn_config_makefile dlls/concrt140 enable_concrt140
+wine_fn_config_makefile dlls/concrt140/tests enable_tests
wine_fn_config_makefile dlls/connect enable_connect
wine_fn_config_makefile dlls/credui enable_credui
wine_fn_config_makefile dlls/credui/tests enable_tests
diff --git a/configure.ac b/configure.ac
index 2f81fd22610..06031352866 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3106,6 +3106,7 @@ WINE_CONFIG_MAKEFILE(dlls/compstui)
WINE_CONFIG_MAKEFILE(dlls/comsvcs)
WINE_CONFIG_MAKEFILE(dlls/comsvcs/tests)
WINE_CONFIG_MAKEFILE(dlls/concrt140)
+WINE_CONFIG_MAKEFILE(dlls/concrt140/tests)
WINE_CONFIG_MAKEFILE(dlls/connect)
WINE_CONFIG_MAKEFILE(dlls/credui)
WINE_CONFIG_MAKEFILE(dlls/credui/tests)
diff --git a/dlls/concrt140/tests/Makefile.in b/dlls/concrt140/tests/Makefile.in
new file mode 100644
index 00000000000..e36fc37eb86
--- /dev/null
+++ b/dlls/concrt140/tests/Makefile.in
@@ -0,0 +1,4 @@
+TESTDLL = concrt140.dll
+
+C_SRCS = \
+ concrt140.c
diff --git a/dlls/concrt140/tests/concrt140.c b/dlls/concrt140/tests/concrt140.c
new file mode 100644
index 00000000000..03e0b2850f2
--- /dev/null
+++ b/dlls/concrt140/tests/concrt140.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2020 Daniel Lehman
+ *
+ * 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 "wine/test.h"
+
+typedef void (*vtable_ptr)(void);
+
+typedef struct {
+ const vtable_ptr *vtable;
+} Context;
+
+typedef struct {
+ Context *ctx;
+} _Context;
+
+static Context* (__cdecl *p_Context_CurrentContext)(void);
+static _Context* (__cdecl *p__Context__CurrentContext)(_Context*);
+
+#define SETNOFAIL(x,y) x = (void*)GetProcAddress(module,y)
+#define SET(x,y) do { SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y); } while(0)
+
+static BOOL init(void)
+{
+ HMODULE module;
+
+ module = LoadLibraryA("concrt140.dll");
+ if (!module)
+ {
+ win_skip("concrt140.dll not installed\n");
+ return FALSE;
+ }
+
+ SET(p__Context__CurrentContext,
+ "?_CurrentContext at _Context@details at Concurrency@@SA?AV123 at XZ");
+ if(sizeof(void*) == 8) { /* 64-bit initialization */
+ SET(p_Context_CurrentContext,
+ "?CurrentContext at Context@Concurrency@@SAPEAV12 at XZ");
+ } else {
+ SET(p_Context_CurrentContext,
+ "?CurrentContext at Context@Concurrency@@SAPAV12 at XZ");
+ }
+
+ return TRUE;
+}
+
+static void test_CurrentContext(void)
+{
+ _Context _ctx, *ret;
+ Context *ctx;
+
+ ctx = p_Context_CurrentContext();
+ ok(!!ctx, "got NULL\n");
+
+ memset(&_ctx, 0xcc, sizeof(_ctx));
+ ret = p__Context__CurrentContext(&_ctx);
+ ok(_ctx.ctx == ctx, "expected %p, got %p\n", ctx, _ctx.ctx);
+ ok(ret == &_ctx, "expected %p, got %p\n", &_ctx, ret);
+}
+
+START_TEST(concrt140)
+{
+ if (!init()) return;
+ test_CurrentContext();
+}
More information about the wine-cvs
mailing list