59 Commits

Author SHA1 Message Date
Celtic Minstrel
9535ed926c run_wml_tests: Fix off-by-one error in 1285060bc480b8568f6312ff2753a0645ebd0187 2021-04-15 23:23:48 -04:00
Celtic Minstrel
1285060bc4 run_wml_tests: Ensure the name of a failing test is included in the output
Previously, the runner relied on the name being part of the output log from the Wesnoth process.
This works in most cases because Wesnoth prints a line with the test's name before exiting.
However, if the test timed out, that line would typically be missing, so this makes the runner insert it into the failure message as well to make sure it's present.
2021-04-15 00:10:45 -04:00
Celtic Minstrel
99384b038c run_wml_tests: Don't crash if a test crashes 2021-04-15 00:10:34 -04:00
Celtic Minstrel
1273aba5d8 run_wml_tests: Drastically reduce output when run without -v
It now ONLY outputs failures and the summary; tests that passed are not even mentioned
2021-04-07 20:41:37 -04:00
Celtic Minstrel
942743eb78
run_wml_tests: Fix indentation 2021-04-04 10:44:26 -04:00
Celtic Minstrel
a755788392 run_wml_tests: Skip tests that expect strict validation failure if log-strict is disabled 2021-04-04 00:58:48 -04:00
Celtic Minstrel
099414ed1e run_wml_tests: Don't append to the provided path if it's not a directory
This allows passing an explicit path on Mac (instead of using the automatic -p xcode option), since the binary is not named "wesnoth" on that platform.
2021-04-04 00:58:42 -04:00
Celtic Minstrel
adc8dd492c run_wml_tests: make sure the fake timed-out process has an output stream even if it's empty 2021-03-13 20:49:26 -05:00
Celtic Minstrel
f382eefc33 run_wml_tests: fix Mac binary detection magic 2021-03-13 20:49:26 -05:00
Celtic Minstrel
208a347dba run_wml_tests: --batch-disable is a special case of --batch-max so implement it as such 2021-03-13 20:49:26 -05:00
Celtic Minstrel
0e7f19462e run_wml_tests: when a batch of tests fails, retry the tests that were skipped 2021-03-13 20:49:26 -05:00
Celtic Minstrel
9969e1c34a run_wml_tests: add summary of test results at the end of the run 2021-03-13 20:49:26 -05:00
Celtic Minstrel
b0d320d2c1 run_wml_tests: Fix attempting to run tests expected to timeout when timeout is disabled 2021-03-13 20:49:26 -05:00
Celtic Minstrel
c1c5b5dd7d run_wml_tests: Add command-line option to limit test batch size 2021-03-13 20:49:26 -05:00
Celtic Minstrel
10959dae17 run_wml_tests: Refactor the output capturing mechanism to use subprocess.PIPE
- Avoids creating tons of external files
- Suppresses the startup banner to reduce extraneous messages
- Makes the system work on Windows
- Fixes an issue of batched tests being misnamed if one of them is an error
2021-03-13 20:49:26 -05:00
Celtic Minstrel
62de714c48 run_wml_tests: suppress a python linter warning 2021-03-13 20:49:26 -05:00
Celtic Minstrel
5337973cd5 run_wml_tests: Output symbolic forms of unit test results in addition to the numeric return code 2021-03-13 20:49:26 -05:00
Celtic Minstrel
fb5a159f6e run_wml_tests: Fix the batch-disable argument 2021-03-13 20:49:26 -05:00
Celtic Minstrel
ef39108f08 Add an option to the test runner to disable batching of tests 2021-02-27 18:58:28 -05:00
Celtic Minstrel
d74b8c3a52 Fix WML test runner crashing if none of the tests are expected to pass 2021-02-27 16:53:49 -05:00
Pentarctagon
9a0b95f9a0 Separate unit test results from scenario victory/defeat.
This adds an additional `test_result` attribute to [endlevel], intended for use with the automated unit tests. This allows for the unit tests to differentiate a pass/fail result separately from scenario victory or defeat, which allows for more accurately determining the outcome of a test as well as addresses the potential, for example, for a scenario to be expect to pass because of the {SUCCEED} macro but instead passes because the scenario ended as a victory through some other method.

Additional unit tests which were the original motivation for this change are also added as part of this.  They test, as much as possible, that events are executed at all, and are then also executed in the expected order.
2020-04-07 16:45:34 -05:00
Steve Cotton
7359fddecb
Separate unit test statuses for WML exceptions and strict warnings (#4599)
This is part of working out whether a subset of the "fail" tests could be run
in one Wesnoth instance. To run a test that returns TEST_FAIL_BROKE_STRICT with
any other test would require a mechanism to reset lg::broke_strict()'s flag.

All tests that fail with an {ASSERT} will also set the lg::broke_strict() flag,
the tests with the new status are only those that would pass without the strict
flag.

In the SUF tests, change a test from fail-on-success to breaks-strict, rename
the formula tests and add some comments. The rename is because "fai" is
"Formula AI", an obsolete name for WFL.
2019-12-22 19:11:48 +01:00
pentarctagon
7345ca7b0f Improves the WML unit test script's error reporting.
This commit:
* Adds the new `bt` (batch timeout) option, to limit the maximum time batched unit tests can take.  Otherwise, if for whatever reason they take longer than 10 minutes, travis will error the job due to not receiving any output for too long.
* Writes the test output to files rather than trying to get it from the stderr, and then output's the log from the failed test.  Currently if a test unexpectedly times out, there is nothing printed indicating the error or which test encountered the problem (in case of batched tests).
2019-12-11 20:14:15 -06:00
pentarctagon
38a49ad068
Fix case of converting a string with str(). 2019-12-05 19:36:55 -06:00
Steve Cotton
eb7f3674dc
Port run_wml_tests to Python and add batch support (part of #4535) (#4603)
The verbosity settings are a bit different, but other than that it
should be a drop-in replacement for the old shell script.

Wesnoth's --validcache option isn't used any more, which is part of
the cleanup for #4587 (it didn't speed anything up, because all of
the calculation for the checksum was still done).
2019-12-01 08:25:10 +01:00
Jyrki Vesterinen
52fbbc2b40 WML unit tests: port ability to override strict mode from 1.14
The ability isn't needed in master because none of the unit tests call
deprecated functions here, but it may be useful in the future or make
cherry-picking of future changes easier.

(cherry-picked from commit 74d8cfa98e0f61ee22a536fc06c2019c9c89aede)
2018-10-07 03:23:50 +00:00
pentarctagon
a0adab3fcc Adds a c++17 build using the pre-release Ubuntu 18.04.
Though given 00d87f8fe4078ffd84fcdc0d73fcc2104efef1e7 I would say this is better than nothing.

(cherry-picked from commit 33ad6be326c234b173d680ce34589464f88f8418)
2018-10-07 03:19:24 +00:00
Charles Dang
3a90f86674 Addressed more whitespace issues from #2613
[ci skip]
2018-03-12 03:48:59 +11:00
Charles Dang
471c9e876a Addressed a large chunk of the whitespace issues from #2613
[ci skip]
2018-03-09 11:37:00 +11:00
Andreas Löf
1a7458cb13 Change the program used when testing capabilities of the "timeout" command 2017-01-03 23:13:30 +13:00
Andreas Löf
c820d456ec Fix the check for timeout command options
The check to see whether the timeout command is capable of sending
SIGKILL was broken. This fixes the check, which in turn will ensure
that tests are always terminated. This will resolve travis deciding
that the entire build has timed out.
2017-01-03 23:02:12 +13:00
Charles Dang
83dd965f9e WML test fixup by Soliton 2016-03-31 21:31:21 +11:00
Celtic Minstrel
94d3d5aec6 Don't attempt every WML test if binary missing 2016-03-30 16:10:17 -04:00
Celtic Minstrel
fd34675dd9 Add an [explain] WML tag
This explains (in the log) why a WML conditional has failed (or succeeded). Currently it is fairly basic, looping through and/or/not and printing out the specific conditional tag that failed as well as, for [variable], the current content of the variable.

It's used in the WML unit tests system, but could also be useful for debugging.

This commit also fixes an issue with passing multiple -a arguments to run_wml_tests.
2015-10-06 13:51:27 -04:00
Celtic Minstrel
edce9ac64a run_wml_tests: Add some fallback cases and a few more options
- If timeout is missing, it disables timeout and skips any tests that expect it
- Pass -t0 to get the above behaviour even if timeout is present
- Detect if timeout doesn't support --kill-after
- Mac users: Pass -pxcode to automatically find the Wesnoth binary in XCode's DerivedProducts folder
- In non-verbose mode, give progress report by printing a dot before each test
  This only happens in non-verbose mode because this method of reporting progress makes most sense
  if nothing else is printed.
2015-09-19 00:18:31 -04:00
aquileia
a349b0eb7e WML tests: Delete old scripts, fix OpenMP 2015-03-14 18:06:32 +01:00
Chris Beck
d2b7af8711 travis, wml test: incorporate fabi's --noaddons mode as an option
It's not necessary since travis has no add-ons but I put it there
anyways as an example to how others should run the mainline tests.
2014-11-05 21:01:58 -05:00
Chris Beck
857b1e4a03 add -g run_wml_tests option to run gdb backtrace in case of crash
And use it on travis
2014-07-05 18:30:10 -04:00
Alexander van Gessel
3fe799a091 Change run_wml_tests failure exit code from 1 to 2
xvfb-run returns 1 when it fails, so this way we can differentiate.
2014-06-17 23:40:41 +02:00
Chris Beck
8dbb215d44 fixup minor formatting issue in run_wml_tests script 2014-06-06 10:34:55 -04:00
Chris Beck
c8699e2f05 remove built-in wesnoth timeout
This was buggy and based on deprecated SDL features that will not
continue to be available. aquileia wrote us a very nice windows
port of the run_wml_tests bash script, so for windows mac and
linux we should now be able to run the unit tests as desired.

Maybe someday built-in timeouts can be supported using boost
process library, if that ever materializes.
2014-05-29 14:21:44 -04:00
Chris Beck
7cad975038 add timeout (sec) arg, and "additional wesnoth args" to test script 2014-05-26 15:03:34 -04:00
Chris Beck
987e34a3e3 fixup travis unit tests
- travis runs tests not in verbose mode,
  *but* if there is a failure,
  then it runs in very verbose mode, with strict mode off, to get
  errors reported in the travis log.
- run_wml_tests points out that if you don't run in strict mode,
  some tests may not fail as expected, so the count at the end
  may differ
2014-05-19 19:14:13 -04:00
Chris Beck
f053667408 add option to run_wml_tests to change wesnoth binary / binary path 2014-05-15 11:58:25 -04:00
Chris Beck
4c224247ae fixup minor issues with wml test script
- Use printf for formatting when a test fails
- Rename some variables
- Make sure all variables are quoted when used
2014-05-15 11:31:54 -04:00
Chris Beck
d2666bd28f run_wml_tests forwards extra arguments on to wesnoth 2014-05-14 23:42:46 -04:00
Chris Beck
aedbddb1ce refactor run_wml_tests script
Make a more normal command builder pipeline, and merge the two
different test functions associated to the -u option.
2014-05-14 22:37:59 -04:00
Chris Beck
8f36bb1d0d fixup run_wml_tests
getopts string wasn't correct, was skipping the -l option.
2014-05-14 21:47:01 -04:00
Chris Beck
3cc25fdb57 wml test script defaults to "--log-strict=warning", -s to disable 2014-05-14 21:42:14 -04:00
Alexander van Gessel
24c9fe0e5e Don't assume the binary somehow ends up in our PATH 2014-05-14 15:59:43 +02:00