Difference between revisions of "ValidationFAQ"

From The Battle for Wesnoth Wiki
(Add notes on GUI validation)
(Add notes on validating schemas)
Line 38: Line 38:
  
 
* wesnoth --validate data/gui/_main.cfg --use-schema=data/schema/gui.cfg
 
* 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''.
 
As with validating a campaign, you may also need ''--data-dir'' and ''--userconfig-dir''.
  
 
[[Category:Validation]]
 
[[Category:Validation]]

Revision as of 13:47, 11 June 2021

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.
  • 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:

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.