Command prompts show nat_timeused rounded down to minutes. They need
to be normalized, or else tests can fail when they take too long, or
cross midnight. Formatted prompts are normalized correctly (not
actually used since commit 9ca3fa9), but the journal contains raw
prompts. Normalize them, too.
Smoke test's journal.log is affected, because the server charges at
least 15s per login, which adds up into minutes in this test.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
To make setup scripting more similar to test scripting. Also permits
use of countries other than POGO there, but that isn't necessary right
now.
Setup scripts renamed from init_script to setup-POGO.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Instead of relative to build directory. Shorter, and independent of
the path from build to source directory.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
The other test output files have fixed names, and having just one with
a name that varies with the test name complicates things with no gain.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Only actofgod-test wants it. Enable it there. The others either
don't want it (fire-test), or don't care.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Warn the first time a server is started. Incorrect for info-test with
POSIX threads, so suppress the warning there.
Improve the warning message a bit while we're at it.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Commit 37ff377 stripped trailing white space in test output, except
for journal.log, where it stripped it only from player output. This
misses the space preceeding player empty output, and doesn't cover
equally annoying trailing white space elsewhere, such as the space
preceeding empty input and trailing white space in prompts. Testing
the latter could be marginally useful, but let's keep things simple,
and strip all trailing white space for now.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Empire 2 settled on this formula for the stack size:
stacksize = 100000 +
/* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
sizeof(char *));
Obviously attempts to provide space for a known configuration-
dependent stack hog. The hog went away when finish_sects()'s arrays
became dynamically allocated in 4.2.0.
Adjusting for that by dropping the extra term might well do (I observe
only a few KiB of stack used on my system). But let's set it to 512
KiB instead to be on the safe side.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
I observed a stack overflow in news command on my x86_64 system
running Fedora 18.
Empire 2 settled on this formula for the stack size:
stacksize = 100000
/* budget */ + MAX(WORLD_SZ() * sizeof(int) * 7,
/* power */ MAXNOC * sizeof(struct powstr));
Obviously attempts to provide space for known configuration-dependent
stack hogs.
The first hog is allegedly budget. Bogus since day one: its large
arrays were static in Empire 2, and became dynamically allocated in
Empire 3.
The second one makes some sense: powe() has a struct powstr[MAXNOC].
It also has an int[MAXNOC], which isn't accounted for.
Except for ridiculously small worlds, the second term is smaller, and
only the (bogus) first term matters.
Two hogs are missing: head() has a struct histstr[MAXNOC][MAXNOC], and
news() has a short[MAXNOC][MAXNOC]. It also calls head().
I looked for more hogs with "gcc -fstack-usage", and found none.
On my x86_64 system, a news command needs almost 107KiB of stack.
Only slightly less when compiled for 32 bit. Stack overrun for worlds
with fewer than some 320 sectors, thus unlikely to bite in real games.
Increase player stack size to 1 MiB. Using MAXNOC to size the stack
isn't worth the trouble.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Normally, git's pre-commit hook protects us from them. However, when
expected test output contains trailing white space, we have to bypass
commit hooks. Unwanted space can then slip in if you don't pay
attention. I obviously didn't; clean up.
The previous commit should reduce the need for such hook suppression.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
feed_input drops lines starting with a bar character '|', so they can
serve as comments. Syntax chosen because such lines shouldn't be
needed in tests. In particular, the server already ignores such lines
when it reads commands, because they get parsed as empty command with
a pipeline, and empty commands get ignored, regardless of
redirections.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Units owned by POGO are not in use. Giving a unit to POGO destroys
it. The opposite doesn't work, however: the unit prewrite hooks give
it right back to POGO, because efficiency is below the minimum. Make
it work by also increasing efficiency to minimum.
Note that you can't use this to create a unit that doesn't already
exist in the respective file. That's because edit's second argument
selects from existing objects only.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Info pages in $(datadir)/empire/info.html/ and the directory
$(datadir)/empire/ aren't removed. Fix that.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Blow away $(einfodir) and $(ehtmldir). Without this, formatted pages
can linger after page removal. Matters, because info.c searches
$(einfodir) rather than the index $(einfodir)/all. Same for web
servers and $(ehtmldir).
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>