1 # Copyright © 2015, 2022-2023 Nick Bowler
3 # Helper macros for executing the TAP-like applications in an autotest
6 # License WTFPL2: Do What The Fuck You Want To Public License, version 2.
7 # This is free software: you are free to do what the fuck you want to.
8 # There is NO WARRANTY, to the extent permitted by law.
10 m4_defun([_TEST_TAP_PREPARE], [m4_divert_push([PREPARE_TESTS])dnl
12 echo "% prove --version"
13 prove --version </dev/null
15 } >&AS_MESSAGE_LOG_FD 2>&1
17 # Run a test program, and, if prove is installed, use it to interpret the
18 # TAP-formatted output.
22 "$builddir/t/$program" "$@" >"$program.tap"
25 # Older versions of prove do not support the -e option so the
26 # "test" must be a perl script.
27 :; { echo 'print <<EOF'; cat "$program.tap"; echo 'EOF'; } >"$program.pl"
28 { prove "$program.pl"; } 2>&1
31 m4_divert_pop([PREPARE_TESTS])])
33 dnl TEST_TAP([application])
35 dnl Run the given TAP application. The exit status indicates the overall
36 dnl success/failure of the test, while the application's TAP-formatted
37 dnl output is logged with details of individual test results.
38 m4_defun([TEST_TAP], [m4_require([_TEST_TAP_PREPARE])dnl
39 AT_CHECK([test_run_tap $1], [0], [ignore])])
41 dnl TEST_TAP_SIMPLE([name], [application], [setup], [keywords])
43 dnl Convenience macro to define a complete test group based around one
44 dnl application. The test group is created with the given name and
45 dnl (optionally) keywords. The optional setup defines additional code
46 dnl to run before the actual test, and finally the application is
47 dnl run using TEST_TAP.
48 m4_define([TEST_TAP_SIMPLE], [dnl