How to make `make check` process TAP output?
Asked Answered
H

1

6

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.

Hazy answered 7/12, 2013 at 10:36 Comment(0)
S
7

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.

Scarabaeoid answered 29/12, 2013 at 23:1 Comment(3)
Awesome. It just works. I'll start from here. The manual is pretty unclear about how to do it in a minimal fashion. Thank you for this concise answer.Hazy
From automake-1.15 the tap-driver.pl is kind of deprecated. See release notes. Paraphrasing from the release note: awk+shell implementation of the TAP driver is more portable and has the same features of the perl one, the awk+shell is the one documented in the manual so they will keep just that one.Judy
@ecerulm: Thanks, I updated the answer to reflect the newest version.Scarabaeoid

© 2022 - 2024 — McMap. All rights reserved.