summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/initfile.cc
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2009-09-24 20:18:07 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2009-09-24 20:27:06 +0530
commite65f11731155dec69701d806ba00c6bd24ffc33c (patch)
tree58d06a0b0b9d300ce3c6a59fec5ecd01ca8c7582 /crawl-ref/source/initfile.cc
parent383469b3ec04e7343eab5460e948f32b3857943a (diff)
downloadcrawl-ref-e65f11731155dec69701d806ba00c6bd24ffc33c.tar.gz
crawl-ref-e65f11731155dec69701d806ba00c6bd24ffc33c.zip
Set up a basic testing framework for LOS. ./crawl -test with a full debug build will run the test.
Diffstat (limited to 'crawl-ref/source/initfile.cc')
-rw-r--r--crawl-ref/source/initfile.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc
index a342137e3b..247cde2076 100644
--- a/crawl-ref/source/initfile.cc
+++ b/crawl-ref/source/initfile.cc
@@ -3424,6 +3424,7 @@ enum commandline_option_type {
CLO_MACRO,
CLO_MAPSTAT,
CLO_ARENA,
+ CLO_TEST,
CLO_HELP,
CLO_NOPS
@@ -3432,7 +3433,7 @@ enum commandline_option_type {
static const char *cmd_ops[] = {
"scores", "name", "species", "job", "plain", "dir", "rc",
"rcdir", "tscores", "vscores", "scorefile", "morgue", "macro",
- "mapstat", "arena", "help"
+ "mapstat", "arena", "test", "help"
};
const int num_cmd_ops = CLO_NOPS;
@@ -3451,28 +3452,21 @@ std::string find_executable_path()
tempPath[0] = 0;
#if defined ( _MSC_VER )
-
int retval = GetModuleFileName ( NULL, tempPath, sizeof(tempPath) );
-
#elif defined ( __linux__ )
-
int retval = readlink ( "/proc/self/exe", tempPath, sizeof(tempPath) );
-
#elif defined ( __MACH__ )
-
strncpy ( tempPath, NXArgv[0], sizeof(tempPath) );
-
#else
-
// We don't know how to find the executable's path on this OS.
-
#endif
-
return std::string(tempPath);
}
bool parse_args( int argc, char **argv, bool rc_only )
{
+ COMPILE_CHECK(ARRAYSZ(cmd_ops) == CLO_NOPS, c1);
+
std::string exe_path = find_executable_path();
if (!exe_path.empty())
@@ -3615,6 +3609,10 @@ bool parse_args( int argc, char **argv, bool rc_only )
}
break;
+ case CLO_TEST:
+ crawl_state.test = true;
+ break;
+
case CLO_MACRO:
if (!next_is_param)
return (false);