[MSVCRT:APITEST]

Move cmdline_util to CmdLineUtil and locate it in bin/data instead of bin

svn path=/trunk/; revision=57527
This commit is contained in:
Hermès Bélusca-Maïto 2012-10-09 22:03:50 +00:00
parent 2a41d13595
commit 4690bf4891
6 changed files with 40 additions and 31 deletions

View file

@ -1,7 +1,5 @@
add_subdirectory(cmdline_util)
add_definitions(-D_DLL -D__USE_CRTIMP)
add_subdirectory(CmdLineUtil)
list(APPEND SOURCE
CommandLine.c

View file

@ -0,0 +1,8 @@
list(APPEND SOURCE
CmdLineUtil.c)
add_executable(CmdLineUtil ${SOURCE})
set_module_type(CmdLineUtil win32gui UNICODE)
add_importlibs(CmdLineUtil msvcrt kernel32 ntdll)
add_cd_file(TARGET CmdLineUtil DESTINATION reactos/bin/data FOR all)

View file

@ -10,6 +10,8 @@
#include <windows.h>
#include <ndk/ntndk.h>
#include "CmdLineUtil.h"
int APIENTRY wWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPWSTR lpCmdLine,
@ -23,7 +25,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
/* Write the results into a file. */
HANDLE hFile = CreateFileW(L"C:\\cmdline.dat",
HANDLE hFile = CreateFileW(DATAFILE,
GENERIC_WRITE,
0, NULL,
CREATE_ALWAYS,

View file

@ -0,0 +1,13 @@
/*
* PROJECT: ReactOS API Tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Test for CRT command-line handling - Utility GUI program.
* PROGRAMMER: Hermès BÉLUSCA - MAÏTO <hermes.belusca@sfr.fr>
*/
#pragma once
// The path to the data file.
#define DATAFILE L"C:\\cmdline.dat"
/* EOF */

View file

@ -11,20 +11,16 @@
#include <wine/test.h>
#include <ndk/ntndk.h>
#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0]))
#include "./CmdLineUtil/CmdLineUtil.h"
/*
* The path to the data file is hardcoded in cmdline_util.c
* Please synchronize it whenever you do a change.
*/
#define DATAFILE L"C:\\cmdline.dat"
#define COUNT_OF(x) (sizeof((x))/sizeof((x)[0]))
/**
* Extracts the command tail from the command line
* (deletes the program's name and keep the rest).
**/
#define SPACECHAR L' '
#define DQUOTECHAR L'\"'
#define DQUOTECHAR L'"'
LPWSTR ExtractCmdLine(IN LPWSTR lpszCommandLine)
{
@ -98,18 +94,18 @@ typedef struct _TEST_CASE
static TEST_CASE TestCases[] =
{
{L"cmdline_util.exe"},
{L"cmdline_util.exe foo bar"},
{L"cmdline_util.exe \"foo bar\""},
{L"cmdline_util.exe foo \"bar John\" Doe"},
{L"CmdLineUtil.exe"},
{L"CmdLineUtil.exe foo bar"},
{L"CmdLineUtil.exe \"foo bar\""},
{L"CmdLineUtil.exe foo \"bar John\" Doe"},
{L"\"cmdline_util.exe\""},
{L"\"cmdline_util.exe\" foo bar"},
{L"\"cmdline_util.exe\" \"foo bar\""},
{L"\"cmdline_util.exe\" foo \"bar John\" Doe"},
{L"\"CmdLineUtil.exe\""},
{L"\"CmdLineUtil.exe\" foo bar"},
{L"\"CmdLineUtil.exe\" \"foo bar\""},
{L"\"CmdLineUtil.exe\" foo \"bar John\" Doe"},
{L"\"cmdline_util.exe\""},
{L"\"cmdline_util.exe \"foo bar\"\""},
{L"\"CmdLineUtil.exe\""},
{L"\"CmdLineUtil.exe \"foo bar\"\""},
};
static void Test_CommandLine(IN ULONG TestNumber,
@ -237,6 +233,7 @@ static void Test_CommandLine(IN ULONG TestNumber,
ExtractCmdLine_U(&NTCmdLine);
/* Print the results */
/*
*(LPWSTR)((ULONG_PTR)NTCmdLine.Buffer + NTCmdLine.Length) = 0;
printf("WinMain cmdline = '%S'\n"
"Win32 cmdline = '%S'\n"
@ -245,6 +242,7 @@ static void Test_CommandLine(IN ULONG TestNumber,
WinMainCmdLine,
Win32CmdLine,
NTCmdLine.Buffer, NTCmdLine.Length);
*/
/*
* Now check the results.

View file

@ -1,10 +0,0 @@
add_definitions(-D_DLL -D__USE_CRTIMP)
list(APPEND SOURCE
cmdline_util.c)
add_executable(cmdline_util ${SOURCE})
set_module_type(cmdline_util win32gui UNICODE)
add_importlibs(cmdline_util msvcrt kernel32 ntdll)
add_cd_file(TARGET cmdline_util DESTINATION reactos/bin FOR all)