1 # Copyright © 2015, 2022-2024 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 [*/*], [program=`expr "$program" : '[.*/\([^.]*\)]'`],
23 [*.*], [program=`expr "$program" : '[\([^.]*\)]'`])
24 "$[@]" >"$program.tap"
27 # Older versions of prove do not support the -e option so the
28 # "test" must be a perl script.
29 :; { echo 'print <<EOF'; cat "$program.tap"; echo 'EOF'; } >"$program.pl"
30 { prove "$program.pl"; } 2>&1
33 m4_divert_pop([PREPARE_TESTS])])
35 dnl TEST_TAP([application])
37 dnl Run the given TAP application. The exit status indicates the overall
38 dnl success/failure of the test, while the application's TAP-formatted
39 dnl output is logged with details of individual test results.
40 m4_defun([TEST_TAP], [m4_require([_TEST_TAP_PREPARE])dnl
41 AT_CHECK([test_run_tap $1], [0], [ignore])])
43 dnl TEST_TAP_SIMPLE([name], [application], [setup], [keywords])
45 dnl Convenience macro to define a complete test group based around one
46 dnl application. The test group is created with the given name and
47 dnl (optionally) keywords. The optional setup defines additional code
48 dnl to run before the actual test, and finally the application is
49 dnl run using TEST_TAP.
50 m4_define([TEST_TAP_SIMPLE], [dnl