Skip to content

Commit

Permalink
Merge pull request #7882 from EOSIO/zach-1.8-release-build-test
Browse files Browse the repository at this point in the history
Create Release Build Test
  • Loading branch information
kj4ezj authored Sep 12, 2019
2 parents 744c606 + 76de7c1 commit 57bd078
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .cicd/platforms/amazon_linux-2-unpinned.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
graphviz clang patch 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 && \
Expand Down
2 changes: 1 addition & 1 deletion .cicd/platforms/amazon_linux-2.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
3 changes: 2 additions & 1 deletion .cicd/platforms/centos-7.6-unpinned.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
3 changes: 2 additions & 1 deletion .cicd/platforms/centos-7.6.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
2 changes: 1 addition & 1 deletion .cicd/platforms/macos-10.14.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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@4 pkgconfig doxygen openssl || true
brew install git cmake python@2 python libtool libusb graphviz automake wget gmp llvm@4 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
Expand Down
5 changes: 3 additions & 2 deletions .cicd/platforms/ubuntu-16.04.dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
5 changes: 3 additions & 2 deletions .cicd/platforms/ubuntu-18.04-unpinned.dockerfile
Original file line number Diff line number Diff line change
@@ -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-4.0 clang ccache
libcurl4-gnutls-dev pkg-config patch llvm-4.0 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 && \
Expand Down
5 changes: 3 additions & 2 deletions .cicd/platforms/ubuntu-18.04.dockerfile
Original file line number Diff line number Diff line change
@@ -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 && \
Expand Down
3 changes: 3 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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)

Expand Down Expand Up @@ -86,6 +87,8 @@ 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})
set_property(TEST release-build-test PROPERTY LABELS nonparallelizable_tests)
add_test(NAME version-label-test COMMAND tests/version-label.sh WORKING_DIRECTORY ${CMAKE_BINARY_DIR})

# Long running tests
Expand Down
66 changes: 66 additions & 0 deletions tests/release-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/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 xxd
if ! $(xxd --version 2>/dev/null); then
echo 'ERROR: Test requires xxd, but xxd was not found in your PATH!'
echo ''
echo 'The xxd hex dump tool can be installed as part of the vim-common package on most operating systems.'
exit 1
fi
# find nodeos
[[ $(git --version) ]] && cd "$(git rev-parse --show-toplevel)/build" || cd "$(dirname "${BASH_SOURCE[0]}")/.."
if [[ ! -f programs/nodeos/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 2
fi
# run nodeos to generate state files
mkdir release-build-test
programs/nodeos/nodeos --config-dir "$(pwd)/release-build-test/config" --data-dir "$(pwd)/release-build-test/data" 1>/dev/null 2>/dev/null &
sleep 10
kill $! # kill nodeos gracefully, by PID
if [[ ! -f release-build-test/data/state/shared_memory.bin ]]; then
echo 'ERROR: nodeos state not found!'
echo ''
echo 'Looked for shared_memory.bin in the following places:'
echo "$ ls -la \"$(pwd)/release-build-test/data/state\""
ls -la "$(pwd)/release-build-test/data/state"
echo 'Release build test not run.'
rm -rf release-build-test
exit 3
fi
# test state files for debug flag
export DEBUG_BYTE="$(xxd -seek 9 -l 1 release-build-test/data/state/shared_memory.bin | awk '{print $2}')"
if [[ "$DEBUG_BYTE" == '00' ]]; then
echo 'PASS: Debug flag is not set.'
echo ''
rm -rf release-build-test
exit 0
fi
echo 'FAIL: Debug flag is set!'
echo "Debug Byte = 0x$DEBUG_BYTE"
echo ''
echo 'First kilobyte of shared_memory.bin:'
echo '$ xxd -l 1024 shared_memory.bin'
xxd -l 1024 release-build-test/data/state/shared_memory.bin
rm -rf release-build-test
exit 4

0 comments on commit 57bd078

Please sign in to comment.