Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make distcheck and tests that need input files

I recently converted my build system to automake/autoconf. In my project I have a few unit tests that need some input data files in the direcory from where they are run. When I run make distcheck and it tries the VPATH build, these tests fail because they are apparently not run from the directory where the input files are. I was wondering if there is some quick fix for this. For example, can I somehow tell the system not to run these tests on make distcheck (but still run them on make check)? Or to cd to the directory where the files are before running the tests?

like image 510
Martin Wiebusch Avatar asked Jul 04 '12 21:07

Martin Wiebusch


1 Answers

I had the same problem and used solution similar to William's. My Makefile.am looks something like this:

EXTRA_DIST = testdata/test1.dat

AM_CPPFLAGS = -DDATADIR=\"$(srcdir)/\"

Then, in my unittest, I use the DATADIR define:

string path = DATADIR "/testdata/test1.dat"

This works with make check and make distcheck.

like image 154
David Marek Avatar answered Sep 23 '22 12:09

David Marek