Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make `make check` process TAP output?

Tags:

autotools

tap

I have a C++ program that generates what I believe is minimal TAP output, like this:

  TAP version 13
  1..3
  ok 1
  not ok 2
  ok 3

This program is called test_runner and returns 0.

The Makefile.am in the directory is the following:

  TESTS = test_runner
  check_PROGRAMS = test_runner
  test_runner_SOURCES = main.cpp

Now, when I execute make check, the summary output is the following:

  # TOTAL: 1
  # PASS:  1
  # SKIP:  0
  # XFAIL: 0
  # FAIL:  0
  # XPASS: 0
  # ERROR: 0

My question is: is make check supposed to inspect the TAP output of my program (as I would expect to get 2 successes and 1 failure) and if so, what am I doing wrong?

automake version is 1.13.3, autoconf version is 2.69.

like image 578
Laurent LA RIZZA Avatar asked Dec 07 '13 10:12

Laurent LA RIZZA


1 Answers

You should have this in your configure.ac:

AC_REQUIRE_AUX_FILE([tap-driver.sh])
...
AC_PROG_AWK

And this in your Makefile.am:

check_PROGRAMS = test_runner
test_runner_SOURCES = main.cpp

LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
              $(top_srcdir)/tap-driver.sh

TESTS = test_runner

The LOG_DRIVER variable is what makes it invoke the tap-driver.sh script, otherwise the default generic test driver is used. You can optionally define specific drivers for each file extension (say, one for .py, another for .sh, etc), but in this case, a single global LOG_DRIVER is enough.

UPDATE for automake 1.15

As user ecerulm pointed out, tap-driver.pl is being deprecated, so I changed the answer to consider only tap-driver.sh.

like image 149
DanielKO Avatar answered Oct 14 '22 05:10

DanielKO