Commit graph

34 commits

Author SHA1 Message Date
Steve Cotton
6e25678c69 Port run_wml_tests to Python with batch support and improved error reporting
Includes Pentarctagon's improvements:
* 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).

Cherry picked from commits
* eb7f3674dc
* 38a49ad068
* 7345ca7b0f

Updates the script for the new statuses cherry-picked from
* 7359fddecb
2019-12-24 18:13:13 +01:00
Jyrki Vesterinen
a793bce969 WML unit tests: disable strict mode for the first CVE-2018-1999023 test
The test calls a deprecated function (on purpose) and thus will always log
an error.
2018-07-28 08:09:06 +03: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
Chris Beck
9db311a441 add assertion failure, segfault notes to run_wml_tests 2014-05-13 20:58:52 -04:00
Chris Beck
cd2199cb10 wml test script counts number of passed or failed tests 2014-05-13 20:58:52 -04:00
Chris Beck
090566effd fixup run_wml_tests
Prev version could sometimes give an error if test timed out and
error.log was not created, so add a check for if error.log exists.

Also refactor so the error log handling is in its own function.
2014-05-12 12:05:54 -04:00
Chris Beck
f08db9b3a4 better handling of error logs for wml unit test script
error logs get pooled in errors.log
This is necessary because we don't stop testing when we get an
error anymore.
2014-05-10 18:57:05 -04:00
Chris Beck
8acf5dbe2c wml test script can recieve list of tests as an argument
Also, fixup documentation.
2014-05-10 18:05:50 -04:00
Chris Beck
d560acb9f4 fixup cleanup wml test script
Also only use --validcache conservatively in the -u mode.

Further fixup some comments.

This fixes up commit 5b87baf1e4
2014-05-10 16:37:02 -04:00
Chris Beck
5b87baf1e4 cleanup wml test script
Only start using --validcache with wesnoth after at least one test
has passed.

Use --kill-after flag of unix timeout, so that if TERM fails to
stop wesnoth, a KILL will be issued.

Fixup comments.
2014-05-10 16:30:02 -04:00
Chris Beck
07a1654227 add unix timeout option to wml test script, enable empty_test
Adds an option to the new wml test script, to use the unix
timeout command instead of wesnoth's built-in one. This is because
the built-in one is very slightly unreliable... there's a reason
killthread was deprecated in SDL unfortunately. Will leave it for
UMC but on travis will replace with unix timeout.

The unix timeout one seems consistent enough that I will enable
the empty_test timeout check for travis.

Also, adds a help listing to the wml test script.
2014-05-10 16:06:07 -04:00
Chris Beck
b56b34d2a1 add new wml tests script
Also, redirect some output from cout to cerr in the game...
this somewhat breaks the old script.

The old script is renamed .old

Travis points to the new script.
2014-05-10 14:34:02 -04:00