| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | <!-- $NetBSD: regression.xml,v 1.7 2020/01/11 11:48:59 rillig Exp $ --> | | 1 | <!-- $NetBSD: regression.xml,v 1.8 2020/01/11 11:50:51 rillig Exp $ --> |
2 | | | 2 | |
3 | <chapter id="regression"> <?dbhtml filename="regression.html"?> | | 3 | <chapter id="regression"> <?dbhtml filename="regression.html"?> |
4 | <title>Regression tests</title> | | 4 | <title>Regression tests</title> |
5 | | | 5 | |
6 | <para>The pkgsrc infrastructure consists of a large codebase, | | 6 | <para>The pkgsrc infrastructure consists of a large codebase, |
7 | and there are many corners where every little bit of a file is | | 7 | and there are many corners where every little bit of a file is |
8 | well thought out, making pkgsrc likely to fail as soon as | | 8 | well thought out, making pkgsrc likely to fail as soon as |
9 | anything is changed near those parts. To prevent most changes | | 9 | anything is changed near those parts. To prevent most changes |
10 | from breaking anything, a suite of regression tests should go | | 10 | from breaking anything, a suite of regression tests should go |
11 | along with every important part of the pkgsrc infrastructure. | | 11 | along with every important part of the pkgsrc infrastructure. |
12 | This chapter describes how regression tests work in pkgsrc and | | 12 | This chapter describes how regression tests work in pkgsrc and |
13 | how you can add new tests.</para> | | 13 | how you can add new tests.</para> |
14 | | | 14 | |
| @@ -71,26 +71,27 @@ do_test() { | | | @@ -71,26 +71,27 @@ do_test() { |
71 | | | 71 | |
72 | <varlistentry><term><varname>check_result</varname></term> | | 72 | <varlistentry><term><varname>check_result</varname></term> |
73 | <listitem><para>This function is run after the test and is | | 73 | <listitem><para>This function is run after the test and is |
74 | typically used to compare the actual output from the one that is | | 74 | typically used to compare the actual output from the one that is |
75 | expected. It can make use of the various helper functions from | | 75 | expected. It can make use of the various helper functions from |
76 | the next section. Example:</para> | | 76 | the next section. Example:</para> |
77 | | | 77 | |
78 | <programlisting> | | 78 | <programlisting> |
79 | check_result() { | | 79 | check_result() { |
80 | exit_status 0 | | 80 | exit_status 0 |
81 | output_require "Example" | | 81 | output_require "Example" |
82 | output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$" | | 82 | output_require "^[[:alpha:]+[[:space:]][[:alpha:]]{6}$" |
83 | output_prohibit "no such file or directory" | | 83 | output_prohibit "no such file or directory" |
| | | 84 | regress_fail "expected $expected but got $actual for input $input" |
84 | } | | 85 | } |
85 | </programlisting> | | 86 | </programlisting> |
86 | | | 87 | |
87 | </listitem> | | 88 | </listitem> |
88 | </varlistentry> | | 89 | </varlistentry> |
89 | | | 90 | |
90 | <varlistentry><term><varname>do_cleanup</varname></term> | | 91 | <varlistentry><term><varname>do_cleanup</varname></term> |
91 | <listitem><para>This function cleans everything up after the | | 92 | <listitem><para>This function cleans everything up after the |
92 | test has been run. By default it does nothing.</para></listitem> | | 93 | test has been run. By default it does nothing.</para></listitem> |
93 | </varlistentry> | | 94 | </varlistentry> |
94 | | | 95 | |
95 | </variablelist> | | 96 | </variablelist> |
96 | </sect2> | | 97 | </sect2> |