Commit graph

36 commits

Author SHA1 Message Date
ddefd7173e tests: Make "make check-accept" accept new files
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-05 10:41:35 +01:00
e823a4f055 tests: Drop some dead code from test-common.sh
Left behind by commit c594b6120 "tests: New helper cmp_out1".

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-05 10:41:35 +01:00
9d6b3b3520 config: Split table sect-chr for legibility
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 19:59:58 +02:00
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
6e80cf103f tests: Enable GNU libc memory allocation error checking
MALLOC_CHECK_=3 makes glibc check for memory allocation programming
errors.  It's the factory default, but set it anyway just in case
someone disabled it for speed.

Non-zero MALLOC_PERTURB_ makes glibc wipe memory value on allocation
and deallocation.  The actual value determines the bit pattern.  Set
it to the value of environment variable EMPIRE_CHECK_MALLOC_PERTURB or
else a pseudo-random number, and record it in sandbox/malloc-perturb.

See mallopt(3) for more information.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-12-05 13:03:08 +01:00
0748a74b5d tests: Rewrite the previous commit's sed_i helper
Last night's version looks unnecessarily ugly in the morning.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-03-04 08:15:13 +01:00
7d249141be tests: Avoid non-portable sed -i
Crept in in commit 7c3186f.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-03-03 20:45:07 +01:00
617b194cef tests: Normalize setup.journal.log and setup.server.log
These logs are saved in the sandbox to help debugging setup.
Normalize them to make them easier to read.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-03-02 08:20:47 +01:00
7c3186f02a tests: New helper customize
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:53:00 +01:00
c594b6120e tests: New helper cmp_out1
Factor out of cmp_out, then make it optionally take an explicit
expected result.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
fed6620a0b tests/files tests/fairland: Check stderr and exit status
New helper run_and_cmp to automate the job: run a program capturing
its standard output, standard error and exit status, then compare the
actual with the expected results.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
e633597854 tests: Fix missing local in feed_files and cmp_out
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
4c92dc36ba tests: Simplify running cmp_out more than once
When cmp_out detects a test failure, it returns non-zero status, which
terminates the test script unless caught.

Accumulate failures in a global variable checked at exit instead, so
running it multiple times in a test script just works.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
cc692142d9 tests: Feed only logs and xdump to normalize.pl
Feeding other test output files (right now tests/files/files.out
tests/fairland/fairland.out fairland/newcap_script) works, but it's
odd, and might not work as well for all future output files.  Only
strip trailing white space there.

There used to be other output files that required normalize.pl: client
output.  Gone since commit 9ca3fa9.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
9f33eb1ba8 tests: Define and use some abbreviations
No functional change.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
c2683e5b58 tests: Save diff -u between expected and actual output
"diff -q" isn't blessed by POSIX anyway.  Neither is -u, but it should
be widely available.  -c is blessed, but I find its output hard to
read.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 13:19:25 +01:00
582ad80d75 Suppress duplicates in output of git ls-files
Happens during merges; can mess up tests badly.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 13:19:24 +01:00
caf239b3ed tests: Zap setup's news and lost items, like telegrams
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 11:51:50 +01:00
370b9d1c07 tests: Don't leak telegram counters from setup into test
Moving the telegram files away isn't enough, we also have to reset
nat_tgms.  actofgod/setup-POGO does it already, but fire/setup-POGO
doesn't.  Do it in begin_test instead, right where the telegram files
are moved away.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 11:44:42 +01:00
6c0a1fcb1e tests: Enable running_test_suite by default
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-19 10:09:17 +01:00
558b4078ff 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>
2014-01-19 10:09:17 +01:00
e444cac552 tests: Run server with -E crash-dump
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-19 10:09:17 +01:00
cf942fbf1b 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>
2014-01-19 10:09:16 +01:00
c82a481bc3 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>
2014-01-19 10:09:16 +01:00
ab913d73f9 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>
2014-01-19 10:09:16 +01:00
d38b685ca3 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>
2014-01-19 10:09:16 +01:00
ca21354d56 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>
2014-01-19 10:09:16 +01:00
4f2b8eea10 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>
2014-01-19 10:08:20 +01:00
8a94f2a8ae tests: Make helper begin_test accept any number of arguments
Zero arguments mean "read the script from stdin", so you can write
begin_test <<EOF...

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:05 +01:00
d0d692e415 tests: New helper function feed_input, for comment support
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>
2014-01-06 20:49:56 +01:00
71cb2d8940 tests: Use only files known to git
Filename expansion can pick up junk files.  Use git-ls-files instead.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:49:45 +01:00
3404b9ce7f tests: Factor out begin_tests(), end_tests()
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:07:22 +01:00
9ca3fa95b8 tests: Capture player output via journal instead of client
Capturing the client's output tests both client and server, which is
nice.  However, player input isn't visible in the resulting file,
which makes it more difficult to understand.

Route player output to journal (econfig key "keep_journal 2"), and
ignore client output.

Separate tests for the client would be useful.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-05-31 10:52:50 +02:00
a835282a3c tests: Enable thread stack checking (emp_server -s)
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-05-31 09:27:09 +02:00
a59e496024 Make smoke test time out instead of hang when server misbehaves
The smoke test waits for the server completing startup by trying to
connect until it works.  Hangs if the server doesn't complete startup
for some reason.  Make it give up after 5s.

Likewise, The smoke test waits for the server to terminate by trying
kill -0 until it fails.  Hangs if the server doesn't terminate.  Make
it give up after 5s.
2013-05-08 06:57:55 +02:00
d161b6d9e4 Factor tests/test-common.sh out of tests/smoke-test
For reuse by future tests.
2013-05-08 06:55:18 +02:00