Hello, I am using Autotools for my C++ package. My package has a single binary (let's call it "myprog"). I also wrote a bash script, "launch_functional_tests.bash". This script has 4 steps: (1) create input files, (2) generate expected output files (by launching something like "R --file=functional_tests.R", (3) launch "myprog" on the input files, (4) compare the outputs of "prog" with the expected outputs generated by the R script at step 2.
In step 3, "launch_functional_tests.bash" needs to know the path to "myprog". If I run the bashs cript on standalone myself, I give the path to "myprog" as an option on the command-line. But what can I do when using make check? I asked this question on stackoverflow (http://stackoverflow.com/q/14223208/597069) but didn't get any answer so far, that's why I'm asking it here now. In the mean time, I found that the following Makefile.am allows me to run "make check" successfully: TESTS = launch_functional_tests.bash EXTRA_DIST = launch_functional_tests.in functional_tests.R CLEANFILES = $(TESTS) all: launch_functional_tests.bash launch_functional_tests.bash: $(srcdir)/launch_functional_tests.in sed -e 's,PATHTOBINDIR,$(bindir),g' $(srcdir)/launch_functional_tests.in > launch_functional_tests.bash chmod +x launch_functional_tests.bash But this works only if "make install" has been run before, so that "myprog" is indeed inside the directory specified by $(bindir). First question: is there a way for "make check" to work without launching "make install" before? Moreover, my solution doesn't work for "make distcheck" because "launch_functional_tests.bash" doesn't find the R script anymore (as the test is now executed in something like ".../mypck-1.0/_build"). Second question: what can I do to execute my functional test with "make distcheck"? I guess that maybe both of my problems could be resolved if I could use a variable like $(testdir). But how can I do that? Thanks in advance for any help!
