travis: check spelling of binaries and manpages, use docker
We now build a docker base container based on debian sid (where the very latest packages are available). That base container is updated once a month, or whenever travis-build.Dockerfile or debian/control change, but re-used for subsequent travis runs. While the initial build might take up to 15 minutes, subsequent builds typically run in a minute or two. All the different steps that we run on travis are now factored into separate scripts in the travis/ directory. Switching to docker should also help with issue #2174.
This commit is contained in:
2
travis/check-formatting.sh
Executable file
2
travis/check-formatting.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
clang-format-3.5 -i $(find . -name "*.[ch]" | tr '\n' ' ') && git diff --exit-code || (echo 'Code was not formatted using clang-format!'; false)
|
19
travis/check-safe-wrappers.sh
Executable file
19
travis/check-safe-wrappers.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
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
|
64
travis/check-spelling.pl
Executable file
64
travis/check-spelling.pl
Executable file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env perl
|
||||
# vim:ts=4:sw=4:expandtab
|
||||
#
|
||||
# © 2016 Michael Stapelberg
|
||||
#
|
||||
# Checks for spelling errors in binaries and manpages (to be run by continuous
|
||||
# integration to point out spelling errors before accepting contributions).
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use v5.10;
|
||||
use autodie;
|
||||
use lib 'testcases/lib';
|
||||
use i3test::Util qw(slurp);
|
||||
use Lintian::Check qw(check_spelling);
|
||||
|
||||
# Lintian complains if we don’t set a vendor.
|
||||
use Lintian::Data;
|
||||
use Lintian::Profile;
|
||||
Lintian::Data->set_vendor(
|
||||
Lintian::Profile->new('debian', ['/usr/share/lintian'], {}));
|
||||
|
||||
my $exitcode = 0;
|
||||
|
||||
# Whitelist for spelling errors in manpages, in case the spell checker has
|
||||
# false-positives.
|
||||
my $binary_spelling_exceptions = {
|
||||
#'exmaple' => 1, # Example for how to add entries to this whitelist.
|
||||
'betwen' => 1, # asan_flags.inc contains this spelling error.
|
||||
};
|
||||
my @binaries = qw(
|
||||
i3
|
||||
i3-config-wizard/i3-config-wizard
|
||||
i3-dump-log/i3-dump-log
|
||||
i3-input/i3-input
|
||||
i3-msg/i3-msg
|
||||
i3-nagbar/i3-nagbar
|
||||
i3bar/i3bar
|
||||
);
|
||||
for my $binary (@binaries) {
|
||||
check_spelling(slurp($binary), $binary_spelling_exceptions, sub {
|
||||
my ($current, $fixed) = @_;
|
||||
say STDERR qq|Binary "$binary" contains a spelling error: "$current" should be "$fixed"|;
|
||||
$exitcode = 1;
|
||||
});
|
||||
}
|
||||
|
||||
# Whitelist for spelling errors in manpages, in case the spell checker has
|
||||
# false-positives.
|
||||
my $manpage_spelling_exceptions = {
|
||||
};
|
||||
|
||||
for my $name (glob('man/*.1')) {
|
||||
for my $line (split(/\n/, slurp($name))) {
|
||||
next if $line =~ /^\.\\\"/o;
|
||||
check_spelling($line, $manpage_spelling_exceptions, sub {
|
||||
my ($current, $fixed) = @_;
|
||||
say STDERR qq|Manpage "$name" contains a spelling error: "$current" should be "$fixed"|;
|
||||
$exitcode = 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
exit $exitcode;
|
11
travis/docker-build-and-push.sh
Executable file
11
travis/docker-build-and-push.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# .dockerignore is created on demand so that release.sh and other scripts are
|
||||
# not influenced by our travis setup.
|
||||
echo .git > .dockerignore
|
||||
|
||||
docker build --pull --no-cache --rm -t=${BASENAME} -f travis-build.Dockerfile .
|
||||
docker login -e ${DOCKER_EMAIL} -u ${DOCKER_USER} -p ${DOCKER_PASS}
|
||||
docker push ${BASENAME}
|
7
travis/ha.sh
Executable file
7
travis/ha.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Returns a hash to be used as version number suffix for the i3/travis-base
|
||||
# docker container. The hash is over all files which influence what gets
|
||||
# installed in the container, so that any changes in what needs to be installed
|
||||
# will result in a cache invalidation.
|
||||
|
||||
cat debian/control travis-build.Dockerfile | sha256sum | dd bs=1 count=8 status=none
|
8
travis/run-tests.sh
Executable file
8
travis/run-tests.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd testcases
|
||||
# Try running the tests in parallel so that the common case (tests pass) is
|
||||
# quick, but fall back to running them in sequence to make debugging easier.
|
||||
if ! xvfb-run ./complete-run.pl
|
||||
then
|
||||
xvfb-run ./complete-run.pl --parallel=1 || (cat latest/complete-run.log; false)
|
||||
fi
|
Reference in New Issue
Block a user