README.md
1# FAUST Impulse Response Tests #
2
3This test suite allows to check that the compiler generates correct code by comparing the impulse response of a set of Faust programs with the expected one. When the DSP code contains buttons, they are set to 1 at the first sample to simulate button press.
4
5### Prerequisites
6- `faust`, `libfaust.a` and `libfaustmachine.a` must be available from the `../../build/bin` and `../../build/lib/` folders. They must be compiled with all backends.
7- `NodeJS` must be installed to check the wasm/wast backends. See the [NodeJS](https://nodejs.org/) web site.
8
9### How to run the Tests
10Two test systems co-exist for historical reasons:
11- a system based on makefiles
12- a system based on shell scripts (**deprecated**)
13
14The principle of both test systems is to generate impulse responses for each of the Faust programs that are in the `dsp` folder. Each of these responses is compared with its reference response (with a low tolerance). The `reference` folder contains the reference impulse responses.
15
16There is a significant intersection between the tests performed by the two systems.
17
18#### Using the Makefile
19The use of `make` allows to benefit from parallelism (option -j n).
20The generated impulse responses are stored in a folder named `ir`.
21Type `make help` for details about the available targets.
22
23There is no target `clean`: simply delete the `ir` folder or one of its subfolders to regenerate the impulse responses.
24
25**Note**:
26
27When using the make option `-j`, I suggest to also add a `-i` option (`--ignore-errors : Ignore errors from commands`), especially with the 'cpp' and 'c' targets. Indeed, make should first _1)_ build all the C++ and/or C output, _2)_ compile these output and _3)_ finally run the Faust program and check the result.
28
29If `make` fails with the first check and since intermediate files are removed, the steps _1)_ and _2)_ will restart from the beginning (which is quite time consuming) on next run. With the `-i` option, `make` will run to the end and on next run, only the faulty DSP will be rebuilt.
30
31#### Using the shell scripts (**deprecated**)
32The main script is `test.sh`. Type `test.sh -help` for details about the available tests.
33
34The generated impulse responses are not preserved by the shell scripts. Intermediate files may be generated in the dsp folder without being deleted.
35
36You should run `make tools` before first run of `tests.sh`.
37
38### To do
39- add precision arg to filesCompare (for float and fastmath outputs)
40- check that all test.sh subscripts are based on the current development branch and don't require any installation
41- simplify and rename the `faust2impulse_xxx_` scripts
42
43### Deprecated Files
44- install.sh
45- testwithmute.sh
46