ecbuild_get_test_data

Download a test data set at build time.

ecbuild_get_test_data( NAME <name>
                       [ TARGET <target> ]
                       [ DIRNAME <dir> ]
                       [ DIRLOCAL <dir> ]
                       [ MD5 <hash> ]
                       [ EXTRACT ]
                       [ NOCHECK ] )

curl or wget is required (curl is preferred if available).

Options

NAMErequired

name of the test data file

TARGEToptional, defaults to test_data_<name>

CMake target name

DIRNAMEoptional

use when there is a directory structure on the server that hosts test files

DIRLOCAL : optional, defaults to “.”, local directory in which the test data is copied

MD5optional, ignored if NOCHECK is given

md5 checksum of the data set to verify. If not given and NOCHECK is not set, download the md5 checksum and verify

EXTRACToptional

extract the downloaded file (supported archives: tar, zip, tar.gz, tar.bz2)

NOCHECKoptional

do not verify the md5 checksum of the data file

Usage

Download test data from <ECBUILD_DOWNLOAD_BASE_URL>/<DIRNAME>/<NAME>

If the ECBUILD_DOWNLOAD_BASE_URL variable is not set, the default URL http://download.ecmwf.org/test-data is used.

If the DIRNAME argument is not given, test data will be downloaded from <ECBUILD_DOWNLOAD_BASE_URL>/<project>/<relative path to current dir>/<NAME>

By default, the downloaded file is verified against an md5 checksum, either given as the MD5 argument or downloaded from the server otherwise. Use the argument NOCHECK to disable this check.

The default timeout is 30 seconds, which can be overridden with ECBUILD_DOWNLOAD_TIMEOUT. Downloads are by default only tried once, use ECBUILD_DOWNLOAD_RETRIES to set the number of retries.

Examples

Do not verify the checksum:

ecbuild_get_test_data( NAME msl.grib NOCHECK )

Checksum agains remote md5 file:

ecbuild_get_test_data( NAME msl.grib )

Checksum agains local md5:

ecbuild_get_test_data( NAME msl.grib MD5 f69ca0929d1122c7878d19f32401abe9 )

ecbuild_get_test_multidata

Download multiple test data sets at build time.

ecbuild_get_test_multidata( NAMES <name1> [ <name2> ... ]
                            TARGET <target>
                            [ DIRNAME <dir> ]
                            [ DIRLOCAL <dir> ]
                            [ LABELS <label1> [<label2> ...] ]
                            [ EXTRACT ]
                            [ NOCHECK ] )

curl or wget is required (curl is preferred if available).

Options

NAMESrequired

list of names of the test data files

TARGEToptional

CMake target name

DIRNAMEoptional

use when there is a directory structure on the server that hosts test files

DIRLOCAL : optional, defaults to “.”, local directory in which the test data is copied

LABELSoptional

list of labels to assign to the test

Lower case project name and download_data are always added as labels.

This allows selecting tests to run via ctest -L <regex> or tests to exclude via ctest -LE <regex>.

EXTRACToptional

extract downloaded files (supported archives: tar, zip, tar.gz, tar.bz2)

NOCHECKoptional

do not verify the md5 checksum of the data file

Usage

Download test data from <ECBUILD_DOWNLOAD_BASE_URL>/<DIRNAME> for each name given in the list of NAMES. Each name may contain a relative path, which is appended to DIRNAME and may be followed by an md5 checksum, separated with a : (the name must not contain spaces).

If the ECBUILD_DOWNLOAD_BASE_URL variable is not set, the default URL http://download.ecmwf.org/test-data is used.

If the DIRNAME argument is not given, test data will be downloaded from <ECBUILD_DOWNLOAD_BASE_URL>/<project>/<relative path to current dir>/<NAME>

By default, each downloaded file is verified against an md5 checksum, either given as part of the name as described above or a remote checksum downloaded from the server. Use the argument NOCHECK to disable this check.

Examples

Do not verify checksums:

ecbuild_get_test_multidata( TARGET get_grib_data NAMES foo.grib bar.grib
                            DIRNAME test/data/dir NOCHECK )

Checksums agains remote md5 file:

ecbuild_get_test_multidata( TARGET get_grib_data NAMES foo.grib bar.grib
                            DIRNAME test/data/dir )

Checksum agains local md5:

ecbuild_get_test_multidata( TARGET get_grib_data DIRNAME test/data/dir
                            NAMES msl.grib:f69ca0929d1122c7878d19f32401abe9 )