summaryrefslogtreecommitdiff
path: root/tools/proof
blob: 2c0fa83607637f0dc0461c23e991103a52b0b732 (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
#!/bin/bash

set -e

ledger_proof() {
    SRC="$1"
    DEST="$2"
    LOGDIR="$3"

    cd "$SRC"
    VERSION=$(git describe --all --long)

    if [[ -f $DEST/last-proofed && $(< $DEST/last-proofed) = $VERSION ]]; then
        echo "No need to run tools/proof again"
        exit 0
    fi

    sudo rm -fr $DEST/ledger-proof
    date > $LOGDIR/ledger-proof.log

    time nice -n 20 \
        ./acprep --debug --doxygen --compiler=g++-4.7 proof -j16 2>&1 | \
        tee -a $LOGDIR/ledger-proof-g++-4.7.log

    time nice -n 20 \
        ./acprep --debug --doxygen --python --compiler=g++-4.7 proof -j16 2>&1 | \
        tee -a $LOGDIR/ledger-proof-g++-4.7-python.log

    time nice -n 20 \
        ./acprep --debug --doxygen --compiler=clang-3.1 proof -j16 2>&1 | \
        tee -a $LOGDIR/ledger-proof-clang-3.1.log
    
    time nice -n 20 \
        ./acprep --debug --doxygen --python --compiler=clang-3.1 proof -j16 2>&1 | \
        tee -a $LOGDIR/ledger-proof-clang-3.1-python.log

    if egrep -q '(ERROR|CRITICAL)' $LOGDIR/ledger-proof.log; then
        mutt -a $LOGDIR/ledger-proof.log \
             -s '[ledger] Proof build FAILED' johnw@newartisans.com <<EOF
Ledger proof build FAILED, at commit $VERSION.
EOF
        if [[ "$1" = "--alert" ]]; then
            notify "Ledger proof build FAILED"
        else
            echo "Ledger proof build FAILED"
            exit 1
        fi
    else
        echo $VERSION > $DEST/last-proofed

        cd $DEST/ledger-proof-python-g++-4.7/debug; make docs
        cd $DEST/ledger-proof-python-g++-4.7/gcov;  make report

        mutt -s '[ledger] Proof build succeeded' johnw@newartisans.com <<EOF
Ledger proof build succeeded! at commit $VERSION.
EOF
        echo "Ledger proof build succeeded"
    fi
}

ledger_proof ${1:-$HOME/src/ledger} ${2:-$HOME/Products} ${3:-$HOME/Library/Logs}

exit 0