XmltvValidation

From XMLTV
Jump to: navigation, search

Validation

The xmltv distribution contains a number of tools that can help you validate that a grabber behaves the way it is expected to.

tv_validate_grabber

tv_validate_grabber tests one grabber to see that it supports the correct command-line parameters and that it produces the correct output. See perldoc tv_validate_grabber for instructions.

tv_validate_file

tv_validate_file checks an xmltv file against the xmltv dtd and the other rules defined in XMLTVFormat. See tv_validate_file(1) for instructions.

Basic tests

To ensure consistency of results between grabbers each one must pass some basic tests. Before submitting a new grabber for inclusion in the distribution you should run the following series of tests and check for errors.

1)
Basic validation

tv_validate_grabber tv_grab_xx

2)
Grab 2 days starting from day 1

tv_grab_xx --config-file test.conf --offset 1 --days 2 > t_1.xml --quiet 2>t_1.log

Check that t_1.log is empty

Sort the xml file

tv_sort --duplicate-error t_1.xml > t_1.sorted.xml

3)
Grab separate files for day 1 and day 2

tv_grab_xx --config-file test.conf --offset 1 --days 1 --output t_2.xml
tv_grab_xx --config-file test.conf --offset 2 --days 1 > t_3.xml

Join them

tv_cat t_2.xml t_3.xml > t_2_3.xml

...and sort

tv_sort --duplicate-error t_2_3.xml > t_2_3.sorted.xml

There should be no difference between the combined two separate day files and the 2-day grab

diff t_1.sorted.xml t_2_3.sorted.xml

Validate the joined file

tv_validate_file t_2_3.sorted.xml


test_grabbers

The test_grabbers script is used to test all grabbers in the distribution at once. It can be found under grab/ in the source distribution of xmltv. To run it, cd to an empty directory and run it from there. It will automatically test all grabbers found in subdirectories relative to itself. It uses test.conf-files found in the subdirectory for each grabber. These can be created with

% ./grab/test_grabbers --configure --only xx

The test_grabbers script is run every night and published on the web. See XmltvStatus.