Debian Codegraph @

test/regression/README.rst

raw
1 How to run regression tests
2 ===========================
3
4 To run regression tests with default parameters, simply run::
5
6 cd <ffcdir>/tests/regression/
7 python test.py
8
9 Look at ``test.py`` for more options.
10
11
12 How to update references
13 ========================
14
15 To update the references for the FFC regression tests, first commit
16 your changes, then run the regression test (to generate the new
17 references) and finally run the script upload::
18
19 <commit your changes>
20 cd <ffcdir>/tests/regression/
21 python test.py [--use-tsfc]
22 ./scripts/upload
23
24 Note: Contributors are encouraged to install also TSFC stack and update
25 references including ``tsfc`` representation using ``--use-tsfc`` flag.
26 For the installation instructions see ``doc/sphinx/source/installation.rst``.
27 Note that ``tsfc`` regression test are run in separate plans on the Bamboo
28 CI system.
29
30 Note: You may be asked for your *Bitbucket* username and password when
31 uploading the reference data, if use of ssh keys fails.
32
33 Note: The upload script will push the new references to the
34 ``ffc-reference-data`` repository. This is harmless even if these
35 references are not needed later.
36
37 Note: The upload script will update the file ``ffc-regression-data-id``
38 and commit this change to the currently active branch, remember to
39 include this commit when merging or pushing your changes elsewhere.
40
41 Note: You can cherry-pick the commit that updated
42 ``ffc-regression-data-id`` into another branch to use the same set of
43 references there.
44
45 Note: If you ever get merge conflicts in the ``ffc-regression-data-id``,
46 always pick one version of the file. Most likely you'll need to update
47 the references again.
48
49
50 How to run regression tests against a different set of regression data
51 ======================================================================
52
53 To run regression tests and compare to a different set of regression
54 data, perhaps to see what has changed in generated code since a
55 certain version, check out the ``ffc-regression-data-id`` file you want
56 and run tests as usual::
57
58 cd <ffcdir>/tests/regression/
59 git checkout <ffc-commit-id> ffc-regression-data-id
60 python test.py
61
62 The test.py script will run scripts/download which will check out the
63 regression data with the commit id from ``ffc-regression-data-id`` in
64 ``ffc-regression-data/``.
65
66
67 How to inspect diff in output from executed generated code
68 ==========================================================
69
70 Say you have differences in the output of PoissonDG, you can diff the
71 ``.json`` files (NB! within some tolerance on the floating point
72 accuracy!) like this::
73
74 python recdiff.py ffc-reference-data/r_uflacs/PoissonDG.json output/r_uflacs/PoissonDG.json
75 python recdiff.py output/r_uflacs/PoissonDG.json output/r_tensor/PoissonDG.json
76
77 Pick any combination of ``ffc-reference-data | output`` and ``r_foo |
78 r_bar`` you want to compare.
79
80
81 How to manually delete old reference data
82 =========================================
83
84 If you update the tests such that some data should no longer be kept
85 in the data repository, this approach allows deleting reference data::
86
87 cd ffc-regression-data
88 git checkout master
89 git pull
90 git rm -rf <old-directory-or-files>
91 git commit -a -m"Manually updated data because ..."
92 git rev-parse HEAD > ../ffc-regression-data-id
93 cd ..
94 git commit ffc-regression-data-id -m"Manually updated reference id."
95
96 This is not automated because it happens rarely. Probably a good idea
97 to coordinate with other devs so they don't introduce the deleted
98 files with another branch.