msvcr90/tests: Add tests for _initterm_e.
This commit is contained in:
parent
877a4e6136
commit
73e669c6bc
|
@ -14359,6 +14359,7 @@ wine_fn_config_dll msvcr70 enable_msvcr70 msvcr70
|
||||||
wine_fn_config_dll msvcr71 enable_msvcr71 msvcr71
|
wine_fn_config_dll msvcr71 enable_msvcr71 msvcr71
|
||||||
wine_fn_config_dll msvcr80 enable_msvcr80 msvcr80
|
wine_fn_config_dll msvcr80 enable_msvcr80 msvcr80
|
||||||
wine_fn_config_dll msvcr90 enable_msvcr90 msvcr90
|
wine_fn_config_dll msvcr90 enable_msvcr90 msvcr90
|
||||||
|
wine_fn_config_test dlls/msvcr90/tests msvcr90_test
|
||||||
wine_fn_config_dll msvcrt enable_msvcrt msvcrt
|
wine_fn_config_dll msvcrt enable_msvcrt msvcrt
|
||||||
wine_fn_config_test dlls/msvcrt/tests msvcrt_test
|
wine_fn_config_test dlls/msvcrt/tests msvcrt_test
|
||||||
wine_fn_config_dll msvcrt20 enable_msvcrt20 msvcrt20
|
wine_fn_config_dll msvcrt20 enable_msvcrt20 msvcrt20
|
||||||
|
|
|
@ -2401,6 +2401,7 @@ WINE_CONFIG_DLL(msvcr70,,[msvcr70])
|
||||||
WINE_CONFIG_DLL(msvcr71,,[msvcr71])
|
WINE_CONFIG_DLL(msvcr71,,[msvcr71])
|
||||||
WINE_CONFIG_DLL(msvcr80,,[msvcr80])
|
WINE_CONFIG_DLL(msvcr80,,[msvcr80])
|
||||||
WINE_CONFIG_DLL(msvcr90,,[msvcr90])
|
WINE_CONFIG_DLL(msvcr90,,[msvcr90])
|
||||||
|
WINE_CONFIG_TEST(dlls/msvcr90/tests)
|
||||||
WINE_CONFIG_DLL(msvcrt,,[msvcrt])
|
WINE_CONFIG_DLL(msvcrt,,[msvcrt])
|
||||||
WINE_CONFIG_TEST(dlls/msvcrt/tests)
|
WINE_CONFIG_TEST(dlls/msvcrt/tests)
|
||||||
WINE_CONFIG_DLL(msvcrt20,,[msvcrt20])
|
WINE_CONFIG_DLL(msvcrt20,,[msvcrt20])
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
TOPSRCDIR = @top_srcdir@
|
||||||
|
TOPOBJDIR = ../../..
|
||||||
|
SRCDIR = @srcdir@
|
||||||
|
VPATH = @srcdir@
|
||||||
|
TESTDLL = msvcr90.dll
|
||||||
|
APPMODE = -mno-cygwin
|
||||||
|
IMPORTS = kernel32
|
||||||
|
MODCFLAGS = @BUILTINFLAG@
|
||||||
|
EXTRAINCL = -I$(TOPSRCDIR)/include/msvcrt
|
||||||
|
|
||||||
|
C_SRCS = \
|
||||||
|
msvcr90.c
|
||||||
|
|
||||||
|
RC_SRCS = \
|
||||||
|
msvcr90.rc
|
||||||
|
|
||||||
|
@MAKE_TEST_RULES@
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 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 <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <windef.h>
|
||||||
|
#include <winbase.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include "wine/test.h"
|
||||||
|
|
||||||
|
typedef int (__cdecl *_INITTERM_E_FN)(void);
|
||||||
|
static int (__cdecl *p_initterm_e)(_INITTERM_E_FN *table, _INITTERM_E_FN *end);
|
||||||
|
int cb_called[4];
|
||||||
|
|
||||||
|
/* ########## */
|
||||||
|
|
||||||
|
static int initterm_cb0(void)
|
||||||
|
{
|
||||||
|
cb_called[0]++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int initterm_cb1(void)
|
||||||
|
{
|
||||||
|
cb_called[1]++;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int initterm_cb2(void)
|
||||||
|
{
|
||||||
|
cb_called[2]++;
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void test__initterm_e(void)
|
||||||
|
{
|
||||||
|
_INITTERM_E_FN table[4];
|
||||||
|
int res;
|
||||||
|
|
||||||
|
if (!p_initterm_e) {
|
||||||
|
skip("_initterm_e not found\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(table, 0, sizeof(table));
|
||||||
|
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, table);
|
||||||
|
ok( !res && !cb_called[0] && !cb_called[1] && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, NULL);
|
||||||
|
ok( !res && !cb_called[0] && !cb_called[1] && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
/* this crash on Windows */
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(NULL, table);
|
||||||
|
trace("got %d with 0x%x\n", res, errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
table[0] = initterm_cb0;
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, &table[1]);
|
||||||
|
ok( !res && (cb_called[0] == 1) && !cb_called[1] && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
|
||||||
|
/* init-function returning failure */
|
||||||
|
table[1] = initterm_cb1;
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, &table[3]);
|
||||||
|
ok( (res == 1) && (cb_called[0] == 1) && (cb_called[1] == 1) && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
/* init-function not called, when end < start */
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(&table[3], table);
|
||||||
|
ok( !res && !cb_called[0] && !cb_called[1] && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
/* initialization stop after first non-zero result */
|
||||||
|
table[2] = initterm_cb0;
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, &table[3]);
|
||||||
|
ok( (res == 1) && (cb_called[0] == 1) && (cb_called[1] == 1) && !cb_called[2],
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
/* NULL pointer in the array are skipped */
|
||||||
|
table[1] = NULL;
|
||||||
|
table[2] = initterm_cb2;
|
||||||
|
memset(cb_called, 0, sizeof(cb_called));
|
||||||
|
errno = 0xdeadbeef;
|
||||||
|
res = p_initterm_e(table, &table[3]);
|
||||||
|
ok( (res == 2) && (cb_called[0] == 1) && !cb_called[1] && (cb_called[2] == 1),
|
||||||
|
"got %d with 0x%x {%d, %d, %d}\n",
|
||||||
|
res, errno, cb_called[0], cb_called[1], cb_called[2]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ########## */
|
||||||
|
|
||||||
|
START_TEST(msvcr90)
|
||||||
|
{
|
||||||
|
HMODULE hcrt;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
hcrt = LoadLibraryA("msvcr90.dll");
|
||||||
|
if (!hcrt) {
|
||||||
|
win_skip("msvcr90.dll not installed (got %d)\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p_initterm_e = (void *) GetProcAddress(hcrt, "_initterm_e");
|
||||||
|
|
||||||
|
test__initterm_e();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Wine.msvcr90.Test"
|
||||||
|
version="1.0.0.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
/>
|
||||||
|
<description>Wine msvcr90 test suite</description>
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="microsoft.vc90.crt"
|
||||||
|
version="9.0.20718.0"
|
||||||
|
processorArchitecture="*"
|
||||||
|
publicKeyToken="1fc8b3b9a1e18e3b"
|
||||||
|
language="*"
|
||||||
|
/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
</assembly>
|
|
@ -0,0 +1,22 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 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 "winuser.h"
|
||||||
|
|
||||||
|
/* @makedep: msvcr90.manifest */
|
||||||
|
1 RT_MANIFEST msvcr90.manifest
|
Loading…
Reference in New Issue