shellfiles/build_mercurial.sh.in
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 14 Nov 2016 23:43:14 +0000
branchjv
changeset 322 9ec2abb1218e
parent 159 40cdb9aa191d
permissions -rw-r--r--
Autoscale testcase-provided timeout to compensate for slooow machines Each test case has a timeout to guard against runaway tests. However on really slow machines the timeout us not big enough. To compensate for this, asses the "speed" of machine running tests and scale default timeout if machine is slower than some (arbitrary) norm. The speed assesment is done by measuring time to run (arbitrary) benchmark code. This has the advantage to reflect actual machine load, not only hardvare spec. However, we may need to play with these magic numbers to make it working. Generally a workaround.

#!/bin/bash 
# Simple Unix shell script to build Mercurial using Jenkins CI
# Designed to run under Cygwin as well. 

PROJECT="Mercurial Support"


m4_include(common.sh.in)

# Checkout
function checkout {
    # Checkout stx
    if [ ! -d stx ]; then
      if ! cvs co stx; then
        error "CVS: Cannot checkout stx";
      fi
    #else
    #  (cd stx && cvs update -d)
    fi

    # Checkout stx:libscm
    repo="https://bitbucket.org/janvrany/stx-libscm"
    if [ ! -d stx/libscm ]; then
        hg clone "$repo" stx/libscm || error "HG: cannot clone stx:libscm"
    else
        hg --cwd stx/libscm pull "$repo" || error "HG: cannot pull stx:libscm"
        hg --cwd stx/libscm update || error "HG: cannot update stx:libscm"
    fi
}


# Compile
function compile {
    TARGETS1="stx stx/libscm/common stx/libscm/mercurial stx/librun"
    for target in $TARGETS1; do
      if ! (cd "$target" && mk); then
        echo "ERROR:  cannot $MAKE in $target"
        exit 3
      fi
    done
}

function runtests {
    sunit "stx:libscm/mercurial"
}


# Now, call main
main $1 $2 $3