@cryptotaxi247 / netdata-1 / commits / ac90f27a5

Updating the Travis pipeline (issue 7189) (#7312)

Added a linting pass. This is non-blocking but will output a measure of how much each .c and .h file deviates from our current .clang format. Changed the standard build to include all of the warning that we are using in dev. Added the dependencies for dbengine and confirmed that the standard build enables dbengine. Fixed the original warnings.

Andrew Moss committed Nov 14, 2019 at 16:49 UTC ac90f27a580aad0c4d20c5354657b34e5ceed29e
5 files changed +42 -3
.travis.yml
+6 -2
@@ -16,7 +16,7 @@ before_install:
16 # Install dependencies for all, once
17 #
18 install:
19 - - sudo apt-get install -y libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python-pip
19 + - sudo apt-get install -y libuv1-dev liblz4-dev libjudy-dev libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python-pip
20 - sudo apt install -y --only-upgrade docker-ce
21 - sudo pip install git-semver==0.2.4 # 11/Sep/2019: git-semver tip was broken, so we had to force last good run of it
22 - docker info
@@ -104,6 +104,10 @@ jobs:
104 name: Run shellchecking on BASH
105 script: shellcheck --format=gcc $(find . -name '*.sh.in' -not -iwholename '*.git*')
106
107 + # Check if any of the C code deviates from our coding style
108 + - name: Check coding style
109 + script: .travis/clangformat.sh
110 +
111 # This falls under same stage defined earlier
112 - name: Run checksum checks on kickstart files
113 script: ./tests/installer/checksums.sh
@@ -120,7 +124,7 @@ jobs:
124
125 name: Standard netdata build
126 script: fakeroot ./netdata-installer.sh --install $HOME --dont-wait --dont-start-it --enable-plugin-nfacct --enable-plugin-freeipmi --disable-lto
123 - env: CFLAGS='-O1 -DNETDATA_INTERNAL_CHECKS=1 -DNETDATA_VERIFY_LOCKS=1'
127 + env: CFLAGS='-O1 -Wall -Wextra -Wformat-signedness -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTIFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1'
128 after_failure: post_message "TRAVIS_MESSAGE" "<!here> standard netdata build is failing (Still dont know which one, will improve soon)"
129
130 - name: Docker container build process (alpine installation)
.travis/clangformat.sh new
+3
@@ -0,0 +1,3 @@
1 +#!/usr/bin/env bash
2 +
3 +find . -type f -name '*.[ch]' | while read filename; do echo -ne "$filename: "; diff <(clang-format -style=file $filename) $filename | wc -l; done
CONTRIBUTING.md
+30
@@ -78,6 +78,36 @@ We expect most contributions to be for new data collection plugins. You can read
78
79 Of course we appreciate contributions for any other part of the NetData agent, including the [daemon](daemon), [backends for long term archiving](backends/), innovative ways of using the [REST API](web/api) to create cool [Custom Dashboards](web/gui/custom/) or to include NetData charts in other applications, similarly to what can be done with [Confluence](web/gui/confluence/).
80
81 +If you are working on the C source code please be aware that we have a standard build configuration that we use. This
82 +is meant to keep the source tree clean and free of warnings. When you are preparing to work on the code:
83 +```
84 +CFLAGS="-O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -DNETDATA_INTERNAL_CHECKS=1 -D_FORTIFY_SOURCE=2 -DNETDATA_VERIFY_LOCKS=1" ./netdata-installer.sh --disable-lto --dont-wait
85 +```
86 +
87 +Typically we will enable LTO during production builds. The reasons for configuring it this way are:
88 +
89 +| CFLAG / argument | Reasoning |
90 +| ---------------- | --------- |
91 +| `-O1` | This makes the debugger easier to use as it disables optimisations that break the relationship between the source and the state of the debugger |
92 +| `-ggdb` | Enable debugging symbols in gdb format (this also works with clang / llbdb) |
93 +| `-Wall -Wextra -Wformat-signedness` | Really, definitely, absolutely all the warnings |
94 +| `-DNETDATA_INTERNAL_CHECKS=1` | This enables the debug.log and turns on the macro that outputs to it |
95 +| `-D_FORTIFY_SOURCE=2` | Enable buffer-overflow checks on string-processing functions |
96 +| `-DNETDATA_VERIFY_LOCKS=1` | Enable extra checks and debug |
97 +| `--disable-lto ` | We enable LTO for production builds, but disable it during development are it can hide errors about missing symbols that have been pruned. |
98 +
99 +Before submitting a PR we run through this checklist:
100 +
101 +* Compilation warnings
102 +* valgrind
103 +* ./netdata-installer.sh
104 +* make dist
105 +* `packaging/makeself/build-x86_64-static.sh`
106 +* `clang-format -style=file`
107 +
108 +Please be aware that the linting pass at the end is currently messy as we are transitioning between code styles
109 +across most of our code-base, but we prefer new contributions that match the linting style.
110 +
111 ### Contributions Ground Rules
112
113 #### Code of Conduct and CLA
daemon/main.c
+2
@@ -921,8 +921,10 @@ int main(int argc, char **argv) {
921 {
922 char* stacksize_string = "stacksize=";
923 char* debug_flags_string = "debug_flags=";
924 +#ifdef ENABLE_DBENGINE
925 char* createdataset_string = "createdataset=";
926 char* stresstest_string = "stresstest=";
927 +#endif
928
929 if(strcmp(optarg, "unittest") == 0) {
930 if(unit_test_buffer()) return 1;
libnetdata/simple_pattern/simple_pattern.c
+1 -1
@@ -273,7 +273,7 @@ extern void simple_pattern_dump(uint64_t debug_type, SIMPLE_PATTERN *p)
273 debug(debug_type,"dump_pattern(NULL)");
274 return;
275 }
276 - debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%d match=%s", root, root->child, root->next, root->mode,
276 + debug(debug_type,"dump_pattern(%p) child=%p next=%p mode=%u match=%s", root, root->child, root->next, root->mode,
277 root->match);
278 if(root->child!=NULL)
279 simple_pattern_dump(debug_type, (SIMPLE_PATTERN*)root->child);