Commit graph

4415 commits

Author SHA1 Message Date
b54380938c Remove fairland from smoke test
Import xdump instead.  To decouple the smoke test from future fairland
changes that result in different worlds.
2013-05-08 06:55:19 +02:00
ed8eead0ba Add fairland test to make check 2013-05-08 06:55:18 +02:00
4dd0720fc0 Add files test to make check 2013-05-08 06:55:18 +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
108c9408dc Make smoke test check the final empdump -x 2013-05-08 06:55:18 +02:00
56a9d46ab1 Get rid of shell boilerplate in smoke test Empire batch files 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
2fefdaed15 Don't put file descriptor values in thread names
The names are logged.  Loging file descriptor values gets in the way
of regression testing, such as the smoke test that'll be committed
shortly.
2013-01-12 17:57:42 +01:00
d794738fd8 Don't log threads initialization 2013-01-12 17:57:42 +01:00
d068259487 Simplify lnd_take_casualty()'s land unit retreat code
Bonus: avoids "may be used uninitialized" compiler warnings (the code
was safe despite the warning).
2013-01-12 17:56:39 +01:00
3a7d7fa866 Really fix accepting connections from "long" IPv6 address
Commit ee01ac19 (v4.3.23) enlarged player member hostaddr from 32 to
46 characters, but missed natstr member nat_hostaddr.  player_main()
copies hostaddr to nat_hostaddr.  Can overrun the destination, but
fortunately just into nat_hostname.

Impact:

* Can makes praddr() print only a suffix of the address.  Used by play
  command, for player messages during login and logout, and for
  logging.

* Can make player_main()'s test for "same address as last time" fail,
  causing extra "Last connection" messages.

* Matching against econfig key privip is not affected.

* Journal event login is not affected.
2013-01-12 17:56:39 +01:00
75619c3732 Simplify head_meanwhile()
No functional change.
2013-01-12 17:56:39 +01:00
bcff368909 Take ship cost into account when picking missile interdiction target
Due to a typo, shp_missile_interdiction() picks the admissible target
with highest efficiency instead of the one with highest efficiency *
build cost.

Broken in commit cd8d7423, v4.3.8.
2013-01-12 17:56:39 +01:00
bfea79a72d Really fix setsector and setres not to wipe out concurrent updates
setsector() and setres() continue after check_sect_ok() fails.
Clobbers the updates that made check_sect_ok() fail, triggering a
seqno mismatch oops.

Commit 04a332a8 (v4.3.27) claimed to fix this, but actually only
suppressed the generation oops.
2013-01-12 17:56:34 +01:00
c4c4413ea5 Really fix give not to wipe out concurrent updates
give() continues after check_sect_ok() fails.  Clobbers the updates
that made check_sect_ok() fail, triggering a seqno mismatch oops.

Commit b58c37e2 (v4.3.27) claimed to fix this, but actually only
suppressed the generation oops.
2013-01-12 17:56:26 +01:00
efa4ecdc4d Drop resnoise()'s second parameter
All callers pass the same argument.
2013-01-12 17:56:26 +01:00
eb4adc93ff Fix setsector not to disclose number of landmines to occupier
When the deity sets the number of mines with setsector, the sector
owner (if any) is told the resulting number of mines.  Even for
occupied sectors, where mines belong to the old owner, and thus
shouldn't be disclosed.  Oops.

Fix setsector not to tell the sector owner anything then.
2013-01-12 17:56:26 +01:00
6fbc291272 anti, give, grind take <SECTS> argument, fix their documentation 2013-01-12 17:56:26 +01:00
f2e5e467c0 Make capital fail more nicely when sector is unsuitable
The command fails without an explanation then.  Change it to print
something like "X,Y is not a capital or mountain owned by you."
2013-01-12 17:56:26 +01:00
3783652d7a Change capital to take a single sector as argument
Capital takes a <SECTS> argument, and picks the first suitable sector
it finds there.  It fails if none can be found, or if the first one
found already is the capital (even when more suitable sectors follow).
Has always worked that way, but never documented.

I don't think the search feature is really useful, and documenting it
isn't worth my while.  Change the command to take a <SECT> argument
instead, as documented.
2013-01-12 17:51:22 +01:00
df4925d696 Update copyright notice 2013-01-12 17:45:01 +01:00
c300dc7055 Change GODNEWS reports not to affect headlines and relations
Option GODNEWS controls news reports give's N_GIFT, N_TAKE, and edit's
and setsector's N_AIDS, N_HURTS.

They affect news headlines because of their non-zero r_good_will.
N_TAKE and N_HURTS can downgrade relations because of their negative
r_good_will.  All tolerable, except N_TAKE has actor and victim
reverted: the deity running the give command is the victim, and the
sector owner is the actor.  Because of that, give with a negative
amount downgrades the deity's relations towards the sector owner.
Inappropriate.

Has always been that way.  Chainsaw disabled these news at
compile-time; to enable you had to define GODNEWS (not documented
anywhere).  Empire 4.2.0 made GODNEWS a proper option, enabled by
default.

Fix by setting their r_good_will to zero.
2012-08-12 09:36:07 +02:00
0f1e14f0f3 Fix flying commands for destination equal to assembly point
bomb, drop, fly, paradrop, recon and sweep fail when given a
destination sector equal to the assembly point.  Broken in commit
404a76f7, v4.3.27.  Reported by Tom Johnson.

Before that commit, getpath() returned NULL on error, "" when input is
an empty path, "h" when it's coordinates of the assembly point, and a
non-empty path otherwise.

The commit accidentally changed it to return "" instead of "h".

Instead of changing it back, make it return NULL when input is an
empty path, and change bomb() & friends to accept empty flight paths.

This also affects sail: it now fails when you give it an empty path,
just like bomb & friends.  Path "h" still works.
2012-08-12 09:34:49 +02:00
9645a73bfb Fix portability bug in configure test for Windows API
The test uses an erroneous non-directive within #ifdef _WIN32 to
signal that _WIN32 is defined.  Some compilers choke on this even when
_WIN32 isn't defined.  Observed with FreeBSD 4.10's gcc 2.95.4.
Broken in commit c02468fd, v4.3.22.  Standaline client build already
broken in commit 774b590f, v4.3.17.

Use an unmatched brace instead.
2012-08-11 15:36:56 +02:00
3e3c2eecf9 Polish empthread documentation somewhat 2012-08-05 09:26:32 +02:00
efc3a8e6e2 Open journal before daemonizing, so we can fail in foreground
Just like we open server.log.  Also permits calling journal_prng()
right where we seed the PRNG.
2012-08-05 09:26:08 +02:00
fc64b4fa83 Permit empth_self() before empth_init()
Next commit wants this.
2012-08-05 09:24:57 +02:00
3d7383c548 Fix headline pasto in info lookout
Already present in BSD Empire 1.1.  Reported by Harald Katzer.
2012-08-04 12:11:55 +02:00
30dbd609bc Forbid selling conquered populace
Only relevant when the deity allows selling civilians by customizing
table item, which is probably a bad idea.
2012-07-13 20:15:34 +02:00
324109ae45 Forbid selling units with unsalable cargo, permit selling military
Deities can customize which commodities can be sold in table item.
Default is to allow anything but civilians and military.  However,
this applies only to the commodity market, not to the unit market:
cargo of ships and land units is not restricted.

Make the two markets consistent: permit selling military by default,
forbid selling units carrying unsalable commodities.  This outlaws
selling units carrying civilians by default.
2012-07-13 20:15:34 +02:00
6c086a8110 Drop trade_desc()'s first argument 2012-07-13 20:15:34 +02:00
4f3d6792e3 Drop unclean assignments in trade_desc()
Assigning to tp->trd_owner is unclean.  Can be dropped safely, because
it has no effect: prior check_trade() drops all trades where the
assignment would change anything.
2012-07-13 20:15:34 +02:00
d9cafc156c Clean up use of union empobj_storage * as parameter type
Use it only for functions that assign objects through a pointer
parameter.  Anything else can and should use struct empobj *.
2012-07-13 20:15:33 +02:00
f75544ee70 Replace trade_check_item_ok() by check_obj_ok()
Relaxes the sanity check of the argument's ef_type.  Could be avoided,
but not worth the bother.
2012-07-13 20:15:33 +02:00
29f6d10a34 Factor check_obj_ok() out of the check_*_ok() 2012-07-13 20:15:33 +02:00
e25ff14f0c New ef_nameof_pretty() 2012-07-13 20:15:33 +02:00
4072098c32 Drop obj_changed() parameter sz
Get size from empfile[] instead.
2012-07-13 20:15:33 +02:00
9728e68a42 Fix obj_changed() to check object exists
Relatively harmless, because these kinds of objects don't go away.
2012-07-13 20:15:33 +02:00
b0fc3f43d4 Scrapping ships and land units now spreads the plague 2012-07-13 20:15:33 +02:00
3d3d272eef Don't let scrap give away civilians
Scrapping unloads everything.  Even stuff that unload can't: foreign
civilians.  Kill them off instead, like scuttle does.
2012-07-13 20:15:33 +02:00
612ec6257d Pilots and air cargo now spread the plague
Planes flying one-way with crew or cargo spread plague from their old
base to their new base.  Planes dropping cargo spread plague from
their base to the drop's target sector.
2012-07-13 20:15:33 +02:00
a8739d86e3 Clarify info Plague slightly 2012-07-13 20:15:33 +02:00
bad2fd5aac Streamline plist initialization
msl_equip(), find_escorts() and perform_mission() memset() the plist,
then assign to all members but load.  Just zero load instead, like
getilists(), msl_sel() and pln_sel() do.
2012-07-13 20:15:33 +02:00
48f3d1c033 Initialize struct plist member queue properly in msl_equip()
Harmless, because queue isn't actually used.  Clean it up anyway.
2012-07-13 20:15:33 +02:00
154f04f218 scripts: Use mailx rather than mail, and drop bogus -e 2012-07-13 20:15:33 +02:00
729cf65e12 Don't let fly and drop give away civilians
Flying them to a foreign destination magically changes their
allegiance.  Prohibit that.

Equivalent change was already in commit 35887222 (v4.2.17) but got
reverted immediately (commit 20199b22), because fly and drop should
stay consistent with load, which let you give away civilians then.  No
more since commit 92a366ce (v4.3.20).  This change makes fly and drop
consistent with load again.
2012-07-13 20:15:33 +02:00
b4acb73fd1 Replace pln_oneway_to_carrier_ok() by pln_can_land_on_carrier()
Avoids reading the target ship again.
2012-07-13 20:15:33 +02:00
d9a915a05b Replace pln_onewaymission() by pln_where_to_land()
New function reads and returns target sector/ship.  Avoids reading the
target sector unnecessarily.  Callers receive the target ship, not
just its number.  Next commit will put it to use.
2012-07-13 20:14:10 +02:00
41b2fa433f Fix fly to permit flying civs to a carrier in an occupied sector
Broken in commit 35887222, v4.2.17.
2012-07-12 19:52:33 +02:00
72f1e22b95 Drop could_be_on_ship()'s load count parameters
Just one caller wants them.  Inline that call, and simplify the
others.
2012-07-12 19:52:33 +02:00