37 static const char escaped_space[] = {
'@',
's',
'p',
'a',
'c',
'e',
'@'};
38 static const char escaped_tab[] = {
'@',
't',
'a',
'b',
'@'};
43 if (
data[
i] ==
'\n') eol_count++;
50 if (
data[
i-1] !=
'\r')
56 && !
memcmp(
data +
i, escaped_space,
sizeof(escaped_space))) {
58 i +=
sizeof(escaped_space) - 1;
60 && !
memcmp(
data +
i, escaped_tab,
sizeof(escaped_tab))) {
62 i +=
sizeof(escaped_tab) - 1;
73 *new_size =
strlen(new_data);
157static const char *
compare_line(
const char *out_line,
const char *out_end,
const char *exp_line,
160 const char *out_ptr = out_line, *exp_ptr = exp_line;
163 static const char pwd_cmd[] = {
'@',
'p',
'w',
'd',
'@'};
164 static const char drive_cmd[] = {
'@',
'd',
'r',
'i',
'v',
'e',
'@'};
165 static const char path_cmd[] = {
'@',
'p',
'a',
't',
'h',
'@'};
166 static const char shortpath_cmd[] = {
'@',
's',
'h',
'o',
'r',
't',
'p',
'a',
't',
'h',
'@'};
167 static const char space_cmd[] = {
'@',
's',
'p',
'a',
'c',
'e',
'@'};
168 static const char spaces_cmd[] = {
'@',
's',
'p',
'a',
'c',
'e',
's',
'@'};
169 static const char tab_cmd[] = {
'@',
't',
'a',
'b',
'@'};
170 static const char or_broken_cmd[] = {
'@',
'o',
'r',
'_',
'b',
'r',
'o',
'k',
'e',
'n',
'@'};
172 while(exp_ptr < exp_end) {
173 if(*exp_ptr ==
'@') {
174 if(exp_ptr+
sizeof(pwd_cmd) <= exp_end
175 && !
memcmp(exp_ptr, pwd_cmd,
sizeof(pwd_cmd))) {
176 exp_ptr +=
sizeof(pwd_cmd);
185 }
else if(exp_ptr+
sizeof(drive_cmd) <= exp_end
186 && !
memcmp(exp_ptr, drive_cmd,
sizeof(drive_cmd))) {
187 exp_ptr +=
sizeof(drive_cmd);
196 }
else if(exp_ptr+
sizeof(path_cmd) <= exp_end
197 && !
memcmp(exp_ptr, path_cmd,
sizeof(path_cmd))) {
198 exp_ptr +=
sizeof(path_cmd);
207 }
else if(exp_ptr+
sizeof(shortpath_cmd) <= exp_end
208 && !
memcmp(exp_ptr, shortpath_cmd,
sizeof(shortpath_cmd))) {
209 exp_ptr +=
sizeof(shortpath_cmd);
218 }
else if(exp_ptr+
sizeof(space_cmd) <= exp_end
219 && !
memcmp(exp_ptr, space_cmd,
sizeof(space_cmd))) {
220 exp_ptr +=
sizeof(space_cmd);
221 if(out_ptr < out_end && *out_ptr ==
' ') {
227 }
else if(exp_ptr+
sizeof(spaces_cmd) <= exp_end
228 && !
memcmp(exp_ptr, spaces_cmd,
sizeof(spaces_cmd))) {
229 exp_ptr +=
sizeof(spaces_cmd);
230 if(out_ptr < out_end && *out_ptr ==
' ') {
231 while (out_ptr < out_end && *out_ptr ==
' ') out_ptr++;
236 }
else if(exp_ptr+
sizeof(tab_cmd) <= exp_end
237 && !
memcmp(exp_ptr, tab_cmd,
sizeof(tab_cmd))) {
238 exp_ptr +=
sizeof(tab_cmd);
239 if(out_ptr < out_end && *out_ptr ==
'\t') {
245 }
else if(exp_ptr+
sizeof(or_broken_cmd) <= exp_end
246 && !
memcmp(exp_ptr, or_broken_cmd,
sizeof(or_broken_cmd))) {
247 if(out_ptr == out_end)
251 }
else if(out_ptr == out_end || *out_ptr != *exp_ptr)
253 }
else if(out_ptr == out_end || *out_ptr != *exp_ptr) {
261 while(exp_ptr+
sizeof(or_broken_cmd) <= exp_end &&
memcmp(exp_ptr, or_broken_cmd,
sizeof(or_broken_cmd)))
263 exp_ptr +=
sizeof(or_broken_cmd);
264 if (exp_ptr > exp_end)
return err;
274 if(exp_ptr != exp_end)
276 else if(out_ptr != out_end)
284 const char *out_ptr = out_data, *exp_ptr =
exp_data, *out_nl, *exp_nl, *
err =
NULL;
286 static const char todo_wine_cmd[] = {
'@',
't',
'o',
'd',
'o',
'_',
'w',
'i',
'n',
'e',
'@'};
287 static const char resync_cmd[] = {
'-',
'-',
'-'};
293 for(exp_nl = exp_ptr; exp_nl <
exp_data+exp_size && *exp_nl !=
'\r' && *exp_nl !=
'\n'; exp_nl++);
294 for(out_nl = out_ptr; out_nl < out_data+
out_size && *out_nl !=
'\r' && *out_nl !=
'\n'; out_nl++);
296 is_todo_wine = (exp_ptr+
sizeof(todo_wine_cmd) <= exp_nl &&
297 !
memcmp(exp_ptr, todo_wine_cmd,
sizeof(todo_wine_cmd)));
299 exp_ptr +=
sizeof(todo_wine_cmd);
303 is_exp_resync=(exp_ptr+
sizeof(resync_cmd) <= exp_nl &&
304 !
memcmp(exp_ptr, resync_cmd,
sizeof(resync_cmd)));
305 is_out_resync=(out_ptr+
sizeof(resync_cmd) <= out_nl &&
306 !
memcmp(out_ptr, resync_cmd,
sizeof(resync_cmd)));
310 ok(0,
"unexpected end of line %d (got '%.*s', wanted '%.*s')\n",
311 line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
312 else if(
err == exp_nl)
313 ok(0,
"excess characters on line %d (got '%.*s', wanted '%.*s')\n",
314 line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
315 else if (!
err && is_todo_wine && is_out_resync && is_exp_resync)
321 ok(!
err,
"unexpected char 0x%x position %d in line %d (got '%.*s', wanted '%.*s')\n",
322 (
err ? *
err : 0), (
err ? (
int)(
err-out_ptr) : -1),
line, (
int)(out_nl-out_ptr), out_ptr, (
int)(exp_nl-exp_ptr), exp_ptr);
325 if (is_exp_resync &&
err && is_todo_wine)
327 exp_ptr -=
sizeof(todo_wine_cmd);
331 else if (!is_exp_resync || !
err ||
332 (is_exp_resync && is_out_resync &&
err))
335 if(exp_nl+1 <
exp_data+exp_size && exp_nl[0] ==
'\r' && exp_nl[1] ==
'\n')
339 if (!is_out_resync || !
err)
342 if(out_nl+1 < out_data+
out_size && out_nl[0] ==
'\r' && out_nl[1] ==
'\n')
347 ok(exp_ptr >=
exp_data+exp_size,
"unexpected end of output in line %d, missing %s\n",
line, exp_ptr);
348 ok(out_ptr >= out_data+
out_size,
"too long output, got additional %s\n", out_ptr);
353 const char *out_data, *actual_cmd_data;
357 if(!actual_cmd_size || !actual_cmd_data)
360 if(!
run_cmd(actual_cmd_data, actual_cmd_size))
423 const char *cmd_data, *out_data;
446 char cmd[] =
"cmd /c exit 0";
448 memset(&si, 0,
sizeof(si));
464 win_skip(
"cmd not installed, skipping cmd tests\n");
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
ACPI_SIZE strlen(const char *String)
static struct sockaddr_in sa
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define HeapFree(x, y, z)
#define FILE_ATTRIBUTE_NORMAL
static void cleanup(void)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
DWORD WINAPI GetShortPathNameA(IN LPCSTR lpszLongPath, OUT LPSTR lpszShortPath, IN DWORD cchBuffer)
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
BOOL WINAPI EnumResourceNamesA(HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG_PTR lparam)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
INT WINAPI CompareStringA(LCID lcid, DWORD flags, LPCSTR str1, INT len1, LPCSTR str2, INT len2)
HANDLE NTAPI CreateFileMappingA(IN HANDLE hFile, IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes, IN DWORD flProtect, IN DWORD dwMaximumSizeHigh, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName)
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
#define memcpy(s1, s2, n)
#define sprintf(buf, format,...)
static const DWORD drive_len
static DWORD load_resource(const char *name, const char *type, const char **ret)
static DWORD map_file(const char *file_name, const char **ret)
static BOOL run_cmd(const char *cmd_data, DWORD cmd_size)
static char workdir[MAX_PATH]
static int cmd_available(void)
static const char * convert_input_data(const char *data, DWORD size, DWORD *new_size)
static void run_from_file(const char *file_name)
static BOOL WINAPI test_enum_proc(HMODULE module, LPCSTR type, LPSTR name, LONG_PTR param)
static DWORD shortpath_len
static void test_output(const char *out_data, DWORD out_size, const char *exp_data, DWORD exp_size)
static const char * compare_line(const char *out_line, const char *out_end, const char *exp_line, const char *exp_end)
static char shortpath[MAX_PATH]
static void test_size(void)
#define todo_wine_if(is_todo)
static HANDLE PIO_APC_ROUTINE PVOID PIO_STATUS_BLOCK ULONG PVOID ULONG PVOID ULONG out_size
#define FILE_ATTRIBUTE_READONLY
#define LOCALE_SYSTEM_DEFAULT
int winetest_get_mainargs(char ***pargv)
struct ChNotifyTest * exp_data
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
DWORD WINAPI GetLastError(void)
#define STARTF_USESTDHANDLES