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>
This commit is contained in:
Markus Armbruster 2016-05-29 19:27:13 +02:00
parent f75d0e10f2
commit 9309670544
16 changed files with 3226 additions and 2929 deletions

View file

@ -27,7 +27,7 @@
# Make.mk: The real Makefile, included by GNUmakefile # Make.mk: The real Makefile, included by GNUmakefile
# #
# Known contributors to this file: # Known contributors to this file:
# Markus Armbruster, 2005-2015 # Markus Armbruster, 2005-2016
# #
# This makefile was inspired by `Recursive Make Considered Harmful', # This makefile was inspired by `Recursive Make Considered Harmful',
@ -260,6 +260,7 @@ ifeq ($(empthread),LWP)
$(srcdir)/tests/torpedo-test $(srcdir) $(srcdir)/tests/torpedo-test $(srcdir)
$(srcdir)/tests/bridgefall-test $(srcdir) $(srcdir)/tests/bridgefall-test $(srcdir)
$(srcdir)/tests/retreat-test $(srcdir) $(srcdir)/tests/retreat-test $(srcdir)
$(srcdir)/tests/version-test $(srcdir)
else else
@echo "$(srcdir)/tests/smoke-test SKIPPED" @echo "$(srcdir)/tests/smoke-test SKIPPED"
@echo "$(srcdir)/tests/actofgod-test SKIPPED" @echo "$(srcdir)/tests/actofgod-test SKIPPED"
@ -269,6 +270,7 @@ else
@echo "$(srcdir)/tests/torpedo-test SKIPPED" @echo "$(srcdir)/tests/torpedo-test SKIPPED"
@echo "$(srcdir)/tests/bridgefall-test SKIPPED" @echo "$(srcdir)/tests/bridgefall-test SKIPPED"
@echo "$(srcdir)/tests/retreat-test SKIPPED" @echo "$(srcdir)/tests/retreat-test SKIPPED"
@echo "$(srcdir)/tests/version-test SKIPPED"
endif endif
$(srcdir)/tests/empdump-test $(srcdir) $(srcdir)/tests/empdump-test $(srcdir)

View file

@ -13,7 +13,13 @@ getopts('js')
die "$0: either -j or -s, not both\n" die "$0: either -j or -s, not both\n"
if $opt_j && $opt_s; if $opt_j && $opt_s;
my $ctime_re = qr/(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [ 123][0-9] [0-2][0-9]:[0-5][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9]/; my $dow_re = qr/(Sun|Mon|Tue|Wed|Thu|Fri|Sat)/;
my $mon_re = qr/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/;
my $tod_re = qr/[0-2][0-9]:[0-5][0-9]:[0-6][0-9]/;
my $year_re = qr/[0-9][0-9][0-9][0-9]/;
my $ctime19_re = qr/$dow_re $mon_re [ 123][0-9] $tod_re/;
my $ctime_re = qr/$dow_re $mon_re [ 123][0-9] $tod_re $year_re/;
my $fmttime2822_re = qr/$dow_re, [0123][0-9] $mon_re $year_re $tod_re [-+][0-9][0-9][0-9][0-9]/;
my $xdfld_re = qr/\([^)]*\)|[^ (][^ ]*/; my $xdfld_re = qr/\([^)]*\)|[^ (][^ ]*/;
# Current dump, if any # Current dump, if any
@ -25,6 +31,8 @@ my $dump = "";
sub norm_ctime { sub norm_ctime {
my ($s) = @_; my ($s) = @_;
$s =~ s/$ctime_re/Thu Jan 1 00:00:00 1970/g; $s =~ s/$ctime_re/Thu Jan 1 00:00:00 1970/g;
$s =~ s/$ctime19_re/Thu Jan 1 00:00:00/g;
$s =~ s/$fmttime2822_re/Thu, 01 Jan 1970 00:00:00 +0000/g;
return $s; return $s;
} }

View file

@ -1,49 +1 @@
xdump meta sect __cmd added -49 0 0
xdump meta ship
xdump meta plane
xdump meta land
xdump meta nuke
xdump meta news
__cmd added -1 0 0
xdump meta trade
xdump meta nat
xdump meta loan
xdump meta commodity
xdump meta lost
xdump meta realm
xdump meta game
xdump meta item
xdump meta product
xdump meta sect-chr
xdump meta ship-chr
xdump meta plane-chr
xdump meta land-chr
xdump meta nuke-chr
xdump meta news-chr
xdump meta infrastructure
xdump meta updates
xdump meta table
xdump meta version
xdump meta meta
xdump meta sector
xdump meta agreement-status
xdump meta land-chr-flags
xdump meta level
xdump meta meta-flags
xdump meta meta-type
xdump meta missions
xdump meta nation-flags
xdump meta nation-rejects
xdump meta nation-relationships
xdump meta nation-status
xdump meta nuke-chr-flags
xdump meta packing
xdump meta page-headings
xdump meta plague-stages
xdump meta plane-chr-flags
xdump meta plane-flags
xdump meta resources
xdump meta retreat-flags
xdump meta ship-chr-flags
__cmd added -1 0 0
xdump meta country

View file

@ -4,52 +4,4 @@ desi 1,-1 +
mov c 0,0 205 uh mov c 0,0 205 uh
desi 1,-1 g desi 1,-1 g
cen * cen *
xdump meta sect __cmd added -49 0 0
xdump meta ship
xdump meta plane
xdump meta land
xdump meta nuke
xdump meta news
__cmd added -1 0 0
xdump meta trade
xdump meta nat
xdump meta loan
xdump meta commodity
xdump meta lost
xdump meta realm
xdump meta game
xdump meta item
xdump meta product
xdump meta sect-chr
xdump meta ship-chr
xdump meta plane-chr
xdump meta land-chr
xdump meta nuke-chr
xdump meta news-chr
xdump meta infrastructure
xdump meta updates
xdump meta table
xdump meta version
xdump meta meta
xdump meta sector
xdump meta agreement-status
xdump meta land-chr-flags
xdump meta level
xdump meta meta-flags
xdump meta meta-type
xdump meta missions
xdump meta nation-flags
xdump meta nation-rejects
xdump meta nation-relationships
xdump meta nation-status
xdump meta nuke-chr-flags
xdump meta packing
xdump meta page-headings
xdump meta plague-stages
xdump meta plane-chr-flags
xdump meta plane-flags
xdump meta resources
xdump meta retreat-flags
xdump meta ship-chr-flags
__cmd added -1 0 0
xdump meta country

View file

@ -12,38 +12,5 @@ xdump commodity *
xdump lost * xdump lost *
xdump realm 0 xdump realm 0
xdump game * xdump game *
xdump item * __cmd added -34 0 0
xdump product *
xdump sect-chr *
xdump ship-chr *
xdump plane-chr *
xdump land-chr *
xdump nuke-chr *
xdump news-chr *
xdump infrastructure *
xdump updates *
xdump table *
xdump version *
xdump meta *
xdump sector *
xdump agreement-status *
xdump land-chr-flags *
xdump level *
xdump meta-flags *
xdump meta-type *
xdump missions *
xdump nation-flags *
xdump nation-rejects *
xdump nation-relationships *
xdump nation-status *
xdump nuke-chr-flags *
xdump packing *
xdump page-headings *
xdump plague-stages *
xdump plane-chr-flags *
xdump plane-flags *
xdump resources *
xdump retreat-flags *
xdump ship-chr-flags *
__cmd added -1 0 0
xdump country * xdump country *

View file

@ -12,38 +12,5 @@ xdump commodity *
xdump lost * xdump lost *
xdump realm * xdump realm *
xdump game * xdump game *
xdump item * __cmd added -34 0 0
xdump product *
xdump sect-chr *
xdump ship-chr *
xdump plane-chr *
xdump land-chr *
xdump nuke-chr *
xdump news-chr *
xdump infrastructure *
xdump updates *
xdump table *
xdump version *
xdump meta *
xdump sector *
xdump agreement-status *
xdump land-chr-flags *
xdump level *
xdump meta-flags *
xdump meta-type *
xdump missions *
xdump nation-flags *
xdump nation-rejects *
xdump nation-relationships *
xdump nation-status *
xdump nuke-chr-flags *
xdump packing *
xdump page-headings *
xdump plague-stages *
xdump plane-chr-flags *
xdump plane-flags *
xdump resources *
xdump retreat-flags *
xdump ship-chr-flags *
__cmd added -1 0 0
xdump country * xdump country *

File diff suppressed because it is too large Load diff

View file

@ -84,6 +84,9 @@ customize()
copy_tables sect copy_tables sect
sed_i '/"c" .* norm/d;/^#.*"c" .* cana/s/^#/ /' sandbox/etc/empire/sect.config sed_i '/"c" .* norm/d;/^#.*"c" .* cana/s/^#/ /' sandbox/etc/empire/sect.config
;; ;;
trade-ship)
copy_tables ship
sed_i '/"ts trade ship"//^#/ /' sandbox/etc/empire/ship.config
esac esac
done done
echo "custom_tables \"`cd sandbox/etc/empire && echo *.config`\"" >>$econfig echo "custom_tables \"`cd sandbox/etc/empire && echo *.config`\"" >>$econfig

38
tests/version-test Executable file
View file

@ -0,0 +1,38 @@
#!/bin/sh -e
# version test for Empire
if [ $# -ne 1 ]
then echo "Usage: $0 SRCDIR" >&2; exit 1
fi
srcdir="$1"
. "$srcdir"/tests/test-common.sh
create_sandbox
begin_test "$srcdir"/tests/version/setup-POGO
feed_dir "$srcdir"/tests/version/default
stop_server
cat >>$econfig <<EOF
ALL_BLEED 0
MARKET 1
MOB_ACCESS 1
RES_POP 1
game_days "Su Mo Tu We Th Fr Sa"
game_hours "00:00-24:00"
tech_log_base 0
EOF
customize big-city
# TODO cover drnuke_const 0.33
start_server
feed_dir "$srcdir"/tests/version/fancy
end_test
cmp_out var/empire/server.log var/empire/journal.log

View file

@ -0,0 +1,105 @@
version
show sect b
show sect c
show sect s
show ship b
show ship c
show ship s
show plan b
show plan c
show plan s
show land b
show land c
show land s
show nuke b
show nuke c
show nuke s
show bridge
show tower
show item
show updates
xdump meta 0
xdump meta 1
xdump meta 2
xdump meta 3
xdump meta 4
xdump meta 5
xdump meta 6
xdump meta 7
xdump meta 8
xdump meta 9
xdump meta 10
xdump meta 11
xdump meta 12
xdump meta 13
xdump meta 14
xdump meta 15
xdump meta 16
xdump meta 17
xdump meta 18
xdump meta 19
xdump meta 20
xdump meta 21
xdump meta 22
xdump meta 23
xdump meta 24
xdump meta 25
xdump meta 26
xdump meta 27
xdump meta 28
xdump meta 29
xdump meta 30
xdump meta 31
xdump meta 32
xdump meta 33
xdump meta 34
xdump meta 35
xdump meta 36
xdump meta 37
xdump meta 38
xdump meta 39
xdump meta 40
xdump meta 41
xdump meta 42
xdump meta 43
xdump meta 44
xdump meta 45
xdump meta 46
xdump meta 47
xdump meta 48
xdump meta 49
xdump meta 50
| xdump of game state is in smoke test
xdump item *
xdump product *
xdump sect-chr *
xdump ship-chr *
xdump plane-chr *
xdump land-chr *
xdump nuke-chr *
xdump news-chr *
xdump infrastructure *
xdump updates *
xdump table *
xdump version *
xdump meta *
xdump agreement-status *
xdump land-chr-flags *
xdump level *
xdump meta-flags *
xdump meta-type *
xdump missions *
xdump nation-flags *
xdump nation-rejects *
xdump nation-relationships *
xdump nation-status *
xdump nuke-chr-flags *
xdump packing *
xdump page-headings *
xdump plague-stages *
xdump plane-chr-flags *
xdump plane-flags *
xdump resources *
xdump retreat-flags *
xdump sector-navigation *
xdump ship-chr-flags *

View file

@ -0,0 +1,40 @@
show s b
toggle techlists
show s b
xdump meta game
xdump meta nat
xdump meta cou
| xdump of game state is in smoke test
xdump item *
xdump product *
xdump sect-chr *
xdump ship-chr *
xdump plane-chr *
xdump land-chr *
xdump nuke-chr *
xdump news-chr *
xdump infrastructure *
xdump updates *
xdump table *
xdump version *
xdump meta *
xdump sector-navigation *
xdump agreement-status *
xdump land-chr-flags *
xdump level *
xdump meta-flags *
xdump meta-type *
xdump missions *
xdump nation-flags *
xdump nation-rejects *
xdump nation-relationships *
xdump nation-status *
xdump nuke-chr-flags *
xdump packing *
xdump page-headings *
xdump plague-stages *
xdump plane-chr-flags *
xdump plane-flags *
xdump resources *
xdump retreat-flags *
xdump ship-chr-flags *

View file

@ -0,0 +1 @@
version

2
tests/version/fancy/01-1 Normal file
View file

@ -0,0 +1,2 @@
version
show sect s

2980
tests/version/journal.log Normal file

File diff suppressed because it is too large Load diff

34
tests/version/server.log Normal file
View file

@ -0,0 +1,34 @@
------------------------------------------------------
Empire server (pid 42) started
Configured for testing
Update schedule read
No update scheduled
Listening on 127.0.0.1
Connect from 127.0.0.1
Connect from 127.0.0.1
tester@127.0.0.1 using country #0
tester@127.0.0.1 logged in as country #0
tester@127.0.0.1 logged out, country #0
Connect from 127.0.0.1
tester@127.0.0.1 using country #1
tester@127.0.0.1 logged in as country #1
tester@127.0.0.1 logged out, country #1
Connect from 127.0.0.1
tester@127.0.0.1 using country #2
tester@127.0.0.1 logged in as country #2
tester@127.0.0.1 logged out, country #2
Shutdown commencing (cleaning up threads.)
Server shutting down on signal 15
------------------------------------------------------
Empire server (pid 42) started
Configured for testing
Update schedule read
No update scheduled
Listening on 127.0.0.1
Connect from 127.0.0.1
Connect from 127.0.0.1
tester@127.0.0.1 using country #1
tester@127.0.0.1 logged in as country #1
tester@127.0.0.1 logged out, country #1
Shutdown commencing (cleaning up threads.)
Server shutting down on signal 15

3
tests/version/setup-POGO Normal file
View file

@ -0,0 +1,3 @@
add 1 1 1 p
edit c 1 T 100
add 2 v v v