This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ElektraInitiative/master
merge
- Loading branch information
Showing
44 changed files
with
429 additions
and
242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,6 @@ language: cpp | |
dist: xenial | ||
osx_image: xcode10.2 | ||
|
||
cache: | ||
directories: | ||
- $HOME/.m2 | ||
- $HOME/.cabal | ||
- $HOME/elektra-cabal-sandbox | ||
- $HOME/Library/Caches/Homebrew | ||
|
||
# don't cache our own libraries generated in the build | ||
# so they always get rebuilt properly and to avoid init issues | ||
# we ignore the result as some or all might not exist on build | ||
# errors, in that case unregister would fail | ||
before_cache: | ||
- rm -rf $HOME/.cabal/logs | ||
- cd $HOME/elektra-cabal-sandbox | ||
- cabal sandbox hc-pkg unregister spectranslator > /dev/null; true | ||
- cabal sandbox hc-pkg unregister specelektra > /dev/null; true | ||
- cabal sandbox hc-pkg unregister libfa > /dev/null; true | ||
- cabal sandbox hc-pkg unregister libelektra-haskell > /dev/null; true | ||
- rm -rf .cabal-sandbox/logs | ||
- rm -f .cabal-sandbox/world | ||
- rm -f .cabal-sandbox/add-source-timestamps | ||
|
||
# | ||
# Define the build matrix | ||
# | ||
|
@@ -221,32 +199,15 @@ before_install: | |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then | ||
brew update | ||
brew install ninja | ||
fi | ||
- | | ||
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" != "ON" ]]; then | ||
rvm install 2.5.1 | ||
rvm use 2.5.1 | ||
gem install test-unit --no-document | ||
if [[ "$CC" == "gcc" ]]; then | ||
brew install gcc | ||
brew link --overwrite gcc | ||
gcc_version_major=$(brew info gcc | head -n1 | sed -E 's/[^0-9]*([0-9]+)\..*/\1/') | ||
export CC="gcc-$gcc_version_major" | ||
export CXX="g++-$gcc_version_major" | ||
else | ||
# Use latest version of LLVM to translate the code | ||
brew install llvm | ||
export CC=/usr/local/opt/llvm/bin/clang CXX=/usr/local/opt/llvm/bin/clang++ | ||
# Linking Botan, ANTLR’s C++ runtime, and yaml-cpp using `gcc` fails on macOS | ||
brew install antlr | ||
brew install antlr4-cpp-runtime | ||
brew install botan | ||
brew install yaml-cpp | ||
# Unfortunately Xerces 3.2 causes multiple problems if we translate Elektra with GCC on macOS | ||
brew install xerces-c | ||
# OCLint complains about unknown compiler warning options, if we use GCC as compiler. | ||
brew cask install oclint | ||
brew install gcc@9 | ||
export CC=gcc-9 | ||
export CXX=g++-9 | ||
fi | ||
brew install augeas | ||
brew install bison | ||
brew install dbus | ||
brew install discount | ||
|
@@ -268,44 +229,6 @@ before_install: | |
# start D-Bus session bus | ||
brew services start dbus | ||
fi | ||
- | | ||
if [[ "$TRAVIS_OS_NAME" == "osx" && "$HASKELL" == "ON" ]] ; then | ||
brew install augeas | ||
# 8.4 is currently not supported by hint which we use | ||
brew install [email protected] | ||
brew link [email protected] --force | ||
brew install cabal-install | ||
cabal update | ||
# avoid reinstalls if we already have them cached | ||
PATH=$PATH:"$HOME/.cabal/bin" | ||
which happy || cabal install happy | ||
which alex || cabal install alex | ||
which c2hs || cabal install c2hs | ||
export HASKELL_SHARED_SANDBOX=$HOME/elektra-cabal-sandbox | ||
mkdir -p $HASKELL_SHARED_SANDBOX | ||
cd $HASKELL_SHARED_SANDBOX | ||
cabal sandbox init | ||
# there is some strange cache bug where it complains that one of our own library's | ||
# directory doesn't exist though it gets properly unregistered. Apparently ignoring | ||
# that works anyway. | ||
cabal install --avoid-reinstalls \ | ||
'base >=4.9 && <4.12' \ | ||
'binary >=0.8 && <0.9' \ | ||
'containers >=0.5 && <0.6' \ | ||
'directory >=1.2 && <1.4' \ | ||
'exceptions -any' \ | ||
'haskell-src-exts-any' \ | ||
'hint >=0.7.0 && <0.8.0' \ | ||
'hspec -any' \ | ||
'megaparsec -any' \ | ||
'pretty -any' \ | ||
'process >=1.4 && <1.7' \ | ||
'QuickCheck-any' \ | ||
'simple-logger -any' \ | ||
'temporary -any' \ | ||
'text -any' \ | ||
|| true | ||
fi | ||
- | | ||
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then | ||
[[ -n "$CC_COMPILER" ]] && export CC="$CC_COMPILER" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# Introduction | ||
|
||
Running all the tests like the build server requires to have multiple dependencies installed. To overcome this problem, instead of trying to install all the necessary dependencies on your own, an appropriate Docker image can be used. This way you can easily and quickly run all the tests. | ||
|
||
## Who is this guide for? | ||
|
||
For anyone who wants to run all the tests, like it is done by the build server. | ||
|
||
This is a step-by-step guide. Just follow the steps and you are good to go! | ||
|
||
## Prerequisites | ||
|
||
- Docker for Linux containers has to be preinstalled. Please refer to https://docs.docker.com/install/ if you haven't installed it yet. Your host OS can be either Linux or Windows of course. | ||
- Basic knowledge of Docker (not mandatory) | ||
|
||
## What to begin with? | ||
|
||
### 1. Pick a Docker image and pull it | ||
|
||
Pick one of the available Docker images of Elektra. If you do not know the difference, just pick this one --> "build-elektra-debian-stretch". | ||
Unfortunately, it will take some time to download it, since it is pretty big, but you can be sure you'll have all the needed dependencies. | ||
You can choose a light-weight alpine image which won't take long to download, however it is not recommended. This image does not contain all necessary dependencies. | ||
|
||
If you want to view all the available images, execute this command: | ||
|
||
```sh | ||
docker run --rm anoxis/registry-cli -r https://hub-public.libelektra.org | ||
``` | ||
|
||
You will see something like this: | ||
|
||
```sh | ||
--------------------------------- | ||
Image: build-elektra-debian-stretch | ||
tag: 201906-ecf9161f41a8b472b3b0282a85a9f91d1f0f45357756e5451ae043fce8d0100e | ||
tag: 201902-b6d49f470e1171348248b2f87ef397d58d7a2dae14d201f4073564079ce0c070 | ||
tag: 201903-b95dc56352aa684e16dfb8628bded4c69c712223f5d7ed99ebdd644852a32123 | ||
tag: 201905-ecf9161f41a8b472b3b0282a85a9f91d1f0f45357756e5451ae043fce8d0100e | ||
tag: 201901-6b08855f13ba26e3ad1fa80e399b87df860cc24889f2d1854fa0050834567b26 | ||
tag: 201904-ecf9161f41a8b472b3b0282a85a9f91d1f0f45357756e5451ae043fce8d0100e | ||
tag: 201904-1a6be7b9c3740a2338b14d08c757332cae5254ce58219b6cc2908c7bd6e4f460 | ||
tag: 201903-1a6be7b9c3740a2338b14d08c757332cae5254ce58219b6cc2908c7bd6e4f460 | ||
tag: 201903-6b08855f13ba26e3ad1fa80e399b87df860cc24889f2d1854fa0050834567b26 | ||
tag: 201902-6b08855f13ba26e3ad1fa80e399b87df860cc24889f2d1854fa0050834567b26 | ||
.............................................................................. | ||
``` | ||
|
||
Afterwards pull your desired image as you would do from any public registry: | ||
|
||
```sh | ||
docker pull <image_name>:<tag_name> | ||
``` | ||
|
||
Example: | ||
|
||
```sh | ||
docker pull build-elektra-debian-stretch:201905-9dfe329fec01a6e40972ec4cc71874210f69933ab5f9e750a1c586fa011768ab | ||
``` | ||
|
||
### 2. Run Docker contrainer | ||
|
||
You have to be in the root of the Elektra project, so that the container can properly map all the source files. | ||
|
||
So from your root project folder run the following: | ||
|
||
```sh | ||
docker run -it --rm \ | ||
-v "$PWD:/home/jenkins/workspace" \ | ||
-w /home/jenkins/workspace \ | ||
<image_name>:<tag_name> | ||
``` | ||
|
||
Example: | ||
|
||
```sh | ||
docker run -it --rm \ | ||
-v "$PWD:/home/jenkins/workspace" \ | ||
-w /home/jenkins/workspace \ | ||
build-elektra-debian-stretch:201905-9dfe329fec01a6e40972ec4cc71874210f69933ab5f9e750a1c586fa011768ab | ||
``` | ||
|
||
### 3. Build | ||
|
||
After starting the container, you should be automatically inside it in the working directory `/home/jenkins/workspace`. | ||
|
||
Create folder for building project and cd to it like this: | ||
|
||
```sh | ||
mkdir build-docker && cd build-docker | ||
``` | ||
|
||
Build it with | ||
|
||
```sh | ||
cmake .. \ | ||
-DBINDINGS="ALL;-DEPRECATED;-haskell" \ | ||
-DPLUGINS="ALL;-DEPRECATED" \ | ||
-DTOOLS="ALL" \ | ||
-DENABLE_DEBUG=ON \ | ||
-DKDB_DB_HOME="$PWD" \ | ||
-DKDB_DB_SYSTEM="$PWD/.config/kdb/system" \ | ||
-DKDB_DB_SPEC="$PWD/.config/kdb/system" | ||
``` | ||
|
||
and then with | ||
|
||
```sh | ||
make -j 10 | ||
``` | ||
|
||
Additionally, you may want to install Elektra inside the container, because the installed tests rely on it. | ||
The build server also does this and it is possible that the installed tests have different results (e.g. if test data is missing) | ||
Just run this command: | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
The number 10 can be changed as follows: number of supported simultaneous threads by your CPU + 2. But don't worry, this can only affect the speed of the building, it cannot really break it. | ||
|
||
### 4. Run tests | ||
|
||
Finally run the tests. There are two sets of tests. Run the first one with this command: | ||
|
||
```sh | ||
make run_all | ||
``` | ||
|
||
For the second set to run remember to execute `make install` from the previous step. Run the second set with this command: | ||
|
||
```sh | ||
kdb run_all | ||
``` |
Oops, something went wrong.