2015-03-13 05:06:57 -04:00
|
|
|
language: c
|
|
|
|
compiler:
|
|
|
|
- gcc
|
|
|
|
- clang
|
2015-10-10 18:12:38 -04:00
|
|
|
addons:
|
|
|
|
apt:
|
|
|
|
sources:
|
|
|
|
- llvm-toolchain-precise-3.5
|
|
|
|
# ubuntu-toolchain-r-test contains libstdc++6 >= 4.8 which libllvm3.5 needs.
|
|
|
|
- ubuntu-toolchain-r-test
|
|
|
|
packages:
|
|
|
|
- clang-format-3.5
|
|
|
|
- libllvm3.5
|
2015-03-13 05:06:57 -04:00
|
|
|
before_install:
|
2015-03-13 15:52:53 -04:00
|
|
|
# The travis VMs run on Ubuntu 12.04 which is very old and a huge pain to get
|
|
|
|
# into a state where we can build a recent version of i3 :(.
|
2015-03-13 16:04:03 -04:00
|
|
|
- "echo 'deb http://archive.ubuntu.com/ubuntu/ trusty main universe' | sudo tee /etc/apt/sources.list.d/trusty.list"
|
|
|
|
- "echo 'APT::Default-Release \"precise\";' | sudo tee /etc/apt/apt.conf.d/default-release"
|
2015-03-13 18:38:13 -04:00
|
|
|
|
|
|
|
- "echo 'Package: libc6' > /tmp/pin"
|
|
|
|
- "echo 'Pin: release n=trusty' >> /tmp/pin"
|
|
|
|
- "echo 'Pin-Priority: 999' >> /tmp/pin"
|
|
|
|
- "echo '' >> /tmp/pin"
|
|
|
|
|
|
|
|
- "echo 'Package: libxkbcommon*' >> /tmp/pin"
|
|
|
|
- "echo 'Pin: release n=trusty' >> /tmp/pin"
|
|
|
|
- "echo 'Pin-Priority: 999' >> /tmp/pin"
|
|
|
|
- "echo '' >> /tmp/pin"
|
|
|
|
|
|
|
|
- "echo 'Package: libyajl*' >> /tmp/pin"
|
|
|
|
- "echo 'Pin: release n=trusty' >> /tmp/pin"
|
|
|
|
- "echo 'Pin-Priority: 999' >> /tmp/pin"
|
|
|
|
- "echo '' >> /tmp/pin"
|
|
|
|
|
|
|
|
- "echo 'Package: libxcb-image*' >> /tmp/pin"
|
|
|
|
- "echo 'Pin: release n=trusty' >> /tmp/pin"
|
|
|
|
- "echo 'Pin-Priority: 999' >> /tmp/pin"
|
|
|
|
- "echo '' >> /tmp/pin"
|
|
|
|
|
|
|
|
- sudo cp /tmp/pin /etc/apt/preferences.d/trustypin
|
2015-03-13 05:06:57 -04:00
|
|
|
- sudo apt-get update
|
2015-03-13 15:52:53 -04:00
|
|
|
- sudo apt-get install -t trusty libc6 libc6-dev
|
2015-06-04 11:05:53 -04:00
|
|
|
- sudo apt-get install --no-install-recommends devscripts equivs xdotool
|
2015-03-13 05:06:57 -04:00
|
|
|
install:
|
2015-03-13 15:52:53 -04:00
|
|
|
- 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.
|
2015-11-16 03:25:53 -05:00
|
|
|
- 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
|
2015-03-13 15:52:53 -04:00
|
|
|
- sudo /bin/sh -c 'cpanm -n -v X11::XCB || true'
|
2015-03-13 18:38:56 -04:00
|
|
|
- sudo /bin/sh -c 'cpanm -n -v AnyEvent::I3 || true'
|
2015-03-14 17:32:03 -04:00
|
|
|
script:
|
2015-03-29 11:20:11 -04:00
|
|
|
- CFLAGS="-Wformat -Wformat-security -Wextra -Wno-unused-parameter -Werror" make -j
|
2015-03-14 17:32:03 -04:00
|
|
|
- (cd testcases && xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false))
|
2015-03-23 04:21:06 -04:00
|
|
|
- clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
|
2015-08-03 05:51:39 -04:00
|
|
|
- |
|
|
|
|
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
|