Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Support Running Version Tests on Fresh OS Installs #10233

Merged
merged 7 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ set_property(TEST keosd_auto_launch_test PROPERTY LABELS nonparallelizable_tests
add_test(NAME db_modes_test COMMAND tests/db_modes_test.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
set_tests_properties(db_modes_test PROPERTIES COST 6000)
add_test(NAME release-build-test COMMAND tests/release-build.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME version-label-test COMMAND tests/version-label.sh ${VERSION_FULL} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh ${VERSION_FULL} ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME version-label-test COMMAND tests/version-label.sh "v${VERSION_FULL}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME full-version-label-test COMMAND tests/full-version-label.sh "v${VERSION_FULL}" ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME print-build-info-test COMMAND tests/print-build-info.sh ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

# Long running tests
Expand Down
12 changes: 8 additions & 4 deletions tests/full-version-label.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ set -eo pipefail
# The purpose of this test is to ensure that the output of the "nodeos --full-version" command matches the version string defined by our CMake files
echo '##### Nodeos Full Version Label Test #####'
# orient ourselves
[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT=$(pwd)
[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)"
echo "Using BUILD_ROOT=\"$BUILD_ROOT\"."
EXPECTED=$1
[[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$2"
# test expectations
if [[ -z "$EXPECTED" ]]; then
[[ -z "$BUILDKITE_COMMIT" ]] && export BUILDKITE_COMMIT="$(pushd "$CMAKE_SOURCE_DIR" &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)"
[[ -z "$BUILDKITE_TAG" ]] && export BUILDKITE_TAG="${GIT_TAG:-$1}"
export EXPECTED="$BUILDKITE_TAG-$BUILDKITE_COMMIT"
fi
if [[ -z "$EXPECTED" ]]; then
echo "Missing version input."
exit 1
fi
VERSION_HASH="$(pushd $2 &>/dev/null && git rev-parse HEAD 2>/dev/null ; popd &>/dev/null)"
EXPECTED=v$EXPECTED-$VERSION_HASH
echo "Expecting \"$EXPECTED\"..."
# get nodeos version
ACTUAL=$($BUILD_ROOT/bin/nodeos --full-version)
Expand Down
5 changes: 3 additions & 2 deletions tests/print-build-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ set -eo pipefail
# This includes verifying valid output in JSON shape and checking parameters (only boost for now).
echo '##### Nodeos Print Build Info Test #####'
# orient ourselves
[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)"
[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)"
echo "Using BUILD_ROOT=\"$BUILD_ROOT\"."
[[ -z "$CMAKE_SOURCE_DIR" ]] && export CMAKE_SOURCE_DIR="$1"

exec 9>&1 # enable tee to write to STDOUT as a file
PRINT_BUILD_INFO="$BUILD_ROOT/bin/nodeos --print-build-info 2>&1 | tee >(cat - >&9) || :"
Expand Down Expand Up @@ -44,7 +45,7 @@ if [[ "$PLATFORM_TYPE" == "pinned" ]]; then
echo "Missing IMAGE_TAG variable."
exit 1
fi
FILE=$(ls $1/.cicd/platforms/pinned/$IMAGE_TAG* | head)
FILE=$(ls $CMAKE_SOURCE_DIR/.cicd/platforms/pinned/$IMAGE_TAG* | head)
BOOST=$(cat $FILE | grep boost | tr -d '\r\n' | sed -E 's/^.+boost_([0-9]+_[0-9]+_[0-9]+).+$/\1/' | head)
BOOST_MAJOR=$(echo $BOOST | sed -E 's/^([0-9])+_[0-9]+_[0-9]+$/\1/')
BOOST_MINOR=$(echo $BOOST | sed -E 's/^[0-9]+_([0-9]+)_[0-9]+$/\1/')
Expand Down
8 changes: 6 additions & 2 deletions tests/version-label.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ set -eo pipefail
# The purpose of this test is to ensure that the output of the "nodeos --version" command matches the version string defined by our CMake files
echo '##### Nodeos Version Label Test #####'
# orient ourselves
[[ "$BUILD_ROOT" == '' ]] && BUILD_ROOT="$(pwd)"
[[ -z "$BUILD_ROOT" ]] && export BUILD_ROOT="$(pwd)"
echo "Using BUILD_ROOT=\"$BUILD_ROOT\"."
EXPECTED=v$1
# test expectations
if [[ -z "$EXPECTED" ]]; then
[[ -z "$BUILDKITE_TAG" ]] && export BUILDKITE_TAG="${GIT_TAG:-$1}"
export EXPECTED="$BUILDKITE_TAG"
fi
if [[ -z "$EXPECTED" ]]; then
echo "Missing version input."
exit 1
Expand Down