diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/jaegertracing/thrift/build/docker/scripts | |
parent | Initial commit. (diff) | |
download | ceph-upstream/16.2.11+ds.tar.xz ceph-upstream/16.2.11+ds.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/thrift/build/docker/scripts')
9 files changed, 236 insertions, 0 deletions
diff --git a/src/jaegertracing/thrift/build/docker/scripts/autotools.sh b/src/jaegertracing/thrift/build/docker/scripts/autotools.sh new file mode 100755 index 000000000..8388f728c --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/autotools.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -ev + +./bootstrap.sh +./configure $* +make check -j3 diff --git a/src/jaegertracing/thrift/build/docker/scripts/cmake.sh b/src/jaegertracing/thrift/build/docker/scripts/cmake.sh new file mode 100755 index 000000000..eb384d552 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/cmake.sh @@ -0,0 +1,22 @@ +#!/bin/sh +set -ev + +CMAKE_FLAGS=$* +MAKEPROG=make + +if ninja --version >/dev/null 2>&1; then + MAKEPROG=ninja + CMAKE_FLAGS="-GNinja $CMAKE_FLAGS" +fi + +mkdir -p cmake_build && cd cmake_build +cmake $CMAKE_FLAGS .. +for LIB in $BUILD_LIBS; do + if ! grep "^BUILD_${LIB}:BOOL=ON$" CMakeCache.txt ; then + echo "failed to configure $LIB" + exit 1 + fi +done +$MAKEPROG -j3 +cpack +ctest -VV diff --git a/src/jaegertracing/thrift/build/docker/scripts/coverity.sh b/src/jaegertracing/thrift/build/docker/scripts/coverity.sh new file mode 100755 index 000000000..ecc7a282e --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/coverity.sh @@ -0,0 +1,40 @@ +#! /bin/bash +# +# This script allows you to run coverity on the project and submit the +# results. Do this inside the docker build container. Only works if +# you are a coverity scan thrift project admin with access to the +# necessary security token. +# +# Environment Variables +# +# COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify +# COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) +# VERSION - the version to report we scanned + +set -ex + +wget -nv https://entrust.com/root-certificates/entrust_l1k.cer -O /tmp/scanca.cer + +pushd /tmp +if [[ "$1" != "--skipdownload" ]]; then + rm -rf coverity_tool.tgz cov-analysis* + wget -nv -O coverity_tool.tgz https://scan.coverity.com/download/cxx/linux64 --post-data "project=thrift&token=$COVERITY_SCAN_TOKEN" + tar xzf coverity_tool.tgz +fi +COVBIN=$(echo $(pwd)/cov-analysis*/bin) +export PATH=$COVBIN:$PATH +popd + +./bootstrap.sh +./configure $* +rm -rf cov-int/ +cov-build --dir cov-int make check -j3 +tail -50 cov-int/build-log.txt +tar cJf cov-int.tar.xz cov-int/ +curl --cacert /tmp/scanca.cer \ + --form token="$COVERITY_SCAN_TOKEN" \ + --form email="$COVERITY_SCAN_NOTIFICATION_EMAIL" \ + --form file=@cov-int.tar.xz \ + --form version="$VERSION" \ + --form description="thrift master" \ + https://scan.coverity.com/builds?project=thrift diff --git a/src/jaegertracing/thrift/build/docker/scripts/covscan.sh b/src/jaegertracing/thrift/build/docker/scripts/covscan.sh new file mode 100755 index 000000000..cb3f283eb --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/covscan.sh @@ -0,0 +1,50 @@ +# +# Coverity Scan Travis build script +# To run this interactively, set the environment variables yourself, +# and run this inside a docker container. +# +# Command-Line Arguments +# +# --skipdownload to skip re-downloading the Coverity Scan build package (large) +# +# Environment Variables (required) +# +# COVERITY_SCAN_NOTIFICATION_EMAIL - email address to notify +# COVERITY_SCAN_TOKEN - the Coverity Scan token (should be secure) +# +# Environment Variables (defaulted) +# +# COVERITY_SCAN_BUILD_COMMAND - defaults to "build/docker/scripts/autotools.sh" +# COVERITY_SCAN_DESCRIPTION - defaults to TRAVIS_BRANCH or "master" if empty +# COVERITY_SCAN_PROJECT - defaults to "thrift" + +set -ex + +COVERITY_SCAN_BUILD_COMMAND=${COVERITY_SCAN_BUILD_COMMAND:-build/docker/scripts/autotools.sh} +COVERITY_SCAN_DESCRIPTION=${COVERITY_SCAN_DESCRIPTION:-${TRAVIS_BRANCH:-master}} +COVERITY_SCAN_PROJECT=${COVERITY_SCAN_PROJECT:-thrift} + +# download the coverity scan package + +pushd /tmp +if [[ "$1" != "--skipdownload" ]]; then + rm -rf coverity_tool.tgz cov-analysis* + wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT" -O coverity_tool.tgz + tar xzf coverity_tool.tgz +fi +COVBIN=$(echo $(pwd)/cov-analysis*/bin) +export PATH=$COVBIN:$PATH +popd + +# build the project with coverity scan + +rm -rf cov-int/ +cov-build --dir cov-int $COVERITY_SCAN_BUILD_COMMAND +tar cJf cov-int.tar.xz cov-int/ +curl --form token="$COVERITY_SCAN_TOKEN" \ + --form email="$COVERITY_SCAN_NOTIFICATION_EMAIL" \ + --form file=@cov-int.tar.xz \ + --form version="$(git describe --tags)" \ + --form description="$COVERITY_SCAN_DESCRIPTION" \ + https://scan.coverity.com/builds?project="$COVERITY_SCAN_PROJECT" + diff --git a/src/jaegertracing/thrift/build/docker/scripts/cross-test.sh b/src/jaegertracing/thrift/build/docker/scripts/cross-test.sh new file mode 100755 index 000000000..43581a5f3 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/cross-test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +set -ev + +./bootstrap.sh +./configure --enable-tutorial=no +make -j3 precross + +set +e +make cross$1 + +RET=$? +if [ $RET -ne 0 ]; then + cat test/log/unexpected_failures.log +fi + +exit $RET diff --git a/src/jaegertracing/thrift/build/docker/scripts/dpkg.sh b/src/jaegertracing/thrift/build/docker/scripts/dpkg.sh new file mode 100755 index 000000000..3ba0cd482 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/dpkg.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -ev + +dpkg-buildpackage -tc -us -uc +ls -al .. diff --git a/src/jaegertracing/thrift/build/docker/scripts/make-dist.sh b/src/jaegertracing/thrift/build/docker/scripts/make-dist.sh new file mode 100755 index 000000000..5a3681e18 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/make-dist.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -ev + +./bootstrap.sh +./configure $* +make dist +tar xvf thrift-*.tar.gz +cd thrift-* +./build/docker/scripts/cmake.sh diff --git a/src/jaegertracing/thrift/build/docker/scripts/sca.sh b/src/jaegertracing/thrift/build/docker/scripts/sca.sh new file mode 100755 index 000000000..42128fc67 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/sca.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -ev + +# +# Generate thrift files so the static code analysis includes an analysis +# of the files the thrift compiler spits out. If running interactively +# set the NOBUILD environment variable to skip the boot/config/make phase. +# + +if [[ -z "$NOBUILD" ]]; then + ./bootstrap.sh + ./configure --enable-tutorial=no + make -j3 precross +fi + +# +# C/C++ static code analysis with cppcheck +# add --error-exitcode=1 to --enable=all as soon as everything is fixed +# +# Python code style check with flake8 +# +# search for TODO etc within source tree +# some statistics about the code base +# some info about the build machine + +# Compiler cppcheck (All) +cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src + +# C++ cppcheck (All) +cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp + +# C Glib cppcheck (All) +cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib + +# Silent error checks +# See THRIFT-4371 : flex generated code triggers "possible null pointer dereference" in yy_init_buffer +cppcheck --force --quiet --inline-suppr --suppress="*:thrift/thriftl.cc" --error-exitcode=1 -j2 compiler/cpp/src +cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp +cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib + +# Python code style +flake8 + +# PHP code style +composer install --quiet +./vendor/bin/phpcs + +# TODO etc +echo FIXMEs: `grep -r FIXME * | wc -l` +echo HACKs: `grep -r HACK * | wc -l` +echo TODOs: `grep -r TODO * | wc -l` + +# LoC +sloccount . + +# System Info +dpkg -l +uname -a diff --git a/src/jaegertracing/thrift/build/docker/scripts/ubsan.sh b/src/jaegertracing/thrift/build/docker/scripts/ubsan.sh new file mode 100755 index 000000000..650dba0a6 --- /dev/null +++ b/src/jaegertracing/thrift/build/docker/scripts/ubsan.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +# Wraps autotools.sh, but each binary crashes if it exhibits undefined behavior. +# Set the undefined behavior flags. This crashes on all undefined behavior except for +# undefined casting, aka "vptr". +# TODO: fix undefined vptr behavior and turn this option back on. + +export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -O0 -ggdb3 -fno-omit-frame-pointer" +export CXXFLAGS="${CFLAGS}" +export LDFLAGS="-lubsan" +export UBSAN_OPTIONS=print_stacktrace=1 + +# +# work around https://svn.boost.org/trac10/ticket/11632 if present +# + +sed -i 's/, stream_t(rdbuf()) /, stream_t(pbase_type::member.get())/g' /usr/include/boost/format/alt_sstream.hpp + +# llvm-symbolizer must be on PATH to get a stack trace on error + +CLANG_PATH="$(mktemp -d)" +trap "rm -rf ${CLANG_PATH}" EXIT +ln -s "$(whereis llvm-symbolizer-4.0 | rev | cut -d ' ' -f 1 | rev)" \ + "${CLANG_PATH}/llvm-symbolizer" +export PATH="${CLANG_PATH}:${PATH}" +llvm-symbolizer -version + +build/docker/scripts/autotools.sh $* |