From 9f558be349a92cbc213a1d104600b7363f4c5ad1 Mon Sep 17 00:00:00 2001 From: Scott Arnette Date: Wed, 22 Jan 2020 11:15:45 -0500 Subject: [PATCH] Port multiversion test into main EOS pipeline. --- .cicd/generate-pipeline.sh | 37 +++-- .cicd/helpers/multi_eos_docker.py | 138 ++++++++++++++++++ .cicd/multiversion.sh | 61 ++++++++ .../pinned/ubuntu-18.04-pinned.dockerfile | 3 +- .cicd/test.sh | 4 +- 5 files changed, 220 insertions(+), 23 deletions(-) create mode 100755 .cicd/helpers/multi_eos_docker.py create mode 100755 .cicd/multiversion.sh diff --git a/.cicd/generate-pipeline.sh b/.cicd/generate-pipeline.sh index e2037c9f4..fd9d3ab63 100755 --- a/.cicd/generate-pipeline.sh +++ b/.cicd/generate-pipeline.sh @@ -438,6 +438,23 @@ EOF echo '' fi done +# Execute multiversion test +if ( [[ ! $PINNED == false ]] ); then + cat < "$PIPELINE_CONFIG" +if [[ -f "$PIPELINE_CONFIG" ]]; then + [[ "$DEBUG" == 'true' ]] && cat "$PIPELINE_CONFIG" | jq . + # export environment + if [[ "$(cat "$PIPELINE_CONFIG" | jq -r '.environment')" != 'null' ]]; then + for OBJECT in $(cat "$PIPELINE_CONFIG" | jq -r '.environment | to_entries | .[] | @base64'); do + KEY="$(echo $OBJECT | base64 --decode | jq -r .key)" + VALUE="$(echo $OBJECT | base64 --decode | jq -r .value)" + [[ ! -v $KEY ]] && export $KEY="$VALUE" + done + fi + # export multiversion.conf + echo '[eosio]' > multiversion.conf + for OBJECT in $(cat "$PIPELINE_CONFIG" | jq -r '.configuration | .[] | @base64'); do + echo "$(echo $OBJECT | base64 --decode)" >> multiversion.conf # outer echo adds '\n' + done + mv -f $GIT_ROOT/multiversion.conf $GIT_ROOT/tests +elif [[ "$DEBUG" == 'true' ]]; then + echo 'Pipeline configuration file not found!' + echo "PIPELINE_CONFIG = \"$PIPELINE_CONFIG\"" + echo "RAW_PIPELINE_CONFIG = \"$RAW_PIPELINE_CONFIG\"" + echo '$ pwd' + pwd + echo '$ ls' + ls + echo 'Skipping that step...' +fi +# multiversion +cd $GIT_ROOT/eos_multiversion_builder +echo 'Downloading other versions of nodeos...' +python2.7 $GIT_ROOT/.cicd/helpers/multi_eos_docker.py +cd $GIT_ROOT +cp $GIT_ROOT/tests/multiversion_paths.conf $GIT_ROOT/build/tests +cd $GIT_ROOT/build +# count tests +echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':microscope: ')Running Multiversion Test" +TEST_COUNT=$(ctest -N -L mixed_version_tests | grep -i 'Total Tests: ' | cut -d ':' -f 2 | awk '{print $1}') +if [[ $TEST_COUNT > 0 ]]; then + echo "$TEST_COUNT tests found." +else + echo "+++ $([[ "$BUILDKITE" == 'true' ]] && echo ':no_entry: ')ERROR: No tests registered with ctest! Exiting..." + exit 1 +fi +# run tests +set +e # defer ctest error handling to end +echo "$ ctest -L mixed_version_tests --output-on-failure -T Test" +ctest -L mixed_version_tests --output-on-failure -T Test +EXIT_STATUS=$? +echo 'Done running multiversion test.' +exit $EXIT_STATUS \ No newline at end of file diff --git a/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile b/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile index 7815e219c..2712342e2 100644 --- a/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile +++ b/.cicd/platforms/pinned/ubuntu-18.04-pinned.dockerfile @@ -5,7 +5,8 @@ RUN apt-get update && \ apt-get upgrade -y && \ DEBIAN_FRONTEND=noninteractive apt-get install -y git make \ bzip2 automake libbz2-dev libssl-dev doxygen graphviz libgmp3-dev \ - autotools-dev libicu-dev python2.7 python2.7-dev python3 python3-dev \ + autotools-dev libicu-dev python2.7 python2.7-dev python3 \ + python3-dev python-configparser python-requests python-pip \ autoconf libtool g++ gcc curl zlib1g-dev sudo ruby libusb-1.0-0-dev \ libcurl4-gnutls-dev pkg-config patch ccache vim-common jq # build cmake. diff --git a/.cicd/test.sh b/.cicd/test.sh index 632e714d8..88b09b8f2 100755 --- a/.cicd/test.sh +++ b/.cicd/test.sh @@ -11,9 +11,9 @@ if [[ $(uname) == 'Darwin' ]]; then # macOS else # Linux COMMANDS="$MOUNTED_DIR/$@" . $HELPERS_DIR/file-hash.sh $CICD_DIR/platforms/$PLATFORM_TYPE/$IMAGE_TAG.dockerfile - echo "$ docker run --rm --init -v $(pwd):$MOUNTED_DIR $(buildkite-intrinsics) -e JOBS $FULL_TAG bash -c \"$COMMANDS\"" + echo "$ docker run --rm --init -v $(pwd):$MOUNTED_DIR $(buildkite-intrinsics) -e JOBS -e BUILDKITE_API_KEY $FULL_TAG bash -c \"$COMMANDS\"" set +e # defer error handling to end - eval docker run --rm --init -v $(pwd):$MOUNTED_DIR $(buildkite-intrinsics) -e JOBS $FULL_TAG bash -c \"$COMMANDS\" + eval docker run --rm --init -v $(pwd):$MOUNTED_DIR $(buildkite-intrinsics) -e JOBS -e BUILDKITE_API_KEY $FULL_TAG bash -c \"$COMMANDS\" EXIT_STATUS=$? fi # buildkite