diff --git a/.cicd/platforms/amazon_linux-2-unpinned.dockerfile b/.cicd/platforms/amazon_linux-2-unpinned.dockerfile index ffbcbf6f7aa..3a4110c69f6 100644 --- a/.cicd/platforms/amazon_linux-2-unpinned.dockerfile +++ b/.cicd/platforms/amazon_linux-2-unpinned.dockerfile @@ -5,7 +5,7 @@ RUN yum update -y && \ yum install -y which git sudo procps-ng util-linux autoconf automake \ libtool make bzip2 bzip2-devel openssl-devel gmp-devel libstdc++ libcurl-devel \ libusbx-devel python3 python3-devel python-devel libedit-devel doxygen \ - graphviz clang patch llvm-devel llvm-static + graphviz clang patch llvm-devel llvm-static vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ tar -xzf cmake-3.13.2.tar.gz && \ diff --git a/.cicd/platforms/amazon_linux-2.dockerfile b/.cicd/platforms/amazon_linux-2.dockerfile index 95164fe7167..6cdaddf0d7c 100644 --- a/.cicd/platforms/amazon_linux-2.dockerfile +++ b/.cicd/platforms/amazon_linux-2.dockerfile @@ -5,7 +5,7 @@ RUN yum update -y && \ yum install -y which git sudo procps-ng util-linux autoconf automake \ libtool make bzip2 bzip2-devel openssl-devel gmp-devel libstdc++ libcurl-devel \ libusbx-devel python3 python3-devel python-devel libedit-devel doxygen \ - graphviz patch gcc gcc-c++ + graphviz patch gcc gcc-c++ vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ tar -xzf cmake-3.13.2.tar.gz && \ diff --git a/.cicd/platforms/centos-7.6-unpinned.dockerfile b/.cicd/platforms/centos-7.6-unpinned.dockerfile index f4434ffe9c1..613da74ad7d 100644 --- a/.cicd/platforms/centos-7.6-unpinned.dockerfile +++ b/.cicd/platforms/centos-7.6-unpinned.dockerfile @@ -2,12 +2,13 @@ FROM centos:7.6.1810 ENV VERSION 1 # install dependencies. RUN yum update -y && \ + yum install -y epel-release && \ yum --enablerepo=extras install -y centos-release-scl && \ yum --enablerepo=extras install -y devtoolset-8 && \ yum --enablerepo=extras install -y which git autoconf automake libtool make bzip2 doxygen \ graphviz bzip2-devel openssl-devel gmp-devel ocaml libicu-devel \ python python-devel rh-python36 gettext-devel file libusbx-devel \ - libcurl-devel patch + libcurl-devel patch vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ source /opt/rh/devtoolset-8/enable && \ diff --git a/.cicd/platforms/centos-7.6.dockerfile b/.cicd/platforms/centos-7.6.dockerfile index af419eb3dc9..6e42a57f688 100644 --- a/.cicd/platforms/centos-7.6.dockerfile +++ b/.cicd/platforms/centos-7.6.dockerfile @@ -2,12 +2,13 @@ FROM centos:7.6.1810 ENV VERSION 1 # install dependencies. RUN yum update -y && \ + yum install -y epel-release && \ yum --enablerepo=extras install -y centos-release-scl && \ yum --enablerepo=extras install -y devtoolset-8 && \ yum --enablerepo=extras install -y which git autoconf automake libtool make bzip2 doxygen \ graphviz bzip2-devel openssl-devel gmp-devel ocaml libicu-devel \ python python-devel rh-python36 gettext-devel file libusbx-devel \ - libcurl-devel patch + libcurl-devel patch vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ source /opt/rh/devtoolset-8/enable && \ diff --git a/.cicd/platforms/macos-10.14.sh b/.cicd/platforms/macos-10.14.sh index c2c0862bf64..fe124319d19 100755 --- a/.cicd/platforms/macos-10.14.sh +++ b/.cicd/platforms/macos-10.14.sh @@ -2,7 +2,7 @@ set -eo pipefail VERSION=1 brew update -brew install git cmake python@2 python libtool libusb graphviz automake wget gmp llvm@7 pkgconfig doxygen openssl || true +brew install git cmake python@2 python libtool libusb graphviz automake wget gmp llvm@7 pkgconfig doxygen openssl jq || : if [[ ! $PINNED == false || $UNPINNED == true ]]; then # install clang from source git clone --single-branch --branch release_80 https://git.llvm.org/git/llvm.git clang8 diff --git a/.cicd/platforms/ubuntu-16.04.dockerfile b/.cicd/platforms/ubuntu-16.04.dockerfile index bd38895f2ff..8dc07bc2228 100644 --- a/.cicd/platforms/ubuntu-16.04.dockerfile +++ b/.cicd/platforms/ubuntu-16.04.dockerfile @@ -1,11 +1,12 @@ FROM ubuntu:16.04 ENV VERSION 1 # install dependencies. -RUN apt-get update && apt-get upgrade -y && \ +RUN apt-get update && \ + apt-get upgrade -y && \ DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git automake \ libbz2-dev libssl-dev doxygen graphviz libgmp3-dev autotools-dev libicu-dev \ python2.7 python2.7-dev python3 python3-dev autoconf libtool curl zlib1g-dev \ - sudo ruby libusb-1.0-0-dev libcurl4-gnutls-dev pkg-config apt-transport-https + sudo ruby libusb-1.0-0-dev libcurl4-gnutls-dev pkg-config apt-transport-https vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ tar -xzf cmake-3.13.2.tar.gz && \ diff --git a/.cicd/platforms/ubuntu-18.04-unpinned.dockerfile b/.cicd/platforms/ubuntu-18.04-unpinned.dockerfile index 738a78f280b..cb7473ca98a 100644 --- a/.cicd/platforms/ubuntu-18.04-unpinned.dockerfile +++ b/.cicd/platforms/ubuntu-18.04-unpinned.dockerfile @@ -1,12 +1,13 @@ FROM ubuntu:18.04 ENV VERSION 1 # install dependencies. -RUN apt-get update && apt-get upgrade -y && \ +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 \ autoconf libtool g++ gcc curl zlib1g-dev sudo ruby libusb-1.0-0-dev \ - libcurl4-gnutls-dev pkg-config patch llvm-7-dev clang ccache + libcurl4-gnutls-dev pkg-config patch llvm-7-dev clang ccache vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ tar -xzf cmake-3.13.2.tar.gz && \ diff --git a/.cicd/platforms/ubuntu-18.04.dockerfile b/.cicd/platforms/ubuntu-18.04.dockerfile index 9475df6e5b2..20072008e6d 100644 --- a/.cicd/platforms/ubuntu-18.04.dockerfile +++ b/.cicd/platforms/ubuntu-18.04.dockerfile @@ -1,12 +1,13 @@ FROM ubuntu:18.04 ENV VERSION 1 # install dependencies. -RUN apt-get update && apt-get upgrade -y && \ +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 \ autoconf libtool g++ gcc curl zlib1g-dev sudo ruby libusb-1.0-0-dev \ - libcurl4-gnutls-dev pkg-config patch ccache + libcurl4-gnutls-dev pkg-config patch ccache vim-common jq # build cmake. RUN curl -LO https://cmake.org/files/v3.13/cmake-3.13.2.tar.gz && \ tar -xzf cmake-3.13.2.tar.gz && \ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8f14356bab0..68ea2e96b24 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -47,6 +47,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/validate-dirty-db.py ${CMAKE_CURRENT_ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/launcher_test.py ${CMAKE_CURRENT_BINARY_DIR}/launcher_test.py COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/db_modes_test.sh ${CMAKE_CURRENT_BINARY_DIR}/db_modes_test.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/prod_preactivation_test.py ${CMAKE_CURRENT_BINARY_DIR}/prod_preactivation_test.py COPYONLY) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/release-build.sh ${CMAKE_CURRENT_BINARY_DIR}/release-build.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version-label.sh ${CMAKE_CURRENT_BINARY_DIR}/version-label.sh COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/nodeos_producer_watermark_test.py ${CMAKE_CURRENT_BINARY_DIR}/nodeos_producer_watermark_test.py COPYONLY) @@ -87,6 +88,7 @@ add_test(NAME launcher_test COMMAND tests/launcher_test.py -v --clean-run --dump set_property(TEST launcher_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 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) # Long running tests diff --git a/tests/release-build.sh b/tests/release-build.sh new file mode 100755 index 00000000000..4238df85e3b --- /dev/null +++ b/tests/release-build.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# test name and purpose +echo '' +echo ' ##### Release Build Test #####' +echo '' +echo ' The purpose of this test is to ensure that nodeos was built with compiler' +echo 'optimizations enabled. While there is no way to programmatically determine that' +echo 'given one binary, we do set a debug flag in nodeos when it is built with' +echo 'asserts. This test checks that debug flag. Anyone intending to build and install' +echo 'nodeos from source should perform a "release build" which excludes asserts and' +echo 'debugging symbols, and performs compiler optimizations.' +echo '' +# check for jq +if ! $(jq --version 1>/dev/null); then + echo 'ERROR: Test requires jq, but jq was not found in your PATH!' + echo '' + exit 1 +fi +# find nodeos +[[ $(git --version) ]] && cd "$(git rev-parse --show-toplevel)/build/programs/nodeos" || cd "$(dirname "${BASH_SOURCE[0]}")/../programs/nodeos" +if [[ ! -f nodeos ]]; then + echo 'ERROR: nodeos binary not found!' + echo '' + echo 'I looked here...' + echo "$ ls -la \"$(pwd)/programs/nodeos\"" + ls -la "$(pwd)/programs/nodeos" + echo '...which I derived from one of these paths:' + echo '$ echo "$(git rev-parse --show-toplevel)/build"' + echo "$(git rev-parse --show-toplevel)/build" + echo '$ echo "$(dirname "${BASH_SOURCE[0]}")/.."' + echo "$(dirname "${BASH_SOURCE[0]}")/.." + echo 'Release build test not run.' + exit 1 +fi +# run nodeos to generate state files +./nodeos --extract-build-info build-info.json 1>/dev/null 2>/dev/null +if [[ ! -f build-info.json ]]; then + echo 'ERROR: Build info JSON file not found!' + echo '' + echo 'Looked in the following places:' + echo "$ ls -la \"$(pwd)\"" + ls -la "$(pwd)" + echo 'Release build test not run.' + exit 2 +fi +# test state files for debug flag +if [[ "$(cat build-info.json | jq .debug)" == 'false' ]]; then + echo 'PASS: Debug flag is not set.' + echo '' + rm build-info.json + exit 0 +fi +echo 'FAIL: Debug flag is set!' +echo '' +echo '$ cat build-info.json | jq .' +cat build-info.json | jq . +rm build-info.json +exit 3 \ No newline at end of file