mercredi 15 mars 2017

cmake generate test data

my tests require some data files to be present before they can run. The files are huge so I would not like to commit them into my VCS but instead generate them on demand using a script. But generating the files also takes a lot of time, so I'd like to only generate them only once and not again every time I run make test.

Is it possible to let my test depend on the presence of a file on disk and tell cmake to regenerate that file if it is either not present or out of date?

I tried the following but it doesn't seem to work:

enable_testing()
add_test(NAME foo COMMAND bla myfile.txt)
set_tests_properties(foo PROPERTIES DEPENDS myfile.txt)
add_custom_command(OUTPUT myfile.txt COMMAND createmyfile)

Is it possible at all?

Aucun commentaire:

Enregistrer un commentaire