diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0265efee9c4..e62d5718d31 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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 diff --git a/tests/full-version-label.sh b/tests/full-version-label.sh index 7039fc98415..732727c85b3 100755 --- a/tests/full-version-label.sh +++ b/tests/full-version-label.sh @@ -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) diff --git a/tests/print-build-info.sh b/tests/print-build-info.sh index a9883d573fe..897fa26a7d9 100755 --- a/tests/print-build-info.sh +++ b/tests/print-build-info.sh @@ -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) || :" @@ -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/') diff --git a/tests/version-label.sh b/tests/version-label.sh index 18957916399..3b431be9220 100755 --- a/tests/version-label.sh +++ b/tests/version-label.sh @@ -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