Merge pull request #173 from aquileia/WML_test
Add support for WML unit tests to the VC compiler, and also a nice windows cmd script, porting the bash script which we have, and which uses a timeout program which Aquileia wrote for us and added to the VC project files.
This commit is contained in:
commit
8306aa9353
5 changed files with 440 additions and 2 deletions
40
projectfiles/VC9/WML_tests.cmd
Normal file
40
projectfiles/VC9/WML_tests.cmd
Normal file
|
@ -0,0 +1,40 @@
|
|||
:: WML_tests.cmd : Run the WML unit tests specified in wml_test_schedule
|
||||
|
||||
:: preamble: don't spam stdout with commands, don't expand ERRORLEVEL to 0
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
:: save file paths and command line arguments
|
||||
set LoadFile=%~p0..\..\wml_test_schedule
|
||||
set binary=wesnoth.exe
|
||||
set opt=--log-strict=warning
|
||||
:: OutDir is necessary for VC debug configuration, defaults to wesnoth\
|
||||
if "%1"=="" ( set "OutDir=..\..\") else ( set "OutDir=%~p1")
|
||||
|
||||
cd %OutDir%
|
||||
echo running WML tests:
|
||||
|
||||
:: ignore lines beginning with #
|
||||
:: %%G contains whether the test should pass (0), timeout (2) or fail (1,4)
|
||||
:: %%H is the name of the WML unit test to be executed
|
||||
for /f "eol=# tokens=1,2 delims= " %%G in (%LoadFile%) do (
|
||||
:: WindowsTimeout is more reliable than the --timeout option
|
||||
WindowsTimeout.exe "%binary% %opt% -u %%H" 20000
|
||||
if !ERRORLEVEL! neq %%G (
|
||||
if !ERRORLEVEL! equ 2 (
|
||||
echo(
|
||||
echo WML_tests.cmd: Warning WML2: Test '%%H' timed out, expected return value %%G
|
||||
) else (
|
||||
echo(
|
||||
echo WML_tests.cmd: Error WML1: Test '%%H' returned !ERRORLEVEL!, expected %%G
|
||||
)
|
||||
)
|
||||
:: minimalistic progress bar
|
||||
<nul (set/p progress=.)
|
||||
)
|
||||
echo(
|
||||
echo WML tests completed
|
||||
|
||||
:: restore the state before execution
|
||||
cd %~p0
|
||||
echo on
|
58
projectfiles/VC9/WindowsTimeout.cpp
Normal file
58
projectfiles/VC9/WindowsTimeout.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
Copyright (C) 2014 by Sebastian Koelle <sk.aquileia@gmail.com>
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Execute another executable:
|
||||
* - wait for the process to quit, then pass through the error code
|
||||
* - terminate it after a timeout of "t" microseconds, then return 2
|
||||
*/
|
||||
|
||||
#if _WIN32_WINNT < 0x0602 //Windows version before Win8
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <Processthreadsapi.h>
|
||||
#endif
|
||||
// #define WIN32_LEAN_AND_MEAN
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
||||
if (argc != 3) {
|
||||
std::cout << "WindowsTimeout: Error USAGE1: " << argv[0] << " \"command [--options]\" t";
|
||||
return -1;
|
||||
}
|
||||
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO info = { sizeof(info) };
|
||||
HANDLE hStdErr = GetStdHandle(STD_ERROR_HANDLE);
|
||||
info.hStdError = hStdErr;
|
||||
|
||||
if (!CreateProcess(NULL, argv[1], NULL, NULL, TRUE, 0, NULL, NULL, &info, &pi))
|
||||
return -1;
|
||||
|
||||
DWORD dwExitCode;
|
||||
if (::WaitForSingleObject(pi.hProcess, atoi(argv[2])) == WAIT_OBJECT_0) {
|
||||
GetExitCodeProcess(pi.hProcess, &dwExitCode);
|
||||
}
|
||||
else {
|
||||
TerminateProcess(pi.hProcess, 2);
|
||||
dwExitCode = 2;
|
||||
}
|
||||
CloseHandle(pi.hProcess);
|
||||
CloseHandle(pi.hThread);
|
||||
CloseHandle(hStdErr);
|
||||
return dwExitCode;
|
||||
}
|
319
projectfiles/VC9/WindowsTimeout.vcproj
Normal file
319
projectfiles/VC9/WindowsTimeout.vcproj
Normal file
|
@ -0,0 +1,319 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="WindowsTimeout"
|
||||
ProjectGUID="{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}"
|
||||
RootNamespace="wesnoth"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\WindowsTimeout"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4127;4512"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
LinkIncremental="2"
|
||||
OutputFile="$(OutDir)\WindowsTimeout.exe"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)\..\.."
|
||||
IntermediateDirectory="$(ConfigurationName)\WindowsTimeout"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
LinkTimeCodeGeneration="1"
|
||||
OutputFile="$(OutDir)\WindowsTimeout.exe"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug_with_VLD|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\WindowsTimeout"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
WarningLevel="4"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4127;4512"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
LinkTimeCodeGeneration="1"
|
||||
OutputFile="$(OutDir)\WindowsTimeout.exe"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="ReleaseDEBUG|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\WindowsTimeout"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
GenerateDebugInformation="false"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
LinkIncremental="2"
|
||||
OutputFile="$(OutDir)\WindowsTimeout.exe"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath="WindowsTimeout.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -4,6 +4,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wesnoth", "wesnoth.vcproj",
|
|||
ProjectSection(ProjectDependencies) = postProject
|
||||
{01AE7104-A4B1-428E-BA7C-460FE656AE5C} = {01AE7104-A4B1-428E-BA7C-460FE656AE5C}
|
||||
{4A16638B-127B-4AE8-8E0B-4B211B96F976} = {4A16638B-127B-4AE8-8E0B-4B211B96F976}
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C} = {06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wesnothd", "wesnothd.vcproj", "{72F28A4A-A6A2-4C49-8141-7CD0DFA9ECCE}"
|
||||
|
@ -20,6 +21,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "schema_generator", "schema_
|
|||
{4A16638B-127B-4AE8-8E0B-4B211B96F976} = {4A16638B-127B-4AE8-8E0B-4B211B96F976}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WindowsTimeout", "WindowsTimeout.vcproj", "{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_with_VLD|Win32 = Debug_with_VLD|Win32
|
||||
|
@ -64,6 +67,14 @@ Global
|
|||
{9FDDFD0B-C23F-47DB-97F7-7BDCA3E754D9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{9FDDFD0B-C23F-47DB-97F7-7BDCA3E754D9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{9FDDFD0B-C23F-47DB-97F7-7BDCA3E754D9}.ReleaseDEBUG|Win32.ActiveCfg = ReleaseDEBUG|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Debug_with_VLD|Win32.ActiveCfg = Debug_with_VLD|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Debug_with_VLD|Win32.Build.0 = Debug_with_VLD|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.Release|Win32.Build.0 = Release|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.ReleaseDEBUG|Win32.ActiveCfg = ReleaseDEBUG|Win32
|
||||
{06CDDAD5-8638-46F0-88F5-1B458B7FBE0C}.ReleaseDEBUG|Win32.Build.0 = ReleaseDEBUG|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -94,6 +94,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd $(OutDir)"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
@ -182,6 +184,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
@ -261,6 +265,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd $(OutDir)"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
@ -341,7 +347,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine=""
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd $(OutDir)"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
@ -431,7 +438,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine=""
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd $(OutDir)"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
|
@ -520,6 +528,8 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description="WML unit tests for Wesnoth"
|
||||
CommandLine="WML_tests.cmd"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
|
|
Loading…
Add table
Reference in a new issue