github.com/KyaXTeam/consul@v1.4.5/build-support/docker/flake.sh (about)

     1  #!/bin/bash
     2  LOG_FILE="test.log"
     3  
     4  cd $GOPATH/$APP
     5  
     6  export PATH=$GOPATH/$APP/bin:$GOPATH/bin:$PATH
     7  
     8  if ! [[ $(ls -l | grep 'GNUmakefile\|README.md\|LICENSE') ]] ; then
     9  	echo "App source not present in cwd. Exiting..."
    10  	exit 1
    11  fi
    12  
    13  mv $TEST_BINARY $TEST_PKG/$TEST_BINARY
    14  cd $TEST_PKG
    15  
    16  for ((i=0; i < $ITERATIONS; i++)) ; do
    17  	echo "$(date +"%F %T") - ($((i+1))/$ITERATIONS)"
    18  	
    19  	./$TEST_BINARY -test.run "$TEST" -test.parallel 4 -test.timeout 8m -test.v &> $LOG_FILE
    20  	echo $? > exit-code
    21  
    22  	grep -A10 'panic: ' $LOG_FILE || true
    23  	awk '/^[^[:space:]]/ {do_print=0} /--- SKIP/ {do_print=1} do_print==1 {print}' $LOG_FILE
    24  	awk '/^[^[:space:]]/ {do_print=0} /--- FAIL/ {do_print=1} do_print==1 {print}' $LOG_FILE
    25  
    26  	if [ $(cat exit-code) != "0" ] ; then
    27  		exit 1;
    28  	fi
    29  done