source: branches/profile/util/jenkins_build.sh

Last change on this file was 12885, checked in by westram, 5 years ago
  • get rid of TEST_open_socket failures under jenkins
File size: 4.1 KB
Line 
1#!/bin/bash
2set -x
3set -o errexit
4
5ARG=${1:-}
6
7# set standard variables expected by ARB build
8export ARBHOME=`pwd`
9export PATH=$ARBHOME/bin:$PATH
10export LD_LIBRARY_PATH=$ARBHOME/lib
11
12# OS dependant settings
13OSNAME=`uname -s`
14case $OSNAME in
15  Darwin)
16    export PREFIX=/opt/local
17    export PATH=$PATH:$PREFIX/sbin:$PREFIX/bin
18    export CC=clang
19    export CXX=clang++
20    export MACH=DARWIN
21    ;;
22  Linux)
23    ;;
24  *)
25    echo "Error: unhandled OSNAME '$OSNAME'"
26    false
27    ;;
28esac
29
30# prepare config.makefile
31CFG=config.makefile
32rm -f $CFG
33
34TARSUF=""
35UNIT_TESTS=1
36DEBUG=0
37DEVELOPER="JENKINS" # see ../UNIT_TESTER/README.txt@DEVEL_JENKINS
38
39case $MODE in
40  DEBUG)
41    DEBUG=1
42    TARSUF="-dbg"
43    ;;
44  NDEBUG)
45    TARSUF="-ndbg"
46    ;;
47  RELEASE)
48    DEVELOPER="RELEASE"
49    UNIT_TESTS=0
50    ;;
51  *)
52    echo "Error: unknown MODE '$MODE' passed to jenkins_build.sh"
53    false
54    ;;
55esac
56
57case $OSNAME in
58  Darwin)
59    echo "DARWIN := 1" >> $CFG
60    echo "MACH := DARWIN" >> $CFG
61    UNIT_TESTS=0
62    ;;
63  Linux)
64    echo "LINUX := 1" >> $CFG
65    echo "MACH := LINUX" >> $CFG
66    ;;
67  *)
68    echo "Error: unhandled OSNAME '$OSNAME'"
69    false
70    ;;
71esac
72
73if [ -z "${TGTNAME:-}" ]; then
74    echo "Error: unknown TGTNAME - build refused"
75    false
76fi
77   
78echo "DEBUG := $DEBUG" >> $CFG
79echo "UNIT_TESTS := $UNIT_TESTS" >> $CFG
80echo "OPENGL := 0" >> $CFG
81echo "DEVELOPER := $DEVELOPER" >> $CFG
82echo "DEBUG_GRAPHICS := 0" >> $CFG
83echo "PTPAN := 0" >> $CFG
84echo "ARB_64 := 1" >> $CFG
85echo "TRACESYM := 1" >> $CFG
86echo "COVERAGE := 0" >> $CFG
87# done with config.makefile
88
89# skip build?
90BUILD=1
91if [ "$MODE" == "NDEBUG" -a $UNIT_TESTS == 0 ]; then
92    echo "Modes NDEBUG and RELEASE are identical for $OSNAME"
93    BUILD=0
94fi
95
96# build, tar and test
97if [ $BUILD == 1 ]; then
98    if [ "$ARG" == "fake_build" ]; then
99        echo "Faking build"
100        echo "Faked arb.tgz"     > arb.tgz
101        echo "Faked arb-dev.tgz" > arb-dev.tgz
102    else
103        if [ "$ARG" == "from_tarball" ]; then
104            echo "Test clean before make (tarball build)"
105            make clean
106        fi
107        make build
108        make tarfile_quick
109    fi
110
111    # jenkins archieves all files matching "**/arb*.tgz"
112    # jenkins publishes     files matching "**/arb*.tgz", but not "**/arb*dev*.tgz,**/arb*bin*.tgz"
113
114    if [ -n "${SVN_TAG:-}" ]; then
115        # tagged build
116        VERSION_ID=${SVN_TAG}${TARSUF}
117        # remove arb-prefixes (added below)
118        VERSION_ID="${VERSION_ID##arb[-_]}"
119    else
120        # normal build
121        VERSION_ID=r${SVN_REVISION}${TARSUF}
122    fi
123
124    VERSION_ID=arb-${VERSION_ID}
125    VERSION_ID_TARGET=${VERSION_ID}.${TGTNAME}
126
127    if [ "$MODE" == "RELEASE" ]; then
128        if [ "${TGTNAME}" == "ubuntu1004-amd64" ]; then
129            # perform things needed only once (pack source, copy README + install script):
130            # 1. pack source (svn version of slave and master must match!)
131            if [ "$ARG" == "fake_build" ]; then
132                echo "Faked ${VERSION_ID}-source.tgz" > ${VERSION_ID}-source.tgz
133            else
134                if [ "$ARG" == "from_tarball" ]; then
135                    echo "Note: build from tarball - do not attempt to create a tarball"
136                else
137                    make save
138                    # archived and published on ftp:
139                    cp --dereference arbsrc.tgz ${VERSION_ID}-source.tgz
140                    rm arbsrc*.tgz
141                fi
142            fi
143            # 2. move extra files into folder 'toftp' - content is copied to release directory
144            mkdir toftp
145            cp -p arb_README.txt toftp
146            cp -p arb_install.sh toftp
147            ls -al toftp
148        fi
149
150        # archived and published on ftp:
151        mv arb.tgz ${VERSION_ID_TARGET}.tgz
152    else
153        # only archived (needed by SINA):
154        mv arb.tgz ${VERSION_ID_TARGET}-bin.tgz
155    fi
156    # only archived (needed by SINA):
157    mv arb-dev.tgz ${VERSION_ID_TARGET}-dev.tgz
158
159    make ut
160
161    echo "-------------------- compiled-in version info:"
162    (bin/arb_ntree --help || true)
163    echo "-------------------- existing tarballs:"
164    ls -al arb*.tgz
165    echo "--------------------"
166else
167    echo "Skipping this build."
168    # @@@ maybe need to fake unit-test-result here
169fi
Note: See TracBrowser for help on using the repository browser.