github.com/turingchain2020/turingchain@v1.1.21/build/autotest/run.sh (about) 1 #!/usr/bin/env bash 2 3 set -e 4 set -o pipefail 5 #set -o verbose 6 #set -o xtrace 7 8 # os: ubuntu16.04 x64 9 10 TURINGCHAIN_PATH=../../ 11 12 function copyAutoTestConfig() { 13 14 declare -a TuringchainAutoTestDirs=("${TURINGCHAIN_PATH}/system") 15 echo "#copy auto test config to path \"$1\"" 16 local AutoTestConfigFile="$1/autotest.toml" 17 18 #pre config auto test 19 { 20 21 echo 'cliCmd="./turingchain-cli"' 22 echo "checkTimeout=60" 23 } >"${AutoTestConfigFile}" 24 25 #copy all the dapp test case config file 26 for rootDir in "${TuringchainAutoTestDirs[@]}"; do 27 28 if [[ ! -d ${rootDir} ]]; then 29 continue 30 fi 31 32 testDirArr=$(find "${rootDir}" -type d -name autotest) 33 34 for autotest in ${testDirArr}; do 35 36 dapp=$(basename "$(dirname "${autotest}")") 37 dappConfig=${autotest}/${dapp}.toml 38 39 #make sure dapp have auto test config 40 if [ -e "${dappConfig}" ]; then 41 42 cp "${dappConfig}" "$1"/ 43 44 #add dapp test case config 45 { 46 echo "[[TestCaseFile]]" 47 echo "dapp=\"$dapp\"" 48 echo "filename=\"$dapp.toml\"" 49 } >>"${AutoTestConfigFile}" 50 51 fi 52 53 done 54 done 55 } 56 57 function copyTuringchain() { 58 59 echo "# copy turingchain bin to path \"$1\", make sure build turingchain" 60 cp ../turingchain ../turingchain-cli ../turingchain.toml "$1" 61 cp "${TURINGCHAIN_PATH}"/cmd/turingchain/turingchain.test.toml "$1" 62 } 63 64 function copyAll() { 65 66 dir="$1" 67 #check dir exist 68 if [[ ! -d ${dir} ]]; then 69 mkdir "${dir}" 70 fi 71 cp autotest "${dir}" 72 copyAutoTestConfig "${dir}" 73 copyTuringchain "${dir}" 74 echo "# all copy have done!" 75 } 76 77 function main() { 78 79 dir="$1" 80 copyAll "$dir" && cd "$dir" && ./autotest.sh "${@:2}" && cd ../ 81 82 } 83 84 main "$@"