Difference between revisions of "ValidationFAQ"
(Created page with 'Validation is a special tool, developed by Sytyi, GSoC 2011 participant. This is a special page to answer validation-specified questions, since using of it is not so obvious. =…') |
(→Manually validating a mainline campaign: Note that SCHEMA_SHOULD_SKIP_THIS is no longer required) |
||
(7 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | + | == The validation tool built in to the Wesnoth engine == | |
− | + | {{DevFeature1.15|?}} The Wesnoth engine's ''--validate'' option makes Wesnoth run the validation instead of playing the game. It's run automatically on the mainline campaigns as part of the continuous-integration builds, via the ''utils/travis/schema_validation.sh'' script. | |
− | + | The rules for validating WML are defined by [[SchemaWML]] files in the ''data/schema/'' directory. | |
− | |||
− | |||
− | |||
− | = | + | === Manually validating a mainline campaign === |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | To run it manually on a mainline campaign, validate data/_main.cfg with the appropriate defines. | |
− | |||
− | = | + | * wesnoth --validate data/_main.cfg --preprocess-defines=TEST,SCHEMA_SHOULD_SKIP_THIS |
− | * | + | * wesnoth --validate data/_main.cfg --preprocess-defines=TUTORIAL |
− | * | + | * wesnoth --validate data/_main.cfg --preprocess-defines=EASY,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL |
− | + | * wesnoth --validate data/_main.cfg --preprocess-defines=NORMAL,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL | |
− | * | + | * etc |
− | |||
− | + | Points to note: | |
− | * | + | * These commands may also need ''--userconfig-dir'' and ''--data-dir'' arguments, depending on where you're running the Wesnoth executable from. |
− | + | * ''TEST'' validates test scenarios, including the AI demo scenarios and the WML unit tests, and requires ''SCHEMA_SHOULD_SKIP_THIS'' to avoid failing on some tests which check the engine's response to invalid WML. {{DevFeature1.15|14}} This extra define is no longer required to validate tests from the command line. | |
+ | * Campaigns need a separate validation run for each of their difficulty levels. | ||
+ | * The ''[campaign]extra_defines='' value needs to be added on the command line, for example TRoW uses ''DISABLE_GRAND_MARSHAL'' | ||
+ | === Validating an add-on === | ||
− | [[Category:Validation] | + | {{DevFeature1.15|?}} Can be done using the Wesnoth engine's ''--validate-addon'' option. |
+ | |||
+ | {{DevFeature1.15|4}} The current status as of 1.15.4 is that this tool isn't ready for use yet. | ||
+ | |||
+ | Needs more documentation, but for now check: | ||
+ | |||
+ | * https://github.com/wesnoth/wesnoth/issues/4223 only validates when the cache is rebuilt | ||
+ | * https://github.com/wesnoth/wesnoth/issues/4224 no feedback on typos | ||
+ | * https://github.com/wesnoth/wesnoth/issues/4225 the GUI starts even when just validating | ||
+ | |||
+ | === Validating the GUI === | ||
+ | |||
+ | The GUI WML code is automatically validated every time you launch the game, but it can also be validated manually with the following command-line: | ||
+ | |||
+ | * wesnoth --validate data/gui/_main.cfg --use-schema=data/schema/gui.cfg | ||
+ | |||
+ | As with validating a campaign, you may also need ''--data-dir'' and ''--userconfig-dir''. | ||
+ | |||
+ | === Validating a schema === | ||
+ | |||
+ | Since WML schemas are themselves a form of WML, they can also be validated with the tool. You can use a method similar to GUI above and just point to schema.cfg instead, but the following command-line enables some additional checks such as ensuring all types you use have been defined: | ||
+ | |||
+ | * wesnoth --validate-schema data/schema/gui.cfg | ||
+ | |||
+ | As with validating a campaign, you may also need ''--data-dir'' and ''--userconfig-dir''. | ||
+ | |||
+ | [[Category:Validation]] |
Latest revision as of 04:09, 15 June 2021
Contents
The validation tool built in to the Wesnoth engine
(Version 1.15.? and later only) The Wesnoth engine's --validate option makes Wesnoth run the validation instead of playing the game. It's run automatically on the mainline campaigns as part of the continuous-integration builds, via the utils/travis/schema_validation.sh script.
The rules for validating WML are defined by SchemaWML files in the data/schema/ directory.
Manually validating a mainline campaign
To run it manually on a mainline campaign, validate data/_main.cfg with the appropriate defines.
- wesnoth --validate data/_main.cfg --preprocess-defines=TEST,SCHEMA_SHOULD_SKIP_THIS
- wesnoth --validate data/_main.cfg --preprocess-defines=TUTORIAL
- wesnoth --validate data/_main.cfg --preprocess-defines=EASY,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL
- wesnoth --validate data/_main.cfg --preprocess-defines=NORMAL,CAMPAIGN_THE_RISE_OF_WESNOTH,DISABLE_GRAND_MARSHAL
- etc
Points to note:
- These commands may also need --userconfig-dir and --data-dir arguments, depending on where you're running the Wesnoth executable from.
- TEST validates test scenarios, including the AI demo scenarios and the WML unit tests, and requires SCHEMA_SHOULD_SKIP_THIS to avoid failing on some tests which check the engine's response to invalid WML. (Version 1.15.14 and later only) This extra define is no longer required to validate tests from the command line.
- Campaigns need a separate validation run for each of their difficulty levels.
- The [campaign]extra_defines= value needs to be added on the command line, for example TRoW uses DISABLE_GRAND_MARSHAL
Validating an add-on
(Version 1.15.? and later only) Can be done using the Wesnoth engine's --validate-addon option.
(Version 1.15.4 and later only) The current status as of 1.15.4 is that this tool isn't ready for use yet.
Needs more documentation, but for now check:
- https://github.com/wesnoth/wesnoth/issues/4223 only validates when the cache is rebuilt
- https://github.com/wesnoth/wesnoth/issues/4224 no feedback on typos
- https://github.com/wesnoth/wesnoth/issues/4225 the GUI starts even when just validating
Validating the GUI
The GUI WML code is automatically validated every time you launch the game, but it can also be validated manually with the following command-line:
- wesnoth --validate data/gui/_main.cfg --use-schema=data/schema/gui.cfg
As with validating a campaign, you may also need --data-dir and --userconfig-dir.
Validating a schema
Since WML schemas are themselves a form of WML, they can also be validated with the tool. You can use a method similar to GUI above and just point to schema.cfg instead, but the following command-line enables some additional checks such as ensuring all types you use have been defined:
- wesnoth --validate-schema data/schema/gui.cfg
As with validating a campaign, you may also need --data-dir and --userconfig-dir.