libamxb
4.8.2
Bus Agnostic C API
|
The goal of this library is to provide an API that makes it possible to connect to different kinds of software buses and perform actions on it.
This library acts as a mediator between the application using the API and the real bus.
The real implementation (communication with a specific bus) is in the back-ends.
The differences (in functionality and semantics) should be hidden by this library. This will make it easier to write services, applications on top of this API and run it on any bus.
Supported bus features:
Back-end implementations:
You could install all tools needed for testing and developing on your local machine, but it is easier to just use a pre-configured environment. Such an environment is already prepared for you as a docker container.
Install docker
Docker must be installed on your system.
If you have no clue how to do this here are some links that could help you:
Make sure you user id is added to the docker group:
``` sudo usermod -aG docker $USER ```
Fetch the container image
To get access to the pre-configured environment, all you need to do is pull the image and launch a container.
Pull the image:
```bash docker pull registry.gitlab.com/soft.at.home/docker/oss-dbg:latest ```
Before launching the container, you should create a directory which will be shared between your local machine and the container.
```bash mkdir -p ~/amx_project/libraries/ ```
Launch the container:
```bash docker run -ti -d –name oss-dbg –restart always –cap-add=SYS_PTRACE –sysctl net.ipv6.conf.all.disable_ipv6=1 -e "USER=$USER" -e "UID=$(id -u)" -e "GID=$(id -g)" -v ~/amx_project/:/home/$USER/amx_project/ registry.gitlab.com/soft.at.home/docker/oss-dbg:latest ```
If you are using vpn, you need to add --dns 192.168.16.10 --dns 192.168.16.11
to the docker run command.
The -v
option bind mounts the local directory for the ambiorix project in the container, at the exact same place. The -e
options create environment variables in the container. These variables are used to create a user name with exactly the same user id and group id in the container as on your local host (user mapping).
You can open as many terminals/consoles as you like:
```bash docker exec -ti –user $USER oss-dbg /bin/bash ```
Dependency graph - libraries needed by libamxb. For graph simplicity direct dependencies which are also an indirect dependency are not shown.
graph TD; libamxb-->libamxd-->libamxp-->libamxc libamxb-->liburiparser libamxb-->libdl
Clone the git repository
To be able to build it, you need the source code. So open the directory just created for the ambiorix project and clone this library in it (on your local machine).
```bash cd ~/amx_project/libraries/ git clone git@g:prpl-foundation/components/ambiorix/libraries/libamxb.git ``` itla b.com
Install dependencies
Although the container will contain all tools needed for building, it does not contain the libraries needed for building libamxb
. To be able to build libamxb
you need libamxc
, libamxp
and libamxd
. These libraries can be installed in the container.
```bash sudo apt update sudo apt install libamxd ```
Note that you do not need to install all components explicitly. Some components will be installed automatically because the other components depend on them. Some of the components are allready preinstalled in the container.
Build it
When using the internal gitlab, you must define an environment variable VERSION_PREFIX
before building.
```bash export VERSION_PREFIX="master_" ```
After the variable is set, you can build the package.
```bash cd ~/amx_project/libraries/libamxb make ```
You can install your own compiled version easily in the container by running the install target.
From within the container you can create packages.
The packages generated are:
You can copy these packages and extract/install them.
For ubuntu or debian distributions use dpkg:
Install dependencies
Most of the packages needed for testing are allready preinstalled in the container. To be able to test libamxb
you need to extra install libamxo
.
```bash sudo apt update sudo apt install libamxo ```
Run tests
You can run the tests by executing the following command.
```bash cd ~/amx_project/libraries/libamxb/tests make ```
Or this command if you also want the coverage tests to run:
```bash cd ~/amx_project/libraries/libamxb/tests make run coverage ```
The coverage target will generate coverage reports using gcov and gcovr.
A summary for each file (*.c files) is printed in your console after the tests are run. A HTML version of the coverage reports is also generated. These reports are available in the output directory of the compiler used. Example: using native gcc When the output of gcc -dumpmachine
is x86_64-linux-gnu
, the HTML coverage reports can be found at ~/amx_project/libraries/libamxb/output/x86_64-linux-gnu/coverage/report.
You can easily access the reports in your browser. In the container start a python3 http server in background.
Use the following url to access the reports http://<IP ADDRESS OF YOUR CONTAINER>:8080/libraries/libamxb/output/<MACHINE>/coverage/report
You can find the ip address of your container by using the ip
command in the container.
Example:
in this case the ip address of the container is 172.17.0.7
. So the uri you should use is: http://172.17.0.7:8080/libraries/libamxb/output/x86_64-linux-gnu/coverage/report/