1#!/bin/bash
2
3set -e
4
5travis_nanoseconds() {
6  python -c 'import time; print("{:d}".format(int(time.time()*1000000000)))'
7}
8
9travis_start() {
10  travis_timer_id=`printf %08x $(( RANDOM * RANDOM ))`
11  travis_start_time=`travis_nanoseconds`
12  echo -e "travis_time:start:$travis_timer_id\r\033[0m$2"
13  echo -e "travis_fold:start:$1\n$2"
14}
15
16travis_finish() {
17  echo "travis_fold:end:$1"
18  travis_end_time=`travis_nanoseconds`
19  local duration=$(( $travis_end_time - $travis_start_time ))
20  echo -en "\ntravis_time:end:$travis_timer_id:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r\033[0m"
21}
22
23PARALLEL=-j2
24
25# This should be set via .travis.yml depending on the OS/Distribution
26# PARALLEL_CTEST=-j1
27
28travis_start qmake "Building OpenSCAD using qmake"
29export PATH="/usr/local/opt/gettext/bin:$PATH"
30qmake CONFIG+=experimental CONFIG+=nogui && make $PARALLEL
31travis_finish qmake
32
33travis_start cmake "Building tests using cmake"
34
35cd tests
36cmake .
37if [[ $? != 0 ]]; then
38  echo "Error configuring test suite"
39  exit 1
40fi
41make $PARALLEL
42if [[ $? != 0 ]]; then
43  echo "Error building test suite"
44  exit 1
45fi
46
47travis_finish cmake
48
49travis_start ctest "Running tests using ctest"
50
51# Exclude tests known the cause issues on Travis
52# opencsgtest_rotate_extrude-tests - Fails on Ubuntu 12.04 using Gallium 0.4 drivers
53# *_text-font-direction-tests - Fails due to old freetype (issue #899)
54# throwntogethertest_issue964 - Fails due to non-planar quad being tessellated slightly different
55# opencsgtest_issue1165 - z buffer tearing
56
57# Fails on Apple's software renderer:
58# opencsgtest_issue1258
59# throwntogethertest_issue1089
60# throwntogethertest_issue1215
61
62ctest $PARALLEL_CTEST -E "\
63opencsgtest_rotate_extrude-tests|\
64opencsgtest_render-tests|\
65opencsgtest_rotate_extrude-hole|\
66opencsgtest_internal-cavity|\
67opencsgtest_internal-cavity-polyhedron|\
68opencsgtest_minkowski3-erosion|\
69opencsgtest_issue835|\
70opencsgtest_issue911|\
71opencsgtest_issue913|\
72opencsgtest_issue1215|\
73opencsgtest_issue1105d|\
74dxfpngtest_text-font-direction-tests|\
75cgalpngtest_text-font-direction-tests|\
76opencsgtest_text-font-direction-tests|\
77csgpngtest_text-font-direction-tests|\
78svgpngtest_text-font-direction-tests|\
79throwntogethertest_text-font-direction-tests|\
80throwntogethertest_issue964|\
81opencsgtest_issue1165|\
82opencsgtest_issue1258|\
83throwntogethertest_issue1089|\
84throwntogethertest_issue1215\
85$ENV_SPECIFIC_DISABLE"
86if [[ $? != 0 ]]; then
87  echo "Test failure"
88  exit 1
89fi
90
91travis_finish ctest
92