Automake tests that need command line arguments

In automake, you can add tests using a variable TESTS

, but they must be standalone tests. I need a way to call the standard test driver providing arguments. Is there a way to do this, or to call a standard makefile target during testing?

For example, one of my goals is to run:

driver.sh suite-a

      

And once again I need to run:

driver.sh suite-b

      

The tricky part is adding another bash shell script each time just for the assignment TESTS

. So either I need to add in TESTS

the command line parameters or I need a way to add the make target as the test itself.

How can i do this?

+3


source to share


2 answers


From the Gnu Documentation , you can use:

TESTS = suite-a suite-b
LOG_COMPILER = driver.sh

      

If you want to have multiple test scripts, you can use the trick:

TESTS = suite-a.drv1 suite-b.drv1 suite-c.drv2 suite-d.drv2
TEST_EXTENSIONS = .drv1 .drv2
drv1_LOG_COMPILER = driver1.sh
drv2_LOG_COMPILER = driver2.sh

      

this will run:



driver1.sh suite-a.drv1
driver1.sh suite-b.drv1
driver2.sh suite-c.drv2
driver2.sh suite-d.drv2

      

or you can use a nameset based meta warper:

TESTS = suite-a suite-b suite-c suite-d
LOG_COMPILER = driver-warper.sh

      

very simple and simple example:

driver-warper.sh:
case $1 in
     'suite-a') ./driver1.sh suite-a
     ;;
     'suite-b') ./driver1.sh suite-b
     ;;
     'suite-c') ./driver2.sh suite-c
     ;;
     'suite-d') ./driver2.sh suite-d
     ;;
esac
exit $?

      

+3


source


If all your tests need to go through driver.sh

, you can use TESTS_ENVIRONMENT

.



TESTS_ENVIRONMENT = driver.sh
TESTS = suite-a suite-b

      

+2


source







All Articles