diff options
| -rw-r--r-- | .arcconfig | 7 | ||||
| -rw-r--r-- | build_env | 2 | ||||
| -rwxr-xr-x | fb-remote-test.sh | 93 | ||||
| -rwxr-xr-x | fb-smoke.sh | 37 | 
4 files changed, 102 insertions, 37 deletions
diff --git a/.arcconfig b/.arcconfig new file mode 100644 index 00000000000..fb594f62782 --- /dev/null +++ b/.arcconfig @@ -0,0 +1,7 @@ +{ +    "aliases" : { +        "smoke" : [ "!./fb-remote-test.sh" ], +        "test" : [ "!./fb-remote-test.sh --tests=all" ], +        "asan-noleaks" : [ "!./fb-remote-test.sh --tests=all --asan-noleaks" ] +    } +} diff --git a/build_env b/build_env index 74f7c0256e1..46cb18fdd89 100644 --- a/build_env +++ b/build_env @@ -24,7 +24,7 @@ if [ $REDHAT_MAJOR -ge 7 ]; then  fi  export GF_CONF_OPTS -ASAN_ENABLED=0 +ASAN_ENABLED=${ASAN_ENABLED:=0}  # Check if ASAN is enabled  if [ "$ASAN_ENABLED" -eq "1" ]; then      GF_CONF_OPTS="$GF_CONF_OPTS --with-asan" diff --git a/fb-remote-test.sh b/fb-remote-test.sh new file mode 100755 index 00000000000..38648d84fde --- /dev/null +++ b/fb-remote-test.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +source ./test_env + +FBCODE="$HOME/fbsource/fbcode" +N=0 +HOSTS=$(smcc ls-hosts -s gluster.build.ash gluster.build.prn | xargs) +TESTS=$DESIRED_TESTS +FLAKY=$KNOWN_FLAKY_TESTS + +FLAGS="" + +function print_env { +    echo "Settings:" +    echo "FBCODE=$FBCODE" +    echo "N=$N" +    echo -e "-------\nHOSTS\n$HOSTS\n-------" +    echo -e "TESTS\n$TESTS\n-------" +    echo -e "FLAKY\n$FLAKY\n-------" +} + +function cleanup { +    rm -f /tmp/test-*.log +} + +function usage { +    echo "Usage: $0 [-h or --help] [-v or --verbose] +             [--fbcode <fbcode root>] +             [--valgrind] [--asan] [--asan-noleaks] +             [--hosts <hosts>] [--smc-tier <tier name>] [-n <parallelism>] +             [--tests <tests>] [--flaky <tests>] +    " +} + +function tiers_to_hosts { +    hosts="" +    for t in $1; do +        hosts="$hosts $(smcc ls-hosts -s $t | xargs)" +    done +    echo $hosts +} + +function parse_args () { +    args=`getopt \ +            -o hvn: \ +            --long help,verbose,valgrind,asan,asan-noleaks,fbcode:,hosts:,smc-tier:,tests:,flaky: \ +            -n 'fb-remote-test.sh' --  "$@"` + +    if [ $? != 0 ]; then +        echo "Error parsing getopt" +        exit 1 +    fi + +    eval set -- "$args" + +    while true; do +        case "$1" in +            -h | --help) usage ; exit 1 ;; +            --fbcode) FBCODE=$2 ; shift 2 ;; +            -v | --verbose) FLAGS="$FLAGS -v" ; shift ;; +            --valgrind) FLAGS="$FLAGS --valgrind" ; shift ;; +            --asan-noleaks) FLAGS="$FLAGS --asan-noleaks"; shift ;; +            --asan) FLAGS="$FLAGS --asan" ; shift ;; +            --hosts) HOSTS=$2; shift 2 ;; +            --smc-tier) HOSTS=$(tiers_to_hosts $2) ; shift 2 ;; +            --tests) TESTS=$2; shift 2 ;; +            --flaky) FLAKY=$2; shift 2 ;; +            -n) N=$2; shift 2 ;; +            *) break ;; +            esac +        done +        run_tests_args="$@" +} + +function main { +    parse_args "$@" + +    if [ ! -d "$FBCODE" ]; then +        echo "fbcode does not exists. Please checkout fbcode" +        return 1 +    fi + +    print_env + +    cleanup + +    "$FBCODE/storage/gluster/gluster-build/fb-gluster-test.py" $FLAGS --tester \ +        --n "$N" --hosts "$HOSTS" --tests "$TESTS" --flaky_tests "$FLAKY" + +    exit $? +} + +main "$@" diff --git a/fb-smoke.sh b/fb-smoke.sh index a68b9414cd2..4c2c28b7326 100755 --- a/fb-smoke.sh +++ b/fb-smoke.sh @@ -99,30 +99,6 @@ function print_result {      fi  } -function run_remote { -    if [ ! -d "$FBCODE" ]; then -        echo "fbcode does not exists. Please checkout fbcode" -        return 1 -    fi - -    local flags='' -    if [ "$VERBOSE" -eq "1" ]; then -        flags="$flags -v" -    fi - -    if [ "$VALGRIND" -eq "1" ]; then -        flags="$flags --valgrind" -    fi - -    if [ "$ASAN" -eq "1" ]; then -        flags="$flags --asan" -    fi - -    "$FBCODE/storage/gluster/gluster-build/fb-gluster-test.py" $flags --tester \ -        --n "$N" --hosts "$REMOTE_HOSTS" --tests "$REMOTE_TESTS"\ -        --flaky_tests "$REMOTE_FLAKY_TESTS" -} -  #  # Main  # @@ -135,20 +111,9 @@ declare -a FAILED_TESTS  TEST_TIMEOUT=${TEST_TIMEOUT:=300}  SKIP_FLAKY=${SKIP_FLAKY:=1}  STOP_ON_FAIL=${STOP_ON_FAIL:=0} -FBCODE=${FBCODE:="$HOME/fbsource/fbcode"} -N=${N:=0} -REMOTE_HOSTS=${REMOTE_HOSTS:="$(smcc ls-hosts -s gluster.build.ash | xargs)"} -REMOTE=${REMOTE:=0} -REMOTE_TESTS=${REMOTE_TESTS:=$DESIRED_TESTS} -REMOTE_FLAKY_TESTS=${REMOTE_FLAKY_TESTS:=$KNOWN_FLAKY_TESTS} -VERBOSE=${VERBOSE:=0}  VALGRIND=${VALGRIND:=0}  ASAN=${ASAN:=0} - -if [ "$REMOTE" -eq "1" ]; then -    run_remote -    exit $? -fi +ASAN_NOLEAKS=${ASAN_NOLEAKS:=0}  if [ "$SKIP_FLAKY" -eq "0" ]; then      ATTEMPT=${ATTEMPT:=3}  | 
