Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from ElektraInitiative/master
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
oleksandr-shabelnyk authored Jun 12, 2019
2 parents a9e3c3e + d64deec commit 2772384
Show file tree
Hide file tree
Showing 44 changed files with 429 additions and 242 deletions.
85 changes: 4 additions & 81 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cmake/ElektraCache.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set (ADDED_BINDINGS

remember_for_removal (TOOLS TO_REMOVE_TOOLS)

set (TOOLS_LIST_DEFAULT kdb gen-gpg-testkey)
set (TOOLS_LIST_DEFAULT kdb)

if (TOOLS MATCHES "DEFAULT")
set (TOOLS_FORCE FORCE)
Expand Down
7 changes: 7 additions & 0 deletions cmake/Modules/LibAddTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ function (add_msr_test NAME FILE)
if (tool_index GREATER -1)
return ()
endif ()

list (FIND TOOLS
${tool}
tool_index)
if (tool_index LESS 0)
return ()
endif ()
endforeach ()

add_test (NAME testshell_markdown_${NAME}
Expand Down
12 changes: 9 additions & 3 deletions doc/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,17 @@ brew install elektra

. We also provide a tap containing a more elaborate formula [here](http://github.com/ElektraInitiative/homebrew-elektra).

## Generic
## Windows

Please refer to the section OS Independent below.

## OS Independent

First follow the steps in [COMPILE](COMPILE.md).

To install Elektra use:
After you completed building Elektra on your own, there are multiple options how to install it. For example, with make or cPack tools.

### make

```sh
sudo make install
Expand All @@ -126,7 +132,7 @@ or in the build directory (will not honor `DESTDIR`!):
xargs rm < install_manifest.txt
```

## CPack
### CPack

First follow the steps in [COMPILE](COMPILE.md).

Expand Down
14 changes: 13 additions & 1 deletion doc/news/_preparation_next_release.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ removed due to:
- New plugin to validate hex formatted colors (e.g. #fff or #abcd) and normalize them to rgba (4294967295 (= 0xffffffff) and 2864434397 (= 0xaabbccdd) respectively). It also has support for named colors according to the [extended color keywords](https://www.w3.org/TR/css-color-3/#svg-color) from CSS3.
_(Philipp Gackstatter)_

### Ini

- Plugin writes to ini files without spaces around '=' anymore. Reading is still possible with and without spaces.
_(Oleksandr Shabelnyk)_

### macaddr

- Added a plugin to handle MAC addresses. `kdbGet` converts a MAC address into a decimal 64-bit integer (with the most significant 16 bits always set to 0), if the format is supported. `kdbSet` restores the converted values back to there original form. _(Thomas Bretterbauer)_
Expand Down Expand Up @@ -536,6 +541,8 @@ mounted, use `kdb gen -F <plugin>:<file> elektra <parentKey> <outputName>` to lo

- For beginners we added a [tutorial](../tutorials/contributing-clion.md) that guides them through the process of contributing to libelektra. _(Thomas Bretterbauer)_
- Added a section on `elektraPluginGetGlobalKeySet` in the plugin tutorial. _(Vid Leskovar)_
- Added a step-by-step [tutorial](../tutorials/run_all_tests_with_docker.md) for running all tests with Docker. _(Oleksandr Shabelnyk)_
- Added a step-by-step [tutorial](../tutorials/run_reformatting_script_with_docker.md) for running reformatting scripts with Docker. _(Oleksandr Shabelnyk)_

### Spelling Fixes

Expand Down Expand Up @@ -572,6 +579,7 @@ mounted, use `kdb gen -F <plugin>:<file> elektra <parentKey> <outputName>` to lo
- Added a new error concept for error codes to be implemented soon. _(Michael Zronek)_
- Added error categorization guidelines to be used with the error concept. _(Michael Zronek)_
- Drastically improved the error message format. For more information look [here](../../doc/decisions/error_message_format.md). _(Michael Zronek)_
- Improved qt-gui error popup to conform with the new error message format. _(Raffael Pancheri)_
- We fixed the format specifiers in the [“Hello, Elektra” example](https://master.libelektra.org/examples/helloElektra.c). _(René Schwaiger)_
- Expanded the Python Tutorial to cover installation under Alpine Linux. _(Philipp Gackstatter)_
- We wrote a tutorial which is intended to [help newcomers contributing to libelektra](../tutorials/contributing-clion.md). _(Thomas Bretterbauer)_
Expand Down Expand Up @@ -623,6 +631,7 @@ mounted, use `kdb gen -F <plugin>:<file> elektra <parentKey> <outputName>` to lo
### CMake

- The build system now rebuilds the [JNA binding](https://www.libelektra.org/bindings/jna) with Maven, if you change any of the Java source files of the binding. _(René Schwaiger)_
- `testshell_markdown_tutorial_crypto` is not compiled and executed if `gen-gpg-testkey` is not part of TOOLS. _(Peter Nirschl)_
- <<TODO>>
- <<TODO>>

Expand Down Expand Up @@ -689,7 +698,10 @@ mounted, use `kdb gen -F <plugin>:<file> elektra <parentKey> <outputName>` to lo
### Travis

- We fixed the value of the `directories` [caching](https://docs.travis-ci.com/user/caching) key in our [Travis config file](../../.travis.yml). _(René Schwaiger)_
- <<TODO>>
- We removed the build job for the [Haskell binding](../../src/bindings/haskell/README.md) and [Haskell plugin](../../src/plugins/haskell/README.md). For more information, please take a look [here](https://issues.libelektra.org/2751). _(Klemens Böswirth)_
- We always use GCC 9 for the build job `🍏 GCC`. This update makes sure that the build job succeeds, even if Homebrew
adds a new major version of the compiler. _(René Schwaiger)_
- We simplified our [Travis configuration file](../../.travis.yml), removing various unnecessary and unused code. In this process we also got rid of the caching directives, we previously used to speed up the Haskell build job `🍏 Haskell`. _(René Schwaiger)_

## Website

Expand Down
4 changes: 2 additions & 2 deletions doc/tutorials/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _Step 2:_ Set the password at `user/tests/password` and display the contents of
```sh
kdb set user/tests/password 1234
kdb file user/tests/password | xargs cat
#> password = 1234
#> password=1234
```

_Step 3:_ (Optional) Cleanup
Expand Down Expand Up @@ -231,7 +231,7 @@ The resulting INI-file contains the following data:

```ini
#@META crypto/encrypt = 1
password = @BASE64IyFjcnlwdG8wMBEAAADwPI+lqp+X2b6BIfLdRYgwxmAhVUPurqkQVAI78Pn4OYONbei4NfykMPvx9C9w91KT
password=@BASE64IyFjcnlwdG8wMBEAAADwPI+lqp+X2b6BIfLdRYgwxmAhVUPurqkQVAI78Pn4OYONbei4NfykMPvx9C9w91KT
```

You can access the password as usual with `kdb get`:
Expand Down
133 changes: 133 additions & 0 deletions doc/tutorials/run_all_tests_with_docker.md
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
```
Loading

0 comments on commit 2772384

Please sign in to comment.