tests: Normalize trailing white space in test output completely

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>
.gitignore: Ignore sandbox

Missed in commit 49b2b13, v4.3.31.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: Move "not expected to work" warning into test-common.sh

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>
tests: Factor feed_dir out of fire-test and smoke-test

Smoke test's player input files renamed from $cnum to $ordnum-$cname
to keep feed_dir simple.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: Disable GODNEWS by default

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>
tests: Rename final xdump files to final.xdump

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>
tests: Name compared files relative to sandbox in output

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>
tests: Use feed_files for setup scripts

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>
tests/normalize.pl: Drop match option g where it's not necessary

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: Fix normalization of nat_timeused in prompt in journal

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>
tests: Run server with -E crash-dump

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: New make target check-accept

Updates expected results from actual results, for review and commit.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
econfig: New key running_test_suite, for use by tests

For now, it just logs "Configured for testing" on startup, and prints
a scary warning on player login.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: Enable running_test_suite by default

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: Make robust against variations in PRNG use

Tests need repeatable pseudorandom numbers to yield repeatable
results.  We seed the pseudorandom number generator with a fixed value
(emp_server -R) to make it produce the same sequence of numbers every
time.  But whenever code exercised by a test is changed to consume
fewer or more of them, all subsequent users get different numbers
regardless.  The ensuing test result changes are extremely tedious to
review.

To address this problem, reseed the PRNG with the count of commands
right before executing a command when running_test_suite is on.  This
way, the effect of perturbing the PRN sequence lasts only until the
next command.

Note that the next command could be another player's.  Doesn't matter.

Adding or removing commands now upsets the PRN sequence even for
commands that don't consume PRNs.  The next commit will take care of
that.

Perturbs test results across the board.  Hopefully, that'll happen
much less frequently now.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests: New test-suite-only command __cmd

Adding or removing a command to/from a test has unfortunate effects:

* Before the previous commit: if the command consumes pseudorandom
  numbers, all subsequent users of pseudorandom numbers get different
  ones.  This has always been a major headache.

* Since the previous commit: all subsequent users of pseudorandom
  numbers get different ones whether the command consumes any or not.
  That's even worse.

* If the command uses BTUs, subsequent prompts are changed.  Not
  nearly as bad as the above, but still annoying.

Create a new command __cmd to allow compensating for adding/removing
commands for tests.  Throw in the ability to compensate treasury
changes for good measure.  Three arguments: command count, BTU use,
money use.

Usage example: say you add a convert command to a test, and it uses 3
BTUs and $15.  Then you compensate by adding "__cmd added 1 3 15"
right after it.

The command must not be available unless running_test_suite is on, of
course.  Make it require the new player command capability TESTING,
and give that to all players when running_test_suite is on.

The command is intentionally not documented in info.  Switch
running_test_suite off for info-test, to hide it (and any future
TESTING commands) from info-test.

Suppress the command counter increment for TESTING commands, so they
can be used without upsetting pseudorandom numbers

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests/fire: Use commands designed for humans rather than xdump

Changed xdump output is too painful to review.  final.xdump should
still catch changes that are visible only in xdump.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests/fire: Drop reset of #1's BTUs between sub-tests

This was a lame attempt at limiting the ripple effect of adding /
removing commands.  Better means are now available, so drop it.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests/fire: Add another salvo at own ship

The existing one does no damage.  Add one that does.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
tests/fire: Give all land unit targets SAM cargo

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>