[PATCH 2/2] kernel32/tests: Don't call DeleteFile from assert()
Daniel Lehman
dlehman25 at gmail.com
Mon Feb 6 23:07:05 CST 2017
if NDEBUG is defined, DeleteFile is not called
Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---
dlls/kernel32/tests/debugger.c | 12 ++++++------
dlls/kernel32/tests/process.c | 44 +++++++++++++++++++++---------------------
2 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c
index 759234c..a85fe59 100644
--- a/dlls/kernel32/tests/debugger.c
+++ b/dlls/kernel32/tests/debugger.c
@@ -321,8 +321,8 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
TerminateProcess(info.hProcess, WAIT_TIMEOUT);
WaitForSingleObject(info.hProcess, 5000);
CloseHandle(info.hProcess);
- assert(DeleteFileA(dbglog) != 0);
- assert(DeleteFileA(childlog) != 0);
+ DeleteFileA(dbglog);
+ DeleteFileA(childlog);
win_skip("Giving up on child process\n");
return;
}
@@ -357,8 +357,8 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
skip_crash_and_debug = broken(wait_code == WAIT_TIMEOUT);
if (skip_crash_and_debug)
{
- assert(DeleteFileA(dbglog) != 0);
- assert(DeleteFileA(childlog) != 0);
+ DeleteFileA(dbglog);
+ DeleteFileA(childlog);
win_skip("Giving up on debugger\n");
return;
}
@@ -375,8 +375,8 @@ static void crash_and_debug(HKEY hkey, const char* argv0, const char* dbgtasks)
ok(dbg_blackbox.nokill_rc, "DebugSetProcessKillOnExit(FALSE) failed err=%d\n", dbg_blackbox.nokill_err);
ok(dbg_blackbox.detach_rc, "DebugActiveProcessStop(%d) failed err=%d\n", dbg_blackbox.pid, dbg_blackbox.detach_err);
- assert(DeleteFileA(dbglog) != 0);
- assert(DeleteFileA(childlog) != 0);
+ DeleteFileA(dbglog);
+ DeleteFileA(childlog);
}
static void crash_and_winedbg(HKEY hkey, const char* argv0)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index f66ab45..68d6b64 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -632,7 +632,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -670,7 +670,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -708,7 +708,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -746,7 +746,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -786,7 +786,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -824,7 +824,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* not so simplistic now */
memset(&startup, 0, sizeof(startup));
@@ -862,7 +862,7 @@ static void test_Startup(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* TODO: test for A/W and W/A and W/W */
}
@@ -894,7 +894,7 @@ static void test_CommandLine(void)
okChildString("Arguments", "argvA5", NULL);
okChildString("Arguments", "CommandLineA", buffer);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
@@ -917,7 +917,7 @@ static void test_CommandLine(void)
okChildString("Arguments", "argvA7", NULL);
okChildString("Arguments", "CommandLineA", buffer);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* Test for Bug1330 to show that XP doesn't change '/' to '\\' in argv[0]*/
get_file_name(resfile);
@@ -933,7 +933,7 @@ static void test_CommandLine(void)
sprintf(buffer, "./%s", exename);
okChildString("Arguments", "argvA0", buffer);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
get_file_name(resfile);
/* Use exename to avoid buffer containing things like 'C:' */
@@ -948,8 +948,8 @@ static void test_CommandLine(void)
sprintf(buffer, ".\\%s", exename);
okChildString("Arguments", "argvA0", buffer);
release_memory();
- assert(DeleteFileA(resfile) != 0);
-
+ DeleteFileA(resfile);
+
get_file_name(resfile);
GetFullPathNameA(selfname, MAX_PATH, fullpath, &lpFilePart);
assert ( lpFilePart != 0);
@@ -969,7 +969,7 @@ static void test_CommandLine(void)
else sprintf(buffer, "./%s", exename);
okChildString("Arguments", "argvA0", buffer);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* Using AppName */
get_file_name(resfile);
@@ -993,7 +993,7 @@ static void test_CommandLine(void)
okChildString("Arguments", "CommandLineA", buffer2);
okChildStringWA("Arguments", "CommandLineW", buffer2);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
if (0) /* Test crashes on NT-based Windows. */
{
@@ -1088,7 +1088,7 @@ static void test_Directory(void)
okChildIString("Misc", "CurrDirA", windir);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
/* search PATH for the exe if directory is NULL */
ok(CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info), "CreateProcess\n");
@@ -1301,7 +1301,7 @@ static void test_Environment(void)
env = GetEnvironmentStringsA();
cmpEnvironment(env);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
@@ -1360,7 +1360,7 @@ static void test_Environment(void)
HeapFree(GetProcessHeap(), 0, child_env);
FreeEnvironmentStringsA(env);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
}
static void test_SuspendFlag(void)
@@ -1408,7 +1408,7 @@ static void test_SuspendFlag(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
}
static void test_DebuggingFlag(void)
@@ -1470,7 +1470,7 @@ static void test_DebuggingFlag(void)
okChildInt("StartupInfoA", "dwFlags", startup.dwFlags);
okChildInt("StartupInfoA", "wShowWindow", startup.wShowWindow);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
}
static BOOL is_console(HANDLE h)
@@ -1617,7 +1617,7 @@ static void test_Console(void)
ok(sbiC.dwCursorPosition.Y == (sbi.dwCursorPosition.Y ^ 1), "Wrong cursor position\n");
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
ok(CreatePipe(&hParentIn, &hChildOut, NULL, 0), "Creating parent-input pipe\n");
ok(DuplicateHandle(GetCurrentProcess(), hChildOut, GetCurrentProcess(),
@@ -1660,7 +1660,7 @@ static void test_Console(void)
okChildString("StdHandle", "msg", msg);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
}
static void test_ExitCode(void)
@@ -1689,7 +1689,7 @@ static void test_ExitCode(void)
okChildInt("ExitCode", "value", code);
release_memory();
- assert(DeleteFileA(resfile) != 0);
+ DeleteFileA(resfile);
}
static void test_OpenProcess(void)
--
2.7.4
More information about the wine-patches
mailing list