Skip to content

Commit c41c8bc

Browse files
committed
README: improve documentation of the m4 macros
Add TOC links to the commonly used macros. Document the macros in more detail.
1 parent 34b5452 commit c41c8bc

File tree

4 files changed

+56
-21
lines changed

4 files changed

+56
-21
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### Changed
66
- Extend `AX_AT_DIFF_PATTERN()` and `AX_AT_DIFF_PYRE()` to support
7-
- optional `RUN-IF-FAIL` and `RUN-IF-PASS` arguments.
7+
optional `RUN-IF-FAIL` and `RUN-IF-PASS` arguments.
88

99
## [18] - 2024-03-12
1010

README.md

+53-18
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ This project contains a collection of scripts and autotest
55
(part of [autoconf](https://www.gnu.org/software/autoconf/))
66
macros:
77

8-
* [pyrediff](#pyrediff)
9-
* [check\_pattern.awk](#check_patternawk)
10-
* [autotest macros](#autotest-macros)
8+
* [`pyrediff`](#pyrediff)
9+
* [`check_pattern.awk`](#check_patternawk)
10+
* [autotest m4 macros](#autotest-macros), including:
11+
* [`AX_AT_CHECK_PATTERN()`](#macro-ax_at_check_patterncommands-status0-stdout-re-stderr-re-run-if-fail-run-if-pass)
12+
* [`AX_AT_DIFF_PATTERN()`](#macro-ax_at_diff_patternpattern-file-test-file-status0-differences-run-if-fail-run-if-pass)
13+
* [`AX_AT_CHECK_PYREDIFF()`](#macro-ax_at_check_pyrediffcommands-status0-stdout-re-stderr-re-run-if-fail-run-if-pass)
14+
* [`AX_AT_DIFF_PYRE()`](#macro-ax_at_diff_pyrepyre-file-test-file-status0-differences-run-if-fail-run-if-pass)
1115

1216
## pyrediff
1317

@@ -58,33 +62,64 @@ The script is usually invoked as:
5862

5963
Various autotest
6064
([autoconf](https://www.gnu.org/software/autoconf/))
61-
macros are provided with pattern (AWK regular expression)
65+
m4 macros are provided with pattern (AWK regular expression)
6266
and pyre (Python regular expression) support.
6367

68+
> **Note**: As autoconf uses [] for quoting, the use of [brackets] in the
69+
> macro arguments _stdout-re_ and _stderr-re_ can be awkward and require
70+
> careful extra quoting, or quadrigraphs `@<:@` (for `[`) and `@:>@` (for `]`).
71+
6472
### AWK regular expression patterns
6573

6674
Macros that support AWK regular expressions in the pattern:
6775

68-
* `AX_AT_CHECK_PATTERN()`: similar to `AT_CHECK()`,
69-
except that stdout and stderr are AWK regular expressions (REs).
70-
* `AX_AT_DIFF_PATTERN()`: checks that a pattern file applies to
71-
a test file.
72-
* `AX_AT_DATA_CHECK_PATTERN_AWK()`: create a file with the
73-
contents of the AWK script used by `AX_AT_CHECK_PATTERN()`
74-
and `AX_AT_DIFF_PATTERN()`.
75-
This is the same as the [check\_pattern.awk](#check_patternawk) script.
76+
#### Macro: `AX_AT_CHECK_PATTERN(`_commands_, [_status_=0], [_stdout-re_], [_stderr-re_], [_run-if-fail_], [_run-if-pass_]`)`
77+
78+
Similar to `AT_CHECK()`, except that _stdout-re_ and _stderr-re_ are
79+
AWK regular expressions (REs).
80+
81+
Using `AT_CHECK()`, runs _commands_ in a subshell, which are expected to
82+
have an exit status of _status_, and to generate `stdout` to match the
83+
pattern _stdout-re_ and `stderr` to match the pattern _stderr-re_.
84+
The `AT_CHECK()` support for special values for _stdout-re_ and _stderr-re_
85+
of `ignore`, `stdout`, `stderr`, (etc) is available.
86+
87+
#### Macro: `AX_AT_DIFF_PATTERN(`_pattern-file_, _test-file_, [_status_=0], [_differences_], [_run-if-fail_], [_run-if-pass_]`)`
88+
89+
Checks that an AWK pattern file `PATTERN-FILE` applies to a test file `TEST-FILE`,
90+
using `AT_CHECK()`.
91+
92+
#### Macro: `AX_AT_DATA_CHECK_PATTERN_AWK(`_filename_`)`
93+
94+
Create the file _filename_ with the contents of the AWK script used by
95+
`AX_AT_CHECK_PATTERN()` and `AX_AT_DIFF_PATTERN()`.
96+
This is the same as the [check\_pattern.awk](#check_patternawk) script.
7697

7798
### Python regular expression (pyre) patterns
7899

79100
Macros that support
80101
[Python regular expressions](https://docs.python.org/3/library/re.html):
81102

82-
* `AX_AT_CHECK_PYREDIFF()`: similar to `AT_CHECK()`,
83-
except that stdout and stderr are Python regular expressions (pyre).
84-
* `AX_AT_DIFF_PYRE()`: checks that a pattern file applies to a test file.
85-
* `AX_AT_DATA_PYREDIFF_PY()`: create a file with the contents of the
86-
Python script used by `AX_AT_CHECK_PYREDIFF()` and `AX_AT_DIFF_PYRE()`.
87-
This is the same as the [pyrediff](#pyrediff) script.
103+
#### Macro: `AX_AT_CHECK_PYREDIFF(`_commands_, [_status_=0], [_stdout-re_], [_stderr-re_], [_run-if-fail_], [_run-if-pass_]`)`
104+
105+
Similar to `AT_CHECK()`, except that _stdout-re_ and _stderr-re_ are
106+
Python regular expressions (pyre).
107+
108+
Using `AT_CHECK()`, runs _commands_ in a subshell, which are expected to
109+
have an exit status of _status_, and to generate `stdout` to match the
110+
pyre (Python regular expression) _stdout-re_ and `stderr` to match the pyre _stderr-re_.
111+
The `AT_CHECK()` support for special values for _stdout-re_ and _stderr-re_
112+
of `ignore`, `stdout`, `stderr`, (etc) is available.
113+
114+
#### Macro: `AX_AT_DIFF_PYRE(`_pyre-file_, _test-file_, [_status_=0], [_differences_], [_run-if-fail_], [_run-if-pass_])`
115+
116+
Checks that a pyre file _pyre-file_ applies to a test file _test-file_.
117+
118+
#### Macro: `AX_AT_DATA_PYREDIFF_PY(`_filename_`)`
119+
120+
Create a file _filename_ with the contents of the Python script used by
121+
`AX_AT_CHECK_PYREDIFF()` and `AX_AT_DIFF_PYRE()`.
122+
This is the same as the [pyrediff](#pyrediff) script.
88123

89124
## Examples
90125

src/ax_at_check_pattern.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SYNOPSIS
22
#
3-
# AX_AT_CHECK_PATTERN(COMMANDS, [STATUS], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
3+
# AX_AT_CHECK_PATTERN(COMMANDS, [STATUS=0], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
44
# AX_AT_DIFF_PATTERN(PATTERN-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES], [RUN-IF-FAIL], [RUN-IF-PASS])
55
# AX_AT_DATA_CHECK_PATTERN_AWK(FILENAME)
66
#

src/ax_at_check_pyrediff.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SYNOPSIS
22
#
3-
# AX_AT_CHECK_PYREDIFF(COMMANDS, [STATUS], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
3+
# AX_AT_CHECK_PYREDIFF(COMMANDS, [STATUS=0], [STDOUT-RE], [STDERR-RE], [RUN-IF-FAIL], [RUN-IF-PASS])
44
# AX_AT_DIFF_PYRE(PYRE-FILE, TEST-FILE, [STATUS=0], [DIFFERENCES], [RUN-IF-FAIL], [RUN-IF-PASS])
55
# AX_AT_DATA_PYREDIFF_PY(FILENAME)
66
#

0 commit comments

Comments
 (0)