Skip to content

Commit

Permalink
try location error 22 cause (#1027)
Browse files Browse the repository at this point in the history
* narrow down failing test'

* on failure, print the filename
  • Loading branch information
ennorehling committed Nov 27, 2023
1 parent 66b7b13 commit 2ce1b8e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ Thumbs.db
*.cfg
*.cmd
tmp/
tests/orders.txt
tests/config.lua
/tests/reports
/tests/data
/quicklist
/cutest
/critbit
Expand Down
6 changes: 6 additions & 0 deletions scripts/tests/e2/report.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function test_coordinates_unnamed_plane()
local f = faction.create("human", "[email protected]", "de")
local u = unit.create(f, r, 1)
init_reports()
f.id = 1
write_report(f)
assert_true(find_in_report(f, r.name .. " %(0,0%), Berg"))
remove_report(f)
Expand All @@ -49,6 +50,7 @@ function test_coordinates_no_plane()
local f = faction.create("human", "[email protected]", "de")
local u = unit.create(f, r, 1)
init_reports()
f.id = 2
write_report(f)
assert_true(find_in_report(f, r.name .. " %(0,0%), Berg"))
remove_report(f)
Expand All @@ -63,6 +65,7 @@ function test_show_shadowmaster_attacks()
u:add_order("ZEIGE Schattenmeister")
process_orders()
init_reports()
f.id = 3
write_report(f)
assert_false(find_in_report(f, ", ,"))
remove_report(f)
Expand All @@ -74,6 +77,7 @@ function test_coordinates_named_plane()
local f = faction.create("human", "[email protected]", "de")
local u = unit.create(f, r, 1)
init_reports()
f.id = 4
write_report(f)
assert_true(find_in_report(f, r.name .. " %(0,0,Hell%), Berg"))
remove_report(f)
Expand All @@ -85,6 +89,7 @@ function test_coordinates_noname_plane()
local f = faction.create("human", "[email protected]", "de")
local u = unit.create(f, r, 1)
init_reports()
f.id = 5
write_report(f)
assert_true(find_in_report(f, r.name .. " %(0,0%), Berg"))
remove_report(f)
Expand All @@ -110,6 +115,7 @@ function test_lighthouse()
assert_not_nil(b)

init_reports()
f.id = 6
write_report(f)
assert_false(find_in_report(f, "The Babadook"))
assert_true(find_in_report(f, " %(1,0%) %(vom Turm erblickt%)"))
Expand Down
1 change: 1 addition & 0 deletions scripts/tests/e3/items.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function test_water_of_life()
trees = r:get_resource('tree')-trees
if trees~=5 then
init_reports()
f.id = atoi36('tree')
write_report(f)
print(f, get_turn())
end
Expand Down
1 change: 0 additions & 1 deletion src/gmtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

static int g_quit;
int force_color = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/reports.c
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,7 @@ int write_reports(faction * f, int options, const char *password)
}
if (errno) {
error = errno;
log_fatal("error %d during %s report for faction %s: %s", errno, rtype->extension, factionname(f), strerror(error));
log_fatal("error %d writing report %s for faction %s: %s", errno, filename, factionname(f), strerror(error));
errno = 0;
}
} while (error);
Expand Down

0 comments on commit 2ce1b8e

Please sign in to comment.