Unify claimtrie tests, add some additional root hash checks #181

Closed
BrannonKing wants to merge 291 commits from unify_claimtrie_tests into master
3 changed files with 41 additions and 8 deletions
Showing only changes of commit 48d51418ef - Show all commits

View file

@ -29,8 +29,8 @@ before_install:
install: true install: true
script: script:
- if [[ "${TARGET}" == "osx" ]]; then ./reproducible_build.sh -t -o -c; fi - if [[ "${TARGET}" == "osx" ]]; then ./reproducible_build.sh -t -o -c -f; fi
- if [[ "${TARGET}" == "linux" ]]; then ./reproducible_build.sh -t -o -c; fi - if [[ "${TARGET}" == "linux" ]]; then ./reproducible_build.sh -t -o -c -f; fi
- if [[ "${TARGET}" == "windows" ]]; then ./packaging/build_windows.sh; fi - if [[ "${TARGET}" == "windows" ]]; then ./packaging/build_windows.sh; fi
- if [[ "${TARGET}" == "osx" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi - if [[ "${TARGET}" == "osx" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi
- if [[ "${TARGET}" == "linux" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi - if [[ "${TARGET}" == "linux" ]]; then zip -j "lbrycrd-${TARGET}.zip" src/lbrycrdd src/lbrycrd-cli src/lbrycrd-tx; fi

View file

@ -53,6 +53,11 @@ If you encounter any errors, please check `doc/build-*.md` for further instructi
Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing) Contributions to this project are welcome, encouraged, and compensated. For more details, see [lbry.io/faq/contributing](https://lbry.io/faq/contributing)
The codebase is in C++03, C++11 is currently not supported but we will be migrating to it in the near future. Recommended GCC version is 4.8 or greater. The codebase is in C++03, C++11 is currently not supported but we will be migrating to it in the near future. Recommended GCC version is 4.8 or greater.
We follow the same coding guidelines as documented by Bitcoin Core, see [here](/doc/developer-notes.md). To run an automated code formatting check, try:
`git diff -U0 master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1`. This will check any commits not on master for proper code formatting.
We try to avoid altering parts of the code that is inherited from Bitcoin Core unless absolutely necessary. This will make it easier to merge changes from
Bitcoin Core. If commits are expected not to be merged upstream (i.e. we broke up a commit from Bitcoin Core in order to use a single feature in it), the commit
message must contain the string "NOT FOR UPSTREAM MERGE".
The `master` branch is regularly built and tested, but is not guaranteed to be The `master` branch is regularly built and tested, but is not guaranteed to be
completely stable. [Releases](https://github.com/lbryio/lbrycrd/releases) are created completely stable. [Releases](https://github.com/lbryio/lbrycrd/releases) are created

View file

@ -16,6 +16,7 @@ function HELP {
echo "Optional arguments:" echo "Optional arguments:"
echo echo
echo "-c: don't clone a fresh copy of the repo" echo "-c: don't clone a fresh copy of the repo"
echo "-f: check formatting of committed code relative to master"
echo "-r: remove intermediate files." echo "-r: remove intermediate files."
echo "-l: build only lbrycrd" echo "-l: build only lbrycrd"
echo "-d: build only the dependencies" echo "-d: build only the dependencies"
@ -27,6 +28,7 @@ function HELP {
CLONE=true CLONE=true
CLEAN=false CLEAN=false
CHECK_CODE_FORMAT=false
BUILD_DEPENDENCIES=true BUILD_DEPENDENCIES=true
BUILD_LBRYCRD=true BUILD_LBRYCRD=true
TIMEOUT=false TIMEOUT=false
@ -35,7 +37,7 @@ THREE_MB=3145728
# the script exits due to a timeout # the script exits due to a timeout
OUTPUT_LOG=true OUTPUT_LOG=true
while getopts :crldoth:w:d: FLAG; do while getopts :crfldoth:w:d: FLAG; do
case $FLAG in case $FLAG in
c) c)
CLONE=false CLONE=false
@ -43,6 +45,9 @@ while getopts :crldoth:w:d: FLAG; do
r) r)
CLEAN=true CLEAN=true
;; ;;
f)
CHECK_CODE_FORMAT=true
;;
l) l)
BUILD_DEPENDENCIES=false BUILD_DEPENDENCIES=false
;; ;;
@ -225,6 +230,12 @@ function install_apt_packages() {
build-essential python-dev libbz2-dev libtool \ build-essential python-dev libbz2-dev libtool \
autotools-dev autoconf git pkg-config wget \ autotools-dev autoconf git pkg-config wget \
ca-certificates automake bsdmainutils ca-certificates automake bsdmainutils
if [ "${CHECK_CODE_FORMAT}" = true ]; then
$SUDO apt-get ${QUIET} install -y --no-install-recommends \
clang-format-3.4
fi
} }
function build_dependencies() { function build_dependencies() {
@ -357,6 +368,14 @@ function build_lbrycrd() {
strip src/test/test_lbrycrd strip src/test/test_lbrycrd
} }
function clang_format_diff(){
# run a code formatting check on any commits not in master
# requires clang-format
git remote add origin2 https://github.com/lbryio/lbrycrd.git
git fetch origin2
git diff -U0 origin2/master -- '*.h' '*.cpp' | ./contrib/devtools/clang-format-diff.py -p1
}
# these variables are needed in both functions # these variables are needed in both functions
LBRYCRD_DEPENDENCIES="$(pwd)/lbrycrd-dependencies" LBRYCRD_DEPENDENCIES="$(pwd)/lbrycrd-dependencies"
OUTPUT_DIR="$(pwd)/build" OUTPUT_DIR="$(pwd)/build"
@ -370,6 +389,15 @@ if [ "${BUILD_DEPENDENCIES}" = true ]; then
build_dependencies build_dependencies
fi fi
if [ "${CHECK_CODE_FORMAT}" = true ]; then
LINES_W_FORMAT_REQUIRED=$(clang_format_diff | wc -l)
if [ ${LINES_W_FORMAT_REQUIRED} -ne 0 ]; then
echo "Failed to pass clang format diff: See below for the diff"
clang_format_diff
exit 1
fi
fi
set +u set +u
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig/:${LIBEVENT_PREFIX}/lib/pkgconfig/" export PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:${OPENSSL_PREFIX}/lib/pkgconfig/:${LIBEVENT_PREFIX}/lib/pkgconfig/"
set -u set -u