summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/flock-build
blob: d80fc6d3d48cea3ea3d959342b620952fe88f1fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#! /bin/sh

BUILD_ARGS="$@"
PARSE="--enable-parse-clocks"
#PARSE=
STD="--enable-simulator"

case "$SIMUL" in
 '') PARALLEL_BUILDS=1
     ;;
 *)  PARALLEL_BUILDS=$SIMUL
esac

case "$PARALLEL_BUILDS" in
 1)  ;;
 *)  echo Launching $PARALLEL_BUILDS parallel builds on each machine
esac

# Backroom:
#   barnstable	   freebsd-6.1
#   beauregard	   freebsd-6.0
# X churchy	   alpha-dec-osf5.1
#   deacon	   sparc-sun-solaris2.10
#   grundoon	   freebsd-6.2
#   howland	   freebsd-6.1
# o macabre	   freebsd-6.1-STABLE
# o mort	   freebsd-6.1
#   whimsy	   sparc-sun-solaris2.10

# Campus:
# * baldwin	   sparc-sun-solaris2.10
# * bridgeport	   sparc-sun-solaris2.10
# * cowbird	   freebsd-6.1
# * malarky	   sparc-sun-solaris2.10
# * pogo	   sparc-sun-solaris2.10
# * rackety	   freebsd-6.1

# HMS: we need $PWD because solaris produces /deacon/backroom when
# we are in /backroom and in general there is no /deacon/backroom.
c_d=${PWD:-`pwd`}

SIG=`perl -e 'print rand'`

case "$LIST" in
 '') LIST="baldwin bridgeport cowbird malarky pogo rackety" ;;
esac

for i in $LIST
do
    SKIPTHIS=0
    [ -f .buildkey-$i ] && SKIPTHIS=1
    case "$SKIPTHIS" in
     1)
        echo flock-build running on $i? check LIST, skipping
        ;;
     0)   
        echo $i
        echo $SIG > .buildkey-$i
        case "1" in
         0)
            ssh $i "cd $c_d ; ./build $SIG $PARSE $STD $BUILD_ARGS" &
            ssh $i "cd $c_d ; ./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS" &
            ssh $i "cd $c_d ; ./build $SIG        $STD --disable-all-clocks $BUILD_ARGS" &
            ;;
         1)
            cat > .flockbuild-$i-$SIG <<ENDQUOT
#!/bin/sh

# depends on job control and expects to be invoked under ssh -tt

cd $c_d
COUNT=0

./build $SIG $PARSE $STD $BUILD_ARGS &

COUNT=\`expr \$COUNT + 1\`
echo $i started build \$COUNT of 4
[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait

./build $SIG $PARSE $STD --disable-debugging $BUILD_ARGS &

COUNT=\`expr \$COUNT + 1\`
echo $i started build \$COUNT of 4
[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait

./build $SIG $PARSE $STD --without-crypto $BUILD_ARGS &

COUNT=\`expr \$COUNT + 1\`
echo $i started build \$COUNT of 4
[ 0 -lt \`expr \$COUNT % $PARALLEL_BUILDS\` ] || wait

./build $SIG        $STD --disable-all-clocks $BUILD_ARGS &

COUNT=\`expr \$COUNT + 1\`
echo $i started build \$COUNT of 4
wait
echo \`date -u '+%H:%M:%S'\` $i flock-build $c_d done.
rm .buildkey-$i
ENDQUOT
           chmod +x .flockbuild-$i-$SIG
           ssh -tt $i "$c_d/.flockbuild-$i-$SIG ; \
                    rm $c_d/.flockbuild-$i-$SIG" 2>/dev/null &
        esac
    esac
done
echo `date -u '+%H:%M:%S'` flock-build launched
OpenPOWER on IntegriCloud