From 5b33049a71aa07e579197c60175e08b16c973412 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Sun, 11 Oct 2015 01:16:14 +0530 Subject: [PATCH 3/4] 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 | 36 ++++++++++++++++++++++++++++++++++++ contrib/travis-ci | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 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..bb8bfa4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,36 @@ +# TODO: +# Send change emails to bug-wget +sudo: no + +language: c + +compiler: + - gcc + - clang + +env: + - PERLLIB=$PERLLIB:../../tests PERL5LIB=$PERL5LIB:../../tests + +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 + - language-pack-tr + +script: + - ./contrib/travis-ci diff --git a/contrib/travis-ci b/contrib/travis-ci new file mode 100755 index 0000000..696906a --- /dev/null +++ b/contrib/travis-ci @@ -0,0 +1,53 @@ +#!/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 +# +# For some reason. /proc/cpuinfo reports 16 cores on Travis, while the docs +# claim that each instance has only 2 cores. We belive the docs and force a +# value of only 2 here. +CORES=2 + +# 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 --enable-valgrind-tests $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: $((END-START))" -- 2.6.1