Skip to content

MobilityDB Regression Tests

Esteban Zimanyi edited this page Aug 5, 2022 · 2 revisions

Test structure

Regression tests are under the mobilitydb/test subdirectories, for example mobilitydb/test/point; all paths mentioned hereafter are relative to the latter directory unless otherwise specified.

Each test is an SQL file of the form queries/XX_TESTNAME.test.sql where XX is a sequence number. The testing scripts runs each of these files, saves the output, and compares it with the expected output in the file expected/XX_TESTNAME.test.out. A non-empty difference means a failing test. A PostgreSQL ERROR does not imply a failing test, allowing to test for normal error cases.

Before running the tests, the script will create a local PostgreSQL instance, create a new database with MobilityDB, and load testing data from data/load_SUBDIR.sql.xz

Running tests

In the MobilityDB build directory, after a successful make:

ctest -N        # list all tests
ctest           # run all tests
ctest -R regex  # run all tests whose name match regex

The testing script creates a directory tmptest under the build directory, which contains:

  • db/: the local postgres instance data
  • log/: postgres logs, CREATE EXTENSION logs
  • out/: test outputs & differences from expected

Changing tests

When we add or change a test query file, we need to run the new or changed test with ctest (which should fail) and look at the output file in tmptest/out under the build directory. If the output looks satisfactory, we copy the output file to replace the expected results file. Then we run the test again to see if it now succeeds as expected.