Commit graph

160 commits

Author SHA1 Message Date
Ron Koenderink
8447fc1cd2 w32: Provide getopt() for Visual Studio
getopt() does not exist in the Visual Studio 2019 CRT.  Provide one.

Signed-off-by: Ron Koenderink <rkoenderink@gmail.com
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-02-13 19:25:18 +01:00
06487a46a3 Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-23 08:39:13 +01:00
55c1d29efe Make: Use SHELL to run test scripts, since /bin/sh may suck
The test scripts need a POSIX-compliant Bourne shell.  /bin/sh isn't
on some systems, such as Solaris.  Run them with $(SHELL).

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-23 07:08:21 +01:00
18e392c470 Make: Slighly less verbose "make check" output
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-23 07:08:21 +01:00
168db3b248 Make: Fix build with tool chains that require depcomp
Commit fad8e7f7b "Move auxiliary build tools to build-aux/" moved
depcomp, but neglected to adjust Make.mk.  This broke the build with
tool chains that actually use depcomp.  Modern GCC and Clang don't.
Fix the obvious way.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-23 07:08:03 +01:00
4a1ec06364 Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-05 10:41:28 +01:00
68945c8ff8 tests/load-tend: New; exercises load and tend commands
Exercise load, unload, lload, lunload, tend, and ltend.

Notable coverage gaps:

* Effect on land unit fortification

* Effect on mission and retreat orders

* Ships, land units and planes on sale (option MARKET 1)

* Transmission of plague (option NO_PLAGUE 0)

* Land units loading and unloading civilians (need a custom land unit
  type capable of carrying civilians)

* load refusing to load x-light planes (need a custom ship type that
  can carry helo but not x-light)

* load and lload refusing to load land units carrying land units, and
  lload refusing to load land units onto land units that are being
  carried (need a custom non-heavy land unit type that can carry land
  units)

* tend refusing to tend non-light land units to non-supply ships, or
  to supply ships without room (need custom a non-light assault land
  unit type)

This test exposes bugs.  They're marked "BUG:" in the test input.
There are also oddities marked "odd:", and usability issues marked
"usability:".

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2021-01-05 07:25:15 +01:00
d111522fe8 Update copyright notice
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2018-04-29 10:33:19 +02:00
5e1b590867 Make: Support shallow git clones for testing
Since commit 1ec9b94, we derive the version number from git tags with
build-aux/git-version-gen.  When a shallow clone doesn't include a
suitable tag, this fails, and make refuses to build anything.  Since
Travis uses git-clone --depth=50, it'll break as soon as we've got
more than 50 commits since the last release.

Support arbitrarily shallow clones for limited purposes like testing
by falling back from a proper V.N-H version number to UNKNOWN-H.

To guard against use of such builds for other purposes, log a warning
on server startup, and print one on player login.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-09-02 17:51:37 +02:00
ece998e064 configure: Fix .tarball-version access from separate build tree
configure reads .tarball-version when the source tree isn't
git-controlled.  Fails when the build tree is separate.  Fix it to
read $srcdir/.tarball-version.

The occurence in Make.mk isn't wrong, because VPATH applies there.
Change it anyway, for consistency and a bit of extra robustness.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-09-02 15:00:14 +02:00
10ddaca6b1 Make: Fix configure generated for dist-client
Commit 1ec9b94 broke regeneration of configure for dist-client: it
uses .tarball-version, which exists only in the tarball, not in the
source tree.

Generating the client's autoconf stuff into the source tree is a
questionable idea anyway, as it won't run there.  Generate it while
building the tarball instead.

Bonus: doesn't distribute a useless .dirty-stamp.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-13 14:31:07 +02:00
63c6dd6896 Make: Move .tarball-version generation out of src/scripts/tarball
Commit 1ec9b94 made src/scripts/tarball generate .tarball-version and
.dirty-stamp.  Hardcoding it like that there is a bit ugly.

Move it into a separate tweak script that is run right before tar.
We'll tweak some more in the next commits.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-13 14:00:16 +02:00
5f59699cfd Make: Fix "make dist" to remake stale files in $(srcdir)
Broken in commit bb0f3a6.  VPATH claims another victim.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-12 10:13:29 +02:00
3872604ce0 Make: Fix distclean for separate build tree
Fix removal of autoconf-generated files in src/client/.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-07 09:38:32 +02:00
afe5001a23 Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-07 09:38:32 +02:00
d3a64a4f6e Merge branch 'readline' 2017-08-07 09:37:44 +02:00
1ec9b94f74 configure Make: More detailed version information
Version information is in output of commands version, xdump version,
and in program output for option -v.  Looks like this:

    Wolfpack Empire 4.3.33

The version number is defined in configure.ac, and incremented
manually.  It identifies only the base release (here: 4.3.33).  Fine
when this is an unmodified released version.  Pretty much useless
during development.

Add a suffix to the version number that describes it further:

    V               Unmodified release V (same as before)
    V.N-H           Modified release built from a clean git tree
                    N is the number of additional commits, and
                    H is the abbreviated commit hash
    V.N-H-dirty     Same, but the working tree is dirty
    V-dirty         Modified release built from a tarball

A git tree is clean when the contents of its files are unchanged.
Changing only the their timestamps doesn't count.  It does count when
building from a tarball, because tracking contents isn't implemented
there.

Also use this suffixed version for tarball names.

The version reported by configure is fixed at configure generation
time, i.e. it is usually out of date during development.  Ensuring a
release tarball contains one with a current version is manual for now.
Running autoconf -f should do the trick.

Elsewhere, the version is determined at build time, so it is always
current.

Dirty tracking isn't implemented in the standalone client build.  If
you start with a clean tarball, the version will not change from V to
V-dirty when you build with modifications.

Steal build-aux/git-version-gen from autoconf 2.69 to help with
computing the version string.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
bb0f3a656e Make: Tidy up distribution and cleaning of generated makefiles
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
88698d73c7 Make: Drop $(ttop), use its value directly
info/TOP.t is easier to understand than $(ttop).

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 20:09:17 +02:00
14af586b57 tests/update: New; exercises the update
Notable gaps in its coverage are fallout, most of guerrilla, delivery,
distribution, ALL_BLEED and LOSE_CONTACT.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 14:04:15 +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
a0220e864f client: Use fnameat() to construct history file name
We truncate the user's home directory name to 1000 characters when
constructing the history file name.  Use fnameat() to fix that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 11:22:30 +02:00
1cbda2c7dd client: Rewrite readline configuration
AX_LIB_READLINE tries to cope with systems where readline lacks
history support, or lacks headers, or needs headers included in
unorthodox ways.  It puts six HAVE_ macros into config.h, and its
usage example takes 24 lines of code just to include two headers.

Way too complicated for my taste.  Replace with new MY_LIB_READLINE,
which succeeds only when you have a sane readline, and then defines
*one* macro: HAVE_LIBREADLINE.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 11:22:29 +02:00
Martin Haukeli
f1fc0df03d client: Add readline support to empire client
Readline provides fancy command line editing such as <Arrow Up> for
previous commands and CTRL+A to jump to the beginning of the line.

This patch does not add any completion on <tab> key, a TODO, if you
will.

A new command line flag, -H, turns on saving the history to disk.
This may have security implications on shared computers, as all
commands are saved as-is.  Thus "change re 1234" would be logged
directly to the file.

Signed-off-by: Martin Haukeli <martin.haukeli@gmail.com>

Rebase on top of preparatory work, fix a few bugs, and tidy up:

* Update the standalone client build, too.

* Fix the Windows build.

* Keep command line options sorted case-insensitively.

* Error out when $HOME is unset and getpwuid() fails, just like we do
  for $LOGNAME.

* Give @input_from_rl, @has_rl_input static linkage.

* @has_rl_input is a flag, not a counter, set and test it accordingly.

* Save all input in history, not just commands.  Martin's attempt to
  recognize commands works only as long as the server sends prompts
  faster than the user sends input.  Drop that part, and update commit
  message accordingly.

* Fix recv_input() not to truncate value of strlen() to int, and to
  use memmove() for updating @input_from_rl in place.

* Clean up whitespace in a few places.

* Tweak commit message.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-08-06 11:22:29 +02:00
bae3f5447e Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2017-07-02 17:45:44 +02:00
23373d01d9 configure: Test compiler flags
When AC_PROG_CC detects GCC, Make.mk adds a bunch of flags to CFLAGS.
Works only for flags that any version of gcc in use accepts.

Instead, make configure add the flags that actually work to CFLAGS.
This will let us add flags that work only for some compilers.

The new autoconf macros are from autoconf-archive v2015.02.24.

Unfortunately, AX_APPEND_COMPILE_FLAGS doesn't work reliably for
-Wno-*: gcc complains about unknown -Wno-foo only when other
diagnostics are being produced.  Test -Wfoo instead of -Wno-foo, and
rename to MY_APPEND_COMPILE_FLAGS.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-11-22 10:23:54 +01:00
695352d9d3 tests/torpedo: New; exercises torpedo command
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-03-02 08:20:52 +01:00
b14f5276ab Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-28 16:21:34 +01:00
56ac486cc8 tests/navi-march: New; exercises navigate and march command
Does not cover scattered navigate and march, RAILWAYS 0, enemy action
while sitting at the prompt, and interdiction.

The test exposes bugs.  They're marked "BUG:" in the test input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:53:01 +01:00
5a1544f925 tests/empdump: New; exercising the empdump utility
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-02-01 16:52:59 +01:00
da400d4fe7 Remove superfluous override directive in make check
Travis CI and OS X system make on 10.9.x at least don't have GNU make
>=3.82 which contains a parser enhancement that allows multiple
directives.

Signed-off-by: Gerd Flaig <gefla@pond.sub.org>

Here's why removing override is a good idea.  The variable assignment
should already override anything Make may find in its environment.
All "override" does is protect against unwise make arguments.

"info make" says:

    The `override' directive was not invented for escalation in the war
    between makefiles and command arguments.  It was invented so you can
    alter and add to values that the user specifies with command
    arguments.

Thus, override is ill-advised here.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2015-01-14 19:01:40 +01:00
58cd269bed tests/retreat: New; exercising retreat
Does not cover land unit retreat after a failed morale check.

The test exposes bugs.  They're marked "BUG:" in the test input.

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
21b8add73e tests/bridgefall: New; exercising splashing of bridges
Stuff sitting on bridges isn't covered, yet.  tests/fire has some.  To
be moved here eventually.

The test exposes bugs.  They're marked "BUG:" in the test input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 11:51:50 +01:00
cdfcc1a165 tests/build: New; exercises build command
drnuke_const is not covered, yet.

Random rounding causes some complications: sometimes build succeeds
without materials.  Troublesome spots are clearly marked in the test
input.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-02-16 11:44:42 +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
4dd38ddfe5 tests/fire: New; exercises fire command
Return fire not covered, yet.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:06 +01:00
90eaf9d9eb tests/info: New; checks info and code agree on commands
Replaces info/checklist.pl, which has been broken since
commit 56d9445, v4.3.0.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:06 +01:00
0a702949db info/toc: New; generated machine-readable table of contents
Next commit will put it to use.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:06 +01:00
e0668ff294 info: Nicer remaking of info subject index pages
Give quiet-command a more useful last argument.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-06 20:50:05 +01:00
bb467c335d Update copyright notice
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2014-01-02 14:33:48 +01:00
78d28c90ad uninstall: Fix to remove everything installed under $(datadir)
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>
2014-01-02 14:07:22 +01:00
e1273ae4ca install: Remove stale formatted info pages
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>
2014-01-02 14:07:10 +01:00
d743a38257 tests/actofgod: Disable in "make check" unless LWP
Expected to work only with thread package LWP, just like the smoke
test.  Commit 7a91041 carelessly enabled it for all thread packages.
Revert, except with LWP.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-06-09 16:58:08 +02:00
7a9104164f tests/actofgod: Enable in "make check"
The showstopper bugs have been fixed.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-06-06 19:55:02 +02:00
aa870f5d91 tests/actofgod: New, disabled for now because it oopses
This is a fairly comprehensive test of the deity commands to edit game
state: edit, setresource, setsector, give, swapsector.

The test makes edit screw up game state, triggering oopses.  The
server refuses to start without -F then, and empdump -x warns "export
has errors, not importable as is".  Until these bugs are fixed, skip
this test in "make check".

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-06-06 19:52:20 +02:00
04da480e02 make: Drop unused support for parallel test runs
Tests can't run in parallel anyway, because they use uses a single
sandbox directory and a single TCP port.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
2013-06-01 12:46:06 +02:00
59a199c69d Don't put broken links in HTML info pages
Pass the valid info page names to emp2html.pl, and convert only valid
references to links there.
2013-05-12 18:53:02 +02:00
955bdeb223 Fold subj2html.pl into emp2html.pl 2013-05-11 16:04:11 +02:00
fded50a09c Refresh autoconf macros from autoconf-archive-2013.04.06 2013-05-08 14:35:04 +02:00