ValidationFAQ

From The Battle for Wesnoth Wiki
Revision as of 04:09, 15 June 2021 by Celtic Minstrel (talk | contribs) (Manually validating a mainline campaign: Note that SCHEMA_SHOULD_SKIP_THIS is no longer required)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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:

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.

This page was last edited on 15 June 2021, at 04:09.