]>
Commit | Line | Data |
---|---|---|
c3e270f4 FB |
1 | --- |
2 | title: Code Quality Tools | |
4cdca0af | 3 | category: Contributing |
c3e270f4 FB |
4 | --- |
5 | ||
7c2c028c LP |
6 | # Code Quality Tools |
7 | ||
8 | The systemd project has a number of code quality tools set up in the source | |
9 | tree and on the github infrastructure. Here's an incomprehensive list of the | |
10 | available functionality: | |
11 | ||
12 | 1. Use `ninja -C build test` to run the unit tests. Some tests are skipped if | |
13 | no privileges are available, hence consider also running them with `sudo | |
14 | ninja -C build test`. A couple of unit tests are considered "unsafe" (as | |
15 | they change system state); to run those too, build with `meson | |
16 | -Dtests=unsafe`. Finally, some unit tests are considered to be very slow, | |
17 | build them too with `meson -Dslow-tests=true`. (Note that there are a couple | |
18 | of manual tests in addition to these unit tests.) | |
19 | ||
20 | 2. Use `./test/run-integration-tests.sh` to run the full integration test | |
21 | suite. This will build OS images with a number of integration tests and run | |
22 | them in nspawn and qemu. Requires root. | |
23 | ||
24 | 3. Use `./coccinelle/run-coccinelle.sh` to run all | |
25 | [Coccinelle](http://coccinelle.lip6.fr/) semantic patch scripts we ship. The | |
26 | output will show false positives, hence take it with a pinch of salt. | |
27 | ||
28 | 4. Use `./tools/find-double-newline.sh recdiff` to find double newlines. Use | |
29 | `./tools/find-double-newline.sh recpatch` to fix them. Take this with a grain | |
30 | of salt, in particular as we generally leave foreign header files we include in | |
31 | our tree unmodified, if possible. | |
32 | ||
33 | 5. Similar use `./tools/find-tabs.sh recdiff` to find TABs, and | |
34 | `./tools/find-tabs.sh recpatch` to fix them. (Again, grain of salt, foreign | |
35 | headers should usually be left unmodified.) | |
36 | ||
e5988600 | 37 | 6. Use `ninja -C build check-api-docs` to compare the list of exported |
7c2c028c LP |
38 | symbols of `libsystemd.so` and `libudev.so` with the list of man pages. Symbols |
39 | lacking documentation are highlighted. | |
40 | ||
41 | 7. Use `ninja -C build hwdb-update` to automatically download and import the | |
42 | PCI, USB and OUI databases into hwdb. | |
43 | ||
44 | 8. Use `ninja -C build man/update-man-rules` to update the meson rules for | |
45 | building man pages automatically from the docbook XML files included in | |
46 | `man/`. | |
47 | ||
48 | 9. There are multiple CI systems in use that run on every github PR submission. | |
49 | ||
50 | 10. [Coverity](https://scan.coverity.com/) is analyzing systemd master in | |
51 | regular intervals. The reports are available | |
52 | [online](https://scan.coverity.com/projects/systemd). | |
53 | ||
54 | 11. [oss-fuzz](https://oss-fuzz.com/) is continuously fuzzing the | |
55 | codebase. Reports are available | |
56 | [online](https://oss-fuzz.com/v2/testcases?project=systemd). | |
57 | ||
8b9e4b21 | 58 | 12. Our tree includes `.editorconfig`, `.dir-locals.el` and `.vimrc` files, to |
5cadf58e | 59 | ensure that editors follow the right indentiation styles automatically. |
8b9e4b21 LP |
60 | |
61 | 13. When building systemd from a git checkout the build scripts will | |
5cadf58e | 62 | automatically enable a git commit hook that ensures whitespace cleanliness. |
8b9e4b21 | 63 | |
8cc9d188 | 64 | 14. [LGTM](https://lgtm.com/) analyzes every commit pushed to master. The list |
00195abc FB |
65 | of active alerts can be found |
66 | [here](https://lgtm.com/projects/g/systemd/systemd/alerts/?mode=list). | |
8cc9d188 | 67 | |
c9a95378 FS |
68 | 15. Each PR is automatically tested with [Address Sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) |
69 | and [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). | |
70 | See [Testing systemd using sanitizers](https://systemd.io/TESTING_WITH_SANITIZERS) | |
71 | for more information. | |
72 | ||
8cc9d188 EV |
73 | Access to Coverity and oss-fuzz reports is limited. Please reach out to the |
74 | maintainers if you need access. |