github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/scripts/run-crossversion-meta.sh (about)

     1  #!/bin/bash
     2  
     3  set -ex
     4  
     5  BRANCH=$(git symbolic-ref --short HEAD)
     6  
     7  TEMPDIR=(`mktemp -d -t crossversion-$(date +%Y-%m-%d-%H-%M-%S)-XXXXXXXXXX`)
     8  
     9  VERSIONS=""
    10  for branch in "$@"
    11  do
    12      git checkout "$branch"
    13      sha=`git rev-parse --short HEAD`
    14  
    15      # If the branch name has a "-<suffix>", pull off the suffix. With the
    16      # crl-release-{XX.X} release branch naming scheme, this will extract the
    17      # {XX.X}.
    18      version=`cut -d- -f3 <<< "$branch"`
    19  
    20      echo "Building $version ($sha)"
    21      go test -c -o "$TEMPDIR/meta.$version.test" ./internal/metamorphic
    22      VERSIONS="$VERSIONS -version $version,$sha,$TEMPDIR/meta.$version.test"
    23  done
    24  
    25  # Return to whence we came.
    26  git checkout $BRANCH
    27  
    28  if [[ -z "${STRESS}" ]]; then
    29      go test ./internal/metamorphic/crossversion \
    30        -test.v \
    31        -test.timeout "${TIMEOUT:-30m}" \
    32        -test.run 'TestMetaCrossVersion$' \
    33        -seed ${SEED:-0} \
    34        -factor ${FACTOR:-10} \
    35        $(echo $VERSIONS)
    36  else
    37      stress -p 1 go test ./internal/metamorphic/crossversion \
    38        -test.v \
    39        -test.timeout "${TIMEOUT:-30m}" \
    40        -test.run 'TestMetaCrossVersion$' \
    41        -seed ${SEED:-0} \
    42        -factor ${FACTOR:-10} \
    43        $(echo $VERSIONS)
    44  fi
    45  
    46  rm -rf $TEMPDIR