Merge pull request #95 from libtom/improve/travis
create a travis build matrix
This commit is contained in:
commit
4f6420bc02
31
.travis.yml
31
.travis.yml
@ -1,18 +1,35 @@
|
|||||||
language: c
|
language: c
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
|
|
||||||
script:
|
install:
|
||||||
- make travis_mtest
|
- sudo apt-get update -qq
|
||||||
- head -n 5 test.log
|
- sudo apt-get install gcc-multilib
|
||||||
- tail -n 2 test.log
|
|
||||||
- ./testme.sh --with-cc=gcc --with-low-mp
|
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
fast_finish: true
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
- /^release\/.*$/
|
- /^release\/.*$/
|
||||||
|
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
- clang
|
||||||
|
script:
|
||||||
|
- ./testme.sh --with-cc=$CC ${BUILDOPTIONS}
|
||||||
|
env:
|
||||||
|
- |
|
||||||
|
BUILDOPTIONS="--test-vs-mtest=333333"
|
||||||
|
- |
|
||||||
|
BUILDOPTIONS="--test-vs-mtest=333333 --mtest-real-rand"
|
||||||
|
- |
|
||||||
|
BUILDOPTIONS="--with-low-mp"
|
||||||
|
- |
|
||||||
|
BUILDOPTIONS="--with-m64 --with-m32 --with-mx32"
|
||||||
|
|
||||||
|
after_failure:
|
||||||
|
- cat test_*.log
|
||||||
|
- cat gcc_errors_*.log
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
irc: "chat.freenode.net#libtom-notifications"
|
irc: "chat.freenode.net#libtom-notifications"
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
|
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(MP_8BIT) || defined(MP_16BIT)
|
||||||
|
#define MP_GEN_RANDOM_SHIFT DIGIT_BIT
|
||||||
|
#else
|
||||||
#if MP_GEN_RANDOM_MAX == 0xffffffffu
|
#if MP_GEN_RANDOM_MAX == 0xffffffffu
|
||||||
#define MP_GEN_RANDOM_SHIFT 32
|
#define MP_GEN_RANDOM_SHIFT 32
|
||||||
#elif MP_GEN_RANDOM_MAX == 32767
|
#elif MP_GEN_RANDOM_MAX == 32767
|
||||||
@ -26,6 +29,7 @@
|
|||||||
#elif !defined(MP_GEN_RANDOM_SHIFT)
|
#elif !defined(MP_GEN_RANDOM_SHIFT)
|
||||||
#error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT
|
#error Thou shalt define their own valid MP_GEN_RANDOM_SHIFT
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* makes a pseudo-random int of a given size */
|
/* makes a pseudo-random int of a given size */
|
||||||
static mp_digit s_gen_random(void)
|
static mp_digit s_gen_random(void)
|
||||||
|
4
makefile
4
makefile
@ -102,10 +102,6 @@ test_standalone: $(LIBNAME) demo/demo.o
|
|||||||
mtest:
|
mtest:
|
||||||
cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest
|
cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest
|
||||||
|
|
||||||
travis_mtest: test mtest
|
|
||||||
@ for i in `seq 1 10` ; do sleep 500 && echo alive; done &
|
|
||||||
./mtest/mtest 666666 | ./test > test.log
|
|
||||||
|
|
||||||
timing: $(LIBNAME)
|
timing: $(LIBNAME)
|
||||||
$(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest
|
$(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest
|
||||||
|
|
||||||
|
@ -151,8 +151,9 @@ int main(int argc, char *argv[])
|
|||||||
if (rng == NULL) {
|
if (rng == NULL) {
|
||||||
rng = fopen("/dev/random", "rb");
|
rng = fopen("/dev/random", "rb");
|
||||||
if (rng == NULL) {
|
if (rng == NULL) {
|
||||||
fprintf(stderr, "\nWarning: stdin used as random source\n\n");
|
fprintf(stderr, "\nWarning: no /dev/[u]random available\n\n");
|
||||||
rng = stdin;
|
printf("exit\n");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
58
testme.sh
58
testme.sh
@ -27,6 +27,9 @@ _help()
|
|||||||
echo " --with-cc=* The compiler(s) to use for the tests"
|
echo " --with-cc=* The compiler(s) to use for the tests"
|
||||||
echo " This is an option that will be iterated."
|
echo " This is an option that will be iterated."
|
||||||
echo
|
echo
|
||||||
|
echo " --test-vs-mtest=* Run test vs. mtest for '*' operations."
|
||||||
|
echo " Only the first of each options will be taken into account."
|
||||||
|
echo
|
||||||
echo "To be able to specify options a compiler has to be given."
|
echo "To be able to specify options a compiler has to be given."
|
||||||
echo "All options will be tested with all MP_xBIT configurations."
|
echo "All options will be tested with all MP_xBIT configurations."
|
||||||
echo
|
echo
|
||||||
@ -45,6 +48,8 @@ _help()
|
|||||||
echo
|
echo
|
||||||
echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT."
|
echo " --with-low-mp Also build&run tests with -DMP_{8,16,32}BIT."
|
||||||
echo
|
echo
|
||||||
|
echo " --mtest-real-rand Use real random data when running mtest."
|
||||||
|
echo
|
||||||
echo "Godmode:"
|
echo "Godmode:"
|
||||||
echo
|
echo
|
||||||
echo " --all Choose all architectures and gcc and clang as compilers"
|
echo " --all Choose all architectures and gcc and clang as compilers"
|
||||||
@ -65,22 +70,28 @@ _die()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_runtest()
|
_make()
|
||||||
{
|
{
|
||||||
echo -ne " Compile $1 $2"
|
echo -ne " Compile $1 $2"
|
||||||
make clean > /dev/null
|
|
||||||
suffix=$(echo ${1}${2} | tr ' ' '_')
|
suffix=$(echo ${1}${2} | tr ' ' '_')
|
||||||
CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS test_standalone $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.txt
|
CC="$1" CFLAGS="$2 $TEST_CFLAGS" make -j$MAKE_JOBS $3 $MAKE_OPTIONS > /dev/null 2>gcc_errors_${suffix}.log
|
||||||
errcnt=$(wc -l < gcc_errors_${suffix}.txt)
|
errcnt=$(wc -l < gcc_errors_${suffix}.log)
|
||||||
if [[ ${errcnt} -gt 1 ]]; then
|
if [[ ${errcnt} -gt 1 ]]; then
|
||||||
echo " failed"
|
echo " failed"
|
||||||
cat gcc_errors_${suffix}.txt
|
cat gcc_errors_${suffix}.log
|
||||||
exit 128
|
exit 128
|
||||||
fi
|
fi
|
||||||
echo -e "\rRun test $1 $2"
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_runtest()
|
||||||
|
{
|
||||||
|
make clean > /dev/null
|
||||||
|
_make "$1" "$2" "test_standalone"
|
||||||
local _timeout=""
|
local _timeout=""
|
||||||
which timeout >/dev/null && _timeout="timeout --foreground 90"
|
which timeout >/dev/null && _timeout="timeout --foreground 90"
|
||||||
$_timeout ./test > test_${suffix}.txt || _die "running tests" $?
|
echo -e "\rRun test $1 $2"
|
||||||
|
$_timeout ./test > test_${suffix}.log || _die "running tests" $?
|
||||||
}
|
}
|
||||||
|
|
||||||
_banner()
|
_banner()
|
||||||
@ -105,6 +116,8 @@ ARCHFLAGS=""
|
|||||||
COMPILERS=""
|
COMPILERS=""
|
||||||
CFLAGS=""
|
CFLAGS=""
|
||||||
WITH_LOW_MP=""
|
WITH_LOW_MP=""
|
||||||
|
TEST_VS_MTEST=""
|
||||||
|
MTEST_RAND=""
|
||||||
|
|
||||||
while [ $# -gt 0 ];
|
while [ $# -gt 0 ];
|
||||||
do
|
do
|
||||||
@ -124,6 +137,17 @@ do
|
|||||||
--with-low-mp)
|
--with-low-mp)
|
||||||
WITH_LOW_MP="1"
|
WITH_LOW_MP="1"
|
||||||
;;
|
;;
|
||||||
|
--test-vs-mtest=*)
|
||||||
|
TEST_VS_MTEST="${1#*=}"
|
||||||
|
if ! [ "$TEST_VS_MTEST" -eq "$TEST_VS_MTEST" ] 2> /dev/null
|
||||||
|
then
|
||||||
|
echo "--test-vs-mtest Parameter has to be int"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--mtest-real-rand)
|
||||||
|
MTEST_RAND="-DLTM_MTEST_REAL_RAND"
|
||||||
|
;;
|
||||||
--all)
|
--all)
|
||||||
COMPILERS="gcc clang"
|
COMPILERS="gcc clang"
|
||||||
ARCHFLAGS="-m64 -m32 -mx32"
|
ARCHFLAGS="-m64 -m32 -mx32"
|
||||||
@ -161,6 +185,26 @@ fi
|
|||||||
|
|
||||||
_banner
|
_banner
|
||||||
|
|
||||||
|
if [[ "$TEST_VS_MTEST" != "" ]]
|
||||||
|
then
|
||||||
|
make clean > /dev/null
|
||||||
|
_make "${compilers[0]} ${archflags[0]}" "$CFLAGS" "test"
|
||||||
|
echo
|
||||||
|
_make "gcc" "$MTEST_RAND" "mtest"
|
||||||
|
echo
|
||||||
|
echo "Run test vs. mtest for $TEST_VS_MTEST iterations"
|
||||||
|
for i in `seq 1 10` ; do sleep 500 && echo alive; done &
|
||||||
|
alive_pid=$!
|
||||||
|
_timeout=""
|
||||||
|
which timeout >/dev/null && _timeout="timeout --foreground 900"
|
||||||
|
$_TIMEOUT ./mtest/mtest $TEST_VS_MTEST | ./test > test.log
|
||||||
|
disown $alive_pid
|
||||||
|
kill $alive_pid 2>/dev/null
|
||||||
|
head -n 5 test.log
|
||||||
|
tail -n 2 test.log
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
for i in "${compilers[@]}"
|
for i in "${compilers[@]}"
|
||||||
do
|
do
|
||||||
if [ -z "$(which $i)" ]
|
if [ -z "$(which $i)" ]
|
||||||
|
Loading…
Reference in New Issue
Block a user