- - sudo mk-build-deps --install --remove --tool 'apt-get --no-install-recommends -y' debian/control
- - sudo apt-get install --no-install-recommends -y libanyevent-perl libanyevent-i3-perl libextutils-pkgconfig-perl xcb-proto cpanminus xvfb xserver-xephyr xauth libinline-perl
- - sudo cpanm -n -v X11::XCB
-script: make -j && (cd testcases && xvfb-run ./complete-run.pl)
+ - sudo mk-build-deps --install --remove --tool 'apt-get --no-install-recommends' debian/control
+ # Install as many dependencies as possible via apt because cpanm is not very reliable/easy to debug.
+ - sudo apt-get install --no-install-recommends libanyevent-perl libanyevent-i3-perl libextutils-pkgconfig-perl xcb-proto cpanminus xvfb xserver-xephyr xauth libinline-perl libxml-simple-perl libmouse-perl libmousex-nativetraits-perl libextutils-depends-perl perl-modules libtest-deep-perl libtest-exception-perl libxml-parser-perl libtest-simple-perl libtest-fatal-perl libdata-dump-perl libtest-differences-perl libxml-tokeparser-perl libtest-use-ok-perl libipc-run-perl libxcb-xtest0-dev
+ - sudo /bin/sh -c 'cpanm -n -v X11::XCB || true'
+ - sudo /bin/sh -c 'cpanm -n -v AnyEvent::I3 || true'
+script:
+ - if [ -a .git/shallow ]; then git fetch --unshallow; fi
+ - CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j
+ - (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
+ - clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
+ - |
+ funcs='malloc|calloc|realloc|strdup|strndup|asprintf|write'
+ cstring='"([^"\\]|\\.)*"'
+ cchar="'[^\\\\]'|'\\\\.[^']*'"
+ regex="^([^'\"]|${cstring}|${cchar})*\<(${funcs})\>"
+ detected=0
+ while IFS= read -r file; do
+ if { cpp -w -fpreprocessed "$file" || exit "$?"; } | grep -E -- "$regex"; then
+ echo "^ $file calls a function that has a safe counterpart."
+ detected=1
+ fi
+ done << EOF
+ $(find -name '*.c' -not -name safewrappers.c -not -name strndup.c)
+ EOF
+ if [ "$detected" -ne 0 ]; then
+ echo
+ echo "Calls of functions that have safe counterparts were detected."
+ exit 1
+ fi