forked from github/server
include test-suite in the server itself.
This commit is contained in:
parent
41cf66cee5
commit
757517073d
|
@ -32,12 +32,3 @@ else (WIN32)
|
|||
endif (WIN32)
|
||||
|
||||
add_definitions(-DUNITY_BUILD)
|
||||
set (TESTS_SRCS
|
||||
../server/src/tests.c
|
||||
../external/cutest/CuTest.c
|
||||
)
|
||||
add_executable (tests ${LIB_SRCS} ${TESTS_SRCS})
|
||||
if (WIN32)
|
||||
else (WIN32)
|
||||
target_link_libraries (tests tolua xml2 ncurses lua5.1 pthread)
|
||||
endif (WIN32)
|
||||
|
|
16
all.sln
16
all.sln
|
@ -12,15 +12,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "external", "..\external\ext
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amalgamation-eressea", "src\eressea.vcproj", "{AD80EB0B-7CB4-42F2-9C95-8CCEF68DB387}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amalgamation-basic", "..\example\src\example.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "..\server\src\tests.vcproj", "{228B8781-480F-4608-BA14-1EB82581EADE}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "amalgamation-example", "..\example\src\example.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
|
@ -47,12 +41,12 @@ Global
|
|||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{228B8781-480F-4608-BA14-1EB82581EADE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{228B8781-480F-4608-BA14-1EB82581EADE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{228B8781-480F-4608-BA14-1EB82581EADE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{228B8781-480F-4608-BA14-1EB82581EADE}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(SubversionScc) = preSolution
|
||||
Svn-Managed = True
|
||||
Manager = AnkhSVN - Subversion Support for Visual Studio
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -462,6 +462,26 @@
|
|||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\server\src\tests.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
ExcludedFromBuild="true"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\unitcurse.c"
|
||||
>
|
||||
|
@ -540,6 +560,10 @@
|
|||
RelativePath="..\..\server\src\build\stdafx.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\server\src\tests.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\spells\unitcurse.h"
|
||||
>
|
||||
|
|
28
src/main.c
28
src/main.c
|
@ -12,6 +12,8 @@
|
|||
#include <locale.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#include <tests.h>
|
||||
|
||||
static const char * luafile = "setup.lua";
|
||||
static const char * entry_point = NULL;
|
||||
static const char * inifile = "eressea.ini";
|
||||
|
@ -48,14 +50,16 @@ usage(const char * prog, const char * arg)
|
|||
"-v <level> : verbosity level\n"
|
||||
"-C : run in interactive mode\n"
|
||||
"--color : force curses to use colors even when not detected\n"
|
||||
"--tests : run testsuite\n"
|
||||
"--help : help\n", prog);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_args(int argc, char **argv)
|
||||
parse_args(int argc, char **argv, int *exitcode)
|
||||
{
|
||||
int i;
|
||||
int run_tests = 0;
|
||||
|
||||
for (i=1;i!=argc;++i) {
|
||||
if (argv[i][0]!='-') {
|
||||
|
@ -70,6 +74,10 @@ parse_args(int argc, char **argv)
|
|||
/* force the editor to have colors */
|
||||
force_color = 1;
|
||||
}
|
||||
else if (strcmp(argv[i]+2, "tests")==0) {
|
||||
/* force the editor to have colors */
|
||||
run_tests = 1;
|
||||
}
|
||||
else if (strcmp(argv[i]+2, "help")==0) {
|
||||
return usage(argv[0], NULL);
|
||||
}
|
||||
|
@ -93,12 +101,20 @@ parse_args(int argc, char **argv)
|
|||
verbosity = atoi(argv[++i]);
|
||||
break;
|
||||
case 'h':
|
||||
return usage(argv[0], NULL);
|
||||
usage(argv[0], NULL);
|
||||
return 1;
|
||||
default:
|
||||
return usage(argv[0], argv[i]);
|
||||
*exitcode = -1;
|
||||
usage(argv[0], argv[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_tests) {
|
||||
*exitcode = RunAllTests();
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -226,7 +242,7 @@ extern void bind_eressea(struct lua_State * L);
|
|||
int main(int argc, char ** argv)
|
||||
{
|
||||
static int write_csv = 0;
|
||||
int err;
|
||||
int err, result = 0;
|
||||
|
||||
setup_signal_handler();
|
||||
|
||||
|
@ -234,9 +250,9 @@ int main(int argc, char ** argv)
|
|||
locale_init();
|
||||
parse_config(inifile);
|
||||
|
||||
err = parse_args(argc, argv);
|
||||
err = parse_args(argc, argv, &result);
|
||||
if (err) {
|
||||
return err;
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef CRTDBG
|
||||
|
|
|
@ -18,4 +18,4 @@
|
|||
#include "bindings.c"
|
||||
#include "monsters.c"
|
||||
#include "main.c"
|
||||
|
||||
#include "tests.c"
|
||||
|
|
Loading…
Reference in New Issue