Commit Graph

67 Commits

Author SHA1 Message Date
Pentarctagon
0f550369b3
Simplify logging options (#7620)
This removes --wconsole, --wnoconsole, and --wnoredirect. Instead these are now handled by --no-log-to-file and --log-to-file.

If logging to file is enabled, then output will be written to the log file. If logging to file is not enabled, then output is written to the terminal. On Windows, a terminal will be created for the output to be written to if wesnoth is not launched from a terminal.
2023-05-14 12:47:43 -05:00
Steve Cotton
34ae0490b1 run_wml_tests: add an option to filter tests by name
For example, `run_wml_tests --filter backstab` runs only the tests listed
in `wml_test_schedule` that have `backstab` somewhere in their name.
2022-10-05 07:44:02 +02:00
Tommy
80c914cd81 CI: Enable coloured output for gdb backtraces. 2022-06-10 16:45:38 +12:00
Pentarctagon
8e2996661f
Prevents logging of duplicate deprecation messages and messages missing timestamps.
Fixes #5942
2021-07-24 18:51:42 -05:00
Pentarctagon
7608cdbaa4 Better handle unexpected return codes. 2021-05-12 13:54:12 -05:00
Steve Cotton
fa72014158 run_wml_tests: Print the correct test name when a test fails
The fix in 9535ed9 didn't work, the script still crashed on that line, the
logic for working out how many tests in the batch had passed wasn't correct.
This commit drops that logic, and drops the dependent feature of trying to
retry the next test in the batch, and simply says the entire batch failed.

The new logic for filtering the output of a failed batch is much simpler - the
script doesn't filter it and we assume the developer is just going to ignore
any line that starts "PASS TEST". Only tests that are expected to pass get
batched, so the output is going to look something like the following:

	PASS TEST: test_return
	PASS TEST: test_assert
	PASS TEST: test_return_2
	PASS TEST: test_assert_2
	Assertion failed: assert false
	FAIL TEST: test_assert_fail

	Failure, Wesnoth returned 1 FAIL but we expected 0 PASS

A set of constants is added defining how many -v arguments are needed to
enable a given set of debugging output. Expectation is that level 0 is normal,
and level 1 is for developers who like long-running build processes to print
something to show that they're not stuck.
2021-04-19 07:41:03 +02:00
Celtic Minstrel
038219b823 run_wml_tests: Show negative test summary values
These values should never BE negative, but by showing them if they are, it makes it more obvious if something is broken.
2021-04-15 23:24:11 -04:00
Celtic Minstrel
bb10bbe059 run_wml_tests: Fix exit code 2021-04-15 23:24:03 -04:00
Celtic Minstrel
9535ed926c run_wml_tests: Fix off-by-one error in 1285060bc4 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 74d8cfa98e)
2018-10-07 03:23:50 +00:00
pentarctagon
a0adab3fcc Adds a c++17 build using the pre-release Ubuntu 18.04.
Though given 00d87f8fe4 I would say this is better than nothing.

(cherry-picked from commit 33ad6be326)
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