Skip to content

Commit

Permalink
Merge 5eeb0c0 into ca2bebb
Browse files Browse the repository at this point in the history
  • Loading branch information
biojppm committed May 2, 2020
2 parents ca2bebb + 5eeb0c0 commit 8a7ec92
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 284 deletions.
12 changes: 6 additions & 6 deletions .ci/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 1) download and install vagrant: https://www.vagrantup.com/downloads.html
# (do not install ubuntu's 14.04 16.04 version, see https://stackoverflow.com/questions/22717428/vagrant-error-failed-to-mount-folders-in-linux-guest ):
# 2) vagrant plugin install vagrant-vbguest
# 3) vagrant up
# 3) vagrant up --provider virtualbox
# 4) vagrant ssh

# All Vagrant configuration is done below. The "2" in Vagrant.configure
Expand All @@ -18,7 +18,7 @@ Vagrant.configure(2) do |config|

# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "travis-ci/ci-minimal-trusty64"
config.vm.box = "generic/ubuntu1804"

# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
Expand All @@ -30,8 +30,8 @@ Vagrant.configure(2) do |config|
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080

config.ssh.username = 'travis'
config.ssh.password = 'travis'
#config.ssh.username = 'travis'
#config.ssh.password = 'travis'

# Create a private network, which allows host-only access to the machine
# using a specific IP.
Expand All @@ -46,7 +46,7 @@ Vagrant.configure(2) do |config|
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "..", "/vagrant"
config.vm.synced_folder "../..", "/vagrant"

#config.vm.synced_folder '.', '/vagrant', disabled: true

Expand Down Expand Up @@ -75,6 +75,6 @@ Vagrant.configure(2) do |config|
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", path: "vagrant-provision.sh"
#config.vm.provision "shell", path: "travis-install.sh"

end
18 changes: 0 additions & 18 deletions .ci/travis-coverage.sh

This file was deleted.

188 changes: 106 additions & 82 deletions .ci/travis-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,101 +3,125 @@
set -e
set -x

# setup apt for installing
#sudo -E add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo bash -c 'cat >> /etc/apt/sources.list <<EOF
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.7 main
#deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.8 main # not needed
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.9 main
deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-4.0 main
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main
deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main
#deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-7.0 main
# Also add the following for the appropriate libstdc++
#deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main
EOF'

#cat /etc/apt/sources.list
#cat /etc/apt/sources.list.d/ubuntu-toolchain-r-test-trusty.list
#sed -n '33p' /etc/apt/sources.list
#sed -n '1p' /etc/apt/sources.list.d/ubuntu-toolchain-r-test-trusty.list

sudo apt-get clean
sudo -E apt-get update
# input environment variables:
# CXX_: the compiler version. eg, g++-9 or clang++-6.0

if [ "$CXX_" == "g++-4.9" ] && [ "$A" == "64" ] ; then DPKG="$DPKG g++-4.9"
elif [ "$CXX_" == "g++-4.9" ] && [ "$A" == "32" ] ; then DPKG="$DPKG g++-4.9 g++-4.9-multilib"
elif [ "$CXX_" == "g++-5" ] && [ "$A" == "64" ] ; then DPKG="$DPKG"
elif [ "$CXX_" == "g++-5" ] && [ "$A" == "32" ] ; then DPKG="$DPKG"
elif [ "$CXX_" == "g++-6" ] && [ "$A" == "64" ] ; then DPKG="$DPKG g++-6"
elif [ "$CXX_" == "g++-6" ] && [ "$A" == "32" ] ; then DPKG="$DPKG g++-6 g++-6-multilib"
elif [ "$CXX_" == "g++-7" ] && [ "$A" == "64" ] ; then DPKG="$DPKG g++-7"
elif [ "$CXX_" == "g++-7" ] && [ "$A" == "32" ] ; then DPKG="$DPKG g++-7 g++-7-multilib"
elif [ "$CXX_" == "g++-8" ] && [ "$A" == "64" ] ; then DPKG="$DPKG g++-8"
elif [ "$CXX_" == "g++-8" ] && [ "$A" == "32" ] ; then DPKG="$DPKG g++-8 g++-8-multilib"
elif [ "$CXX_" == "clang++-3.6" ] ; then DPKG="$DPKG clang-3.6"
elif [ "$CXX_" == "clang++-3.7" ] ; then DPKG="$DPKG clang-3.7"
elif [ "$CXX_" == "clang++-3.8" ] ; then DPKG="$DPKG clang-3.8"
elif [ "$CXX_" == "clang++-3.9" ] ; then DPKG="$DPKG clang-3.9"
elif [ "$CXX_" == "clang++-4.0" ] ; then DPKG="$DPKG clang-4.0"
elif [ "$CXX_" == "clang++-5.0" ] ; then DPKG="$DPKG clang-5.0"
elif [ "$CXX_" == "clang++-6.0" ] ; then DPKG="$DPKG clang-6.0"
elif [ "$CXX_" == "clang++-7" ] ; then DPKG="$DPKG clang-7"
elif [ "$CXX_" == "all" ] ; then
DPKG="$DPKG \
g++-6 g++-6-multilib \
g++-7 g++-7-multilib \
clang-3.6 \
clang-3.7 \
clang-3.8 \
clang-3.9 \
clang-4.0 \
clang-5.0 \
clang-6.0 \
clang-7 \
"
fi
#-------------------------------------------------------------------------------

# add a gcc compiler
function addgcc()
{
version=$1
addpkg g++-$version
addpkg g++-$version-multilib
}

# add a clang compiler
function addclang()
{
version=$1
case $version in
# in 18.04, clang9 and later require PPAs
9 | 10 ) addpkg clang-$version "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-$version main" ;;
* ) addpkg clang-$version ;;
esac
addpkg g++-multilib # this is required for 32 bit https://askubuntu.com/questions/1057341/unable-to-find-stl-headers-in-ubuntu-18-04
addpkg clang-tidy-$version
}

# add a debian package to the list
function addpkg()
{
pkgs=$1
sourceslist=$2
DPKG="$DPKG $pkgs"
#echo "DPKG=$DPKG"
addsrc "$sourceslist" "# for packages: $pkgs"
}

# add an apt source
function addsrc()
{
sourceslist=$1
comment=$2
if [ ! -z "$sourceslist" ] ; then
sudo bash -c "cat >> /etc/apt/sources.list <<EOF
$comment
$sourceslist
EOF"
#cat /etc/apt/sources.list
fi
}


#-------------------------------------------------------------------------------

if [ "$A" == "32" ] ; then
DPKG="$DPKG libc6-dbg:i386"
fi

case $CXX_ in
g++-10 ) addgcc 10 ;;
g++-9 ) addgcc 9 ;;
g++-8 ) addgcc 8 ;;
g++-7 ) addgcc 7 ;;
g++-6 ) addgcc 6 ;;
g++-5 ) addgcc 5 ;;
g++-4.9 ) addgcc 4.9 ;;
clang++-10 ) addclang 10 ;;
clang++-9 ) addclang 9 ;;
clang++-8 ) addclang 8 ;;
clang++-7 ) addclang 7 ;;
clang++-6.0) addclang 6.0 ;;
clang++-5.0) addclang 5.0 ;;
clang++-4.0) addclang 4.0 ;;
clang++-3.9) addclang 3.9 ;;
default)
echo "unknown compiler: $CXX_"
exit 1
;;
esac

if [ "$BT" == "Coverage" ] ; then
DPKG="$DPKG lcov libffi-dev libssl-dev"
addpkg lcov
addpkg libffi-dev
addpkg libssl-dev
fi

if [ ! -z "$DPKG" ] ; then
echo "additional packages: $DPKG"
fi
echo "additional packages: $DPKG"

wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -

sudo -E apt-add-repository --yes --no-update 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo -E add-apt-repository --yes --no-update ppa:ubuntu-toolchain-r/test

sudo -E apt-get clean
sudo -E apt-get update

# g++-5 is needed for clang; otherwise it uses libstdc++ from g++4.8
# which is not fully C++11 and does not have some important type traits
# such as std::is_trivially_move_constructible.
sudo -E apt-get install -y --force-yes \
build-essential \
g++-5 g++-5-multilib \
cmake \
valgrind \
$DPKG
linux-libc-dev:i386 \
libc6:i386 \
libc6-dev:i386 \
libc6-dbg:i386 \
$DPKG \
python3-pip \
python3-setuptools

if [ "$BT" == "Coverage" ]; then
export PATH=~/.local/bin:${PATH};
pip install --user --upgrade pip;
# https://github.com/pypa/pip/issues/5221#issuecomment-381568428
# (via https://github.com/pypa/pip/issues/5240)
hash -d pip || hash -d $(which pip) || echo "WTF???"
# https://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent
pip install --user requests[security] pyopenssl ndg-httpsclient pyasn1
pip install --user cpp-coveralls;
sudo pip3 install \
requests[security] \
pyopenssl \
ndg-httpsclient \
pyasn1 \
cpp-coveralls
fi

export CC_=$(echo "$CXX_" | sed 's:clang++:clang:g' | sed 's:g++:gcc:g')
$CXX_ --version
$CC_ --version
dpkg -s cmake
dpkg -L cmake
which cmake
cmake --version
$CXX_ --version
which $CXX_

RYML_DIR=$(pwd)
echo $RYML_DIR
pwd

exit 0
echo "INSTALL COMPLETE: current directory: $(pwd)"
122 changes: 122 additions & 0 deletions .ci/travis-setenv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
#!/usr/bin/env bash

set -e
set -x

PROJ_DIR=$(pwd)
PROJ_PFX=RYML_

pwd
export CC_=$(echo "$CXX_" | sed 's:clang++:clang:g' | sed 's:g++:gcc:g')
$CXX_ --version
$CC_ --version
cmake --version

# add cmake flags, with prefix
function addcmflags()
{
for f in $* ; do
CMFLAGS="$CMFLAGS -D${PROJ_PFX}${f}"
done
}
function addc4flags()
{
CMFLAGS="$CMFLAGS $*"
}

addcmflags DEV=ON

case "$LINT" in
all ) addcmflags LINT=ON LINT_TESTS=ON LINT_CLANG_TIDY=ON LINT_PVS_STUDIO=ON ;;
clang-tidy) addcmflags LINT=ON LINT_TESTS=ON LINT_CLANG_TIDY=ON LINT_PVS_STUDIO=OFF ;;
pvs-studio) addcmflags LINT=ON LINT_TESTS=ON LINT_CLANG_TIDY=OFF LINT_PVS_STUDIO=ON ;;
* ) addcmflags LINT=OFF ;;
esac

case "$SAN" in
ALL) addcmflags SANITIZE=ON ;;
A ) addcmflags SANITIZE=ON ASAN=ON TSAN=OFF MSAN=OFF UBSAN=OFF ;;
T ) addcmflags SANITIZE=ON ASAN=OFF TSAN=ON MSAN=OFF UBSAN=OFF ;;
M ) addcmflags SANITIZE=ON ASAN=OFF TSAN=OFF MSAN=ON UBSAN=OFF ;;
UB ) addcmflags SANITIZE=ON ASAN=OFF TSAN=OFF MSAN=OFF UBSAN=ON ;;
* ) addcmflags SANITIZE=OFF ;;
esac

case "$SAN_ONLY" in
ON) addcmflags SANITIZE_ONLY=ON ;;
* ) addcmflags SANITIZE_ONLY=OFF ;;
esac

case "$VG" in
ON) addcmflags VALGRIND=ON VALGRIND_SGCHECK=OFF ;; # FIXME SGCHECK should be ON
* ) addcmflags VALGRIND=OFF VALGRIND_SGCHECK=OFF ;;
esac

case "$BM" in
ON) addcmflags BUILD_BENCHMARKS=ON ;;
* ) addcmflags BUILD_BENCHMARKS=OFF ;;
esac

if [ "$STD" != "" ] ; then
addc4flags -DC4_CXX_STANDARD=$STD
addcmflags CXX_STANDARD=$STD
fi

if [ "$BT" == "Coverage" ] ; then
# the coverage repo tokens can be set in the travis environment:
# export CODECOV_TOKEN=.......
# export COVERALLS_REPO_TOKEN=.......
addcmflags COVERAGE_CODECOV=ON COVERAGE_CODECOV_SILENT=ON
addcmflags COVERAGE_COVERALLS=ON COVERAGE_COVERALLS_SILENT=ON
fi

echo "building with additional cmake flags: $CMFLAGS"

export C4_EXTERN_DIR=`pwd`/build/extern
mkdir -p $C4_EXTERN_DIR


function ryml_cfg_test()
{
bits=$1
linktype=$2
#
build_dir=`pwd`/build/$bits-$linktype
install_dir=`pwd`/install/$bits-$linktype
mkdir -p $build_dir
mkdir -p $install_dir
#
case "$linktype" in
static) linktype="-DBUILD_SHARED_LIBS=OFF" ;;
dynamic) linktype="-DBUILD_SHARED_LIBS=ON" ;;
esac
cmake -S $PROJ_DIR -B $build_dir \
-DCMAKE_C_COMPILER=$CC_ -DCMAKE_C_FLAGS="-std=c99 -m$bits" \
-DCMAKE_CXX_COMPILER=$CXX_ -DCMAKE_CXX_FLAGS="-m$bits" \
-DCMAKE_INSTALL_PREFIX="$install_dir" \
-DCMAKE_BUILD_TYPE=$BT \
$CMFLAGS \
$linktype
cmake --build $build_dir --target help | sed 1d | sort
}

function ryml_run_test()
{
bits=$1
linktype=$2
build_dir=`pwd`/build/$bits-$linktype
export CTEST_OUTPUT_ON_FAILURE=1
cmake --build $build_dir --target test
}

function ryml_submit_coverage()
{
if [ "$BT" == "Coverage" ] ; then
bits=$1
linktype=$2
coverage_service=$3
build_dir=`pwd`/build/$bits-$linktype
echo "Submitting coverage data: $build_dir --> $coverage_service"
cmake --build $build_dir --target ryml-coverage-submit-$coverage_service
fi
}

0 comments on commit 8a7ec92

Please sign in to comment.