blob: c7995e3107db40240180f9ed0c293b8b2f5b0f15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
.. bt in -*- rst -*- mode!
Configuration
=============
File
----
The configuration file is named ``minishell_test.cfg`` and should be located at the root of your project.
Here is what the default configuration looks like:
.. include:: ../minishell_test/data/default.cfg
:code: ini
The format of this file is described in more details
`here <https://docs.python.org/3/library/configparser.html#supported-ini-file-structure>`_.
Global
------
Global settings are defined under the ``[minishell_test]`` section.
.. _config-bonus:
.. conf:: bonus
:type: true|false
Enable the bonus tests (:ref:`bonus`).
.. _config-make:
.. conf:: make
:type: true|false
Run the ``make`` command in your project directory before the test.
.. _config-make-args:
.. conf:: make_args
:type: space separated list
| Argument given to the ``make`` command.
| The default value (``MINISHELL_TEST_FLAGS=-DMINISHELL_TEST``) allows you to do conditional compilation
to support both the ``-c`` option and the :ref:`subject`
(which doesn't say anything about options, so we assume the minishell executable didn't take any).
| In your ``Makefile`` add ``$(MINISHELL_TEST_FLAGS)`` in your object compilation command.
(e.g ``$(CC) $(CCFLAGS) -c -o $@ $<``)
| You can then have something resembling the following in your ``main``:
.. code:: c
#ifndef MINISHELL_TEST
int main(int argc, char **argv)
{
if (argc != 1) error;
...
}
#else
int main(int argc, char **argv)
{
if (argc != 3 && strcmp(argv[1], "-c") == 0) do the thing;
...
}
#endif
.. _config-check-error-messages:
.. conf:: check_error_messages
:type: true|false
| If is ``true``, will ignore the content of the error messages outputted by the reference shell,
| Useful if you have implemented your own error messages and don't want to copy bash's ones.
.. _config-pager:
.. conf:: pager
:type: command name
| Pager to use when viewing your results after the tests finished running.
| Will be called like: ``{pager} {log_filename}``.
Shell
-----
Shell settings are defined under the ``[shell]`` section.
.. conf:: available_commands
:type: multi-line list
Commands available in a test.
.. warning::
Some of the default tests won't serve their purpose
if the default available commands are not present.
.. _config-path-variable:
.. conf:: path_variable
:type: string (``:`` separated directories)
``$PATH`` environment variable passed to the shell.
.. note::
``{shell_available_commands_dir}`` will be replaced by the directory
where the available commands are stored.
Reference
+++++++++
Reference shell settings are defined under the ``[shell:reference]`` section.
.. _config-shell-reference-path:
.. conf:: path
:type: path
Path to reference shell, to which your ``minishell`` will be compared.
.. note::
has to support the ``-c`` option, ``sh``, ``bash`` and ``zsh`` support it.
.. conf:: args
:type: space separated list
| Supplementary arguments to the reference shell.
| e.g ``--posix`` can be used with bash for a more posix compliant behavior.
Timeout
-------
Timeout settings are defined under the ``[timeout]`` section.
.. conf:: test
:type: float (seconds)
Time before a timeout occurs on a regular test.
.. _config-timeout-leaks:
.. conf:: leaks
:type: float (seconds)
Time before a timeout occurs on a leak test (with ``valgrind``).
|