Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass parameters to tests in an Automake input file?

Tags:

automake

In my Makefile.am, I have the following test:

TESTS += tests/test1
check_PROGRAMS += tests/test1
tests_test1_SOURCES = tests/test1.c
tests_test1_CPPFLAGS = ...
tests_test1_LDADD = ...

test1 is compiled and run when make check is invoked. How should Makefile.am be modified to pass a command line argument to test1?

like image 350
Mike Kwan Avatar asked Mar 25 '12 02:03

Mike Kwan


1 Answers

You cannot pass arguments to tests.

Instead of

TESTS += tests/test1

do

TESTS += tests/test1.test
EXTRA_DIST += tests/test1.test

where tests/test1.test is an executable shell script that will run your program with any argument you wish:

#!/bin/sh
tests/test1 args... < $srcdir/tests/distributed-input-file
like image 133
adl Avatar answered Oct 14 '22 14:10

adl