github.com/matrixorigin/matrixone@v1.2.0/optools/bvt_ut/entrypoint.sh (about)

     1  #!/bin/bash
     2  
     3  set -euo pipefail
     4  
     5  SECONDS=0
     6  
     7  # mv log to mount path
     8  function packLog() {
     9      mv /matrixone-test/mo-service.log /matrixone-test/tester-log
    10      mv /matrixone-test/mo-tester/report /matrixone-test/tester-log
    11      mv /root/scratch /matrixone-test/tester-log
    12  
    13      duration=$SECONDS
    14      echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."
    15  }
    16  
    17  function prepare() {
    18    mkdir /root/scratch
    19    echo ">>>>>>>>>>>>>>>>>>>>>>>> show locale"
    20    echo `locale`
    21  
    22    echo ">>>>>>>>>>>>>>>>>>>>>>>> show launch"
    23    echo "$LAUNCH"
    24  
    25    echo ">>>>>>>>>>>>>>>>>>>>>>> show go env"
    26    echo `go env`
    27  
    28    echo ">>>>>>>>>>>>>>>>>>>>>>>> clone mo-tester"
    29    git clone --depth=1 https://github.com/matrixorigin/mo-tester.git
    30  }
    31  
    32  
    33  function run_ut() {
    34    echo ">>>>>>>>>>>>>>>>>>>>>>>> run unit test"
    35    make ut UT_PARALLEL=${UT_PARALLEL}
    36  }
    37  
    38  function run_bvt() {
    39    echo ">>>>>>>>>>>>>>>>>>>>>>>> build mo service"
    40    make build
    41  
    42    echo ">>>>>>>>>>>>>>>>>>>>>>>> start mo service"
    43     ./optools/run_bvt.sh ./ "${LAUNCH}"
    44  
    45    echo ">>>>>>>>>>>>>>>>>>>>>>>> start bvt"
    46    if [[ "$LAUNCH" == "launch-tae-logservice" ]]; then
    47      echo "> test case: test/cases"
    48      cd mo-tester && ./run.sh -n -g -p /matrixone-test/test/cases 2>&1
    49    else
    50      # use test/distributed/cases as default test cases
    51      echo "> test case: test/distributed/cases"
    52      cd mo-tester && ./run.sh -n -g -p /matrixone-test/test/distributed/cases -e optimistic 2>&1
    53    fi
    54  }
    55  
    56  function bvt_ut() {
    57    trap "packLog" EXIT
    58  
    59    prepare
    60  
    61    if [[ "$ENABLE_UT" == "true" ]]; then
    62      echo ">>>>>>>>>>>>>>>>>>>>>>>> enabled ut"
    63      run_ut
    64    else
    65      echo ">>>>>>>>>>>>>>>>>>>>>>>> disabled ut"
    66    fi
    67  
    68    run_bvt
    69  }
    70  
    71  bvt_ut