From 94e7035d20e159d6a630ea05f58d88fa9e32611d Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Sun, 11 Oct 2015 01:16:14 +0530 Subject: [PATCH] Add .travis.yml file and script for Travis-CI * .travis.yml: New file. Configuration file for Travis * contrib/travis-ci: New Bash script to compile and run tests on Travis. --- .travis.yml | 35 +++++++++++++++++++++++++++++++++++ contrib/travis-ci | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 .travis.yml create mode 100755 contrib/travis-ci diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c496406 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +sudo: no + +language: c + +compiler: + - gcc + - clang + +addons: + apt: + packages: + - automake + - autoconf + - autopoint + - flex + - texinfo + - pkg-config + - libgnutls-dev + - libssl-dev + - make + - libhttp-daemon-perl + - libio-socket-ssl-perl + - libidn11-dev + - gettext + - texlive + - python3 + - valgrind + +before_script: + - export CFLAGS="-O2 -Wall -Wextra" + - export PERLLIB=$PERLLIB:../../tests + - export PERL5LIB=$PERL5LIB:../../tests + +script: + - ./contrib/travis-ci diff --git a/contrib/travis-ci b/contrib/travis-ci new file mode 100755 index 0000000..585c135 --- /dev/null +++ b/contrib/travis-ci @@ -0,0 +1,48 @@ +#!/bin/sh + +# Set a stricter bash mode +set -e +set -u + +# Get the number of cores on the machine. We can use any many to run tests in +# parallel. +CORES=$(grep -c ^processor /proc/cpuinfo 2> /dev/null || echo 0) +if [ $CORES -lt 1 ]; then CORES=1; fi + +# Run `make distclean`. This is currently not required and results in an error +# on Travis. But eventually with cached directories, this may be useful. +echo "Running: make distclean" +make distclean > /dev/null || true +echo + +# Define a large number of Warning flags for the compiler. Hopefully, someone +# will sit and analyze the output to clean the warnings from the codebase. +CFLAGS="-std=c89 -pedantic -O2 -Wall -Wextra -Wstrict-prototypes -Wold-style-definition -Wwrite-strings -Wshadow -Wformat -Wformat-security -Wunreachable-code -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition" + +# A cachefile for ./configure. I'm not sure if this is any useful. +CACHEFILE=$PWD/config_check.cache + +# measure time consumed and print it at the end of the script +START=$(date +%s.%N) + +echo "Running: ./bootstrap" +./bootstrap +echo + +# the compiler changed, so we have to remove the cache file here +rm -f "$CACHEFILE" + +for options in "" "--with-ssl=openssl"; do + export DISTCHECK_CONFIGURE_FLAGS="-C --cache-file=$CACHEFILE $options" + echo " ./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS=\"$CFLAGS\"" + ./configure $DISTCHECK_CONFIGURE_FLAGS CFLAGS="$CFLAGS" + + for xLCALL in C tr_TR.utf8; do + export TESTS_ENVIRONMENT="LC_ALL=$xLCALL VALGRIND_TESTS=1" + echo " TESTS_ENVIRONMENT=\"$TESTS_ENVIRONMENT\" make distcheck CFLAGS=$CFLAGS -j$CORES" + make distcheck CFLAGS="$CFLAGS" -j$CORES + done +done + +END=$(date +%s.%N) +echo "Duration: $(echo "$END - $START" | bc)" -- 2.6.1