Commit graph

10 commits

Author SHA1 Message Date
9309670544 tests/version: New; exercises config introspection commands
Exercise version, show and xdump, except for xdump of game state.

The xdump part is mostly factored out of tests/smoke.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 14:03:55 +02:00
48ee722a48 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>
2014-01-19 10:09:16 +01:00
4ed5694814 tests/normalize.pl: Drop match option g where it's not necessary
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-19 10:09:16 +01:00
3697a0a20b 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>
2014-01-19 08:14:33 +01:00
37ff3774ec tests: Normalize trailing white space away in test output
We don't really care for it there, and git's pre-commit hook flags it,
which is annoying.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:49:59 +01:00
df614a9bdc tests: Document log file normalization a bit better
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:49:59 +01:00
02cb202a69 tests: Cut off log file timestamp instead of normalizing it
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-05-31 09:54:50 +02:00
e51b3fb842 Use int instead of long for flags
As long as symbol_by_value(), show_capab() and togg() support only
int, flags need to fit into int.

Not a problem in practice, because no machine capable of running
Empire has int narrower than 32 bits, and 32 bits suffice.

Some flags members are long instead of int: struct lchrstr member
l_flags, struct natstr member nat_flags, struct mchrstr member m_flags
are long.  Waste of space on machines with long wider than int.
Change them to int.

Rearrange struct lchrstr and struct natstr to avoid holes.
2013-05-08 06:57:51 +02:00
108c9408dc Make smoke test check the final empdump -x 2013-05-08 06:55:18 +02:00
49b2b13a90 New make target check
Just a smoke test so far, extracted from src/scripts/nightly/.  This
makes the existing smoke test more easily accessible.  Noteworthy
differences:

* Instead of patching the code to make output more stable, postprocess
  the output to normalize it.

* Compare actual results to expected results instead of the previous
  test run's results.

* Much faster.  The old test harness used sleep liberally to "ensure"
  things always happen in the same order.

Known shortcomings:

* The smoke test hangs when the server fails to complete startup, or
  fails to terminate.

* Normalization of xdump hardcodes columns instead of getting them
  from xdump meta.

* Normalization of time values in xdump is an ugly hack.

* xdump meta column type isn't normalized.  Actual values can vary
  between systems, because the width of enumeration types is
  implementation-defined.  The smoke test works only when they're
  represented as int, which is the case on common systems.

* Currently expected to work only with thread package LWP and a
  random() that behaves exactly like the one on my development system,
  because:

  - Thread scheduling is reliably deterministic only with LWP

  - The PRN sequence produced by random() isn't portable

  - Shell builtin kill appears not to do the job in MinGW

  - The Windows server tries to run as service when -d isn't
    specified

Further work is needed to address these shortcomings.

Getting C programs behave exactly the same on all systems is hard.
We'll likely run into system-dependent differences that upset the
smoke test.  Floating-point computation seems particularly vulnerable.

Instead of updating src/scripts/nightly/ to use "make check", retire
it.  It hasn't been used in quite a while.  Investing more into our
homegrown auto-builder doesn't make sense, as canned auto-builders
such as Travis CI and Jenkins are readily available.

The shell scripts src/scripts/nightly/tests/?? become Empire batch
files tests/smoke/.  The shell scripts are actually shell boilerplate
around Empire batch files.  To make sure git recognizes the move, this
commit moves them unchanged.  tests/smoke-test strips the boilerplate
before it feeds the batch files to the client.  The next commit will
get rid fo that.
2013-05-08 06:55:11 +02:00