Skip to content

Commit

Permalink
Merge pull request #259 from RI-SE/dev
Browse files Browse the repository at this point in the history
June release, version 0.5.0
  • Loading branch information
LukasWikander authored Jun 12, 2020
2 parents 2108c88 + 3980bb5 commit cad6bc1
Show file tree
Hide file tree
Showing 142 changed files with 5,642 additions and 5,791 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
core/traj/** linguist-detectable=false
core/geofence/** linguist-detectable=false
conf/** linguist-detectable=false
50 changes: 50 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)

project(Maestro VERSION 0.5.0)

set(MAESTRO_TEST_DIR ".maestro")
set(MAESTRO_JOURNAL_DIR "${MAESTRO_TEST_DIR}/journal")
set(MAESTRO_TRAJ_DIR "${MAESTRO_TEST_DIR}/traj")
set(MAESTRO_GEOFENCE_DIR "${MAESTRO_TEST_DIR}/geofence")

# Configure structure of output
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_subdirectory(util/C)
add_subdirectory(core)
add_subdirectory(modules/ScenarioControl)
add_subdirectory(modules/Supervision)
add_subdirectory(modules/Visualization)
add_subdirectory(modules/ObjectMonitoring)

# Ensure .maestro directory is created at build time in build directory
add_custom_target(configurationDirectory ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/conf
${CMAKE_BINARY_DIR}/${MAESTRO_CONFIGURATION_DIR}
)
add_custom_target(buildTimeDirectory ALL
COMMAND ${CMAKE_COMMAND} -E make_directory [
${CMAKE_BINARY_DIR}/${MAESTRO_JOURNAL_DIR}
${CMAKE_BINARY_DIR}/${MAESTRO_TRAJ_DIR}
${CMAKE_BINARY_DIR}/${MAESTRO_GEOFENCE_DIR}
]
)

# Create directory for test data in user home directory
install(CODE "MESSAGE(STATUS \"Creating home directory environment under $ENV{HOME}\")")
install(DIRECTORY DESTINATION "$ENV{HOME}/${MAESTRO_TEST_DIR}")
install(DIRECTORY DESTINATION "$ENV{HOME}/${MAESTRO_JOURNAL_DIR}")
install(DIRECTORY DESTINATION "$ENV{HOME}/${MAESTRO_TRAJ_DIR}")
install(DIRECTORY DESTINATION "$ENV{HOME}/${MAESTRO_GEOFENCE_DIR}")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/conf DESTINATION "$ENV{HOME}/${MAESTRO_TEST_DIR}")

install(CODE "execute_process(COMMAND chown -R $ENV{USER} $ENV{HOME}/${MAESTRO_TEST_DIR})")

54 changes: 29 additions & 25 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@

pipeline {
agent any

options {
timeout(time: 15, unit: 'MINUTES')
}
stages {
stage('Build') {
steps {
sh 'echo "Executing build script..."'
sh './buildMaestro.sh'
}
}
stage('Integration testing') {
steps {
sh 'echo "Running Maestro integration tests..."'
sh './allMaestroIntegrationTests.sh'
}
}
stage('Format check') {
steps {
sh 'echo "Running code formatting check..."'
sh './checkCodeFormat.sh'
}
}
}
agent any

options {
timeout(time: 15, unit: 'MINUTES')
}
stages {
stage('Build') {
steps {
sh 'echo "Executing build steps..."'
cmakeBuild cleanBuild: true, buildDir: 'build', installation: 'InSearchPath', steps: [[envVars: 'DESTDIR=${WORKSPACE}/artifacts', withCmake: true]]
}
}
stage('Run tests') {
parallel {
stage('Integration tests') {
steps {
sh 'echo "Running Maestro integration tests..."'
sh './allMaestroIntegrationTests.sh'
}
}
stage('Format check') {
steps {
sh 'echo "Running code formatting check..."'
sh './checkCodeFormat.sh'
}
}
}
}
}
}


36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Maestro server is a communication hub for all test objects. The server monit
<br />
<br />

To build Maestro either usie the build script "buildMaestro.sh" or follow the guide below.
To build Maestro follow the guide below.


## How to build and run the server
Expand All @@ -17,10 +17,9 @@ Clone the repo and make sure you run the following command to update all submodu
git submodule update --init --recursive
```

Navigate to the the repo and enter the build folder
Navigate to the the repo and enter the build directory

```sh
cd server
mkdir build && cd build
```
create project
Expand All @@ -34,21 +33,31 @@ cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
```

make the project
]
```sh
make
cp -R ../conf/ .
```

Create a folder for Trajectory files in /build and move one of the existing trajectory files to this folder.
Start the server
```sh
mkdir traj
cp ../traj/0.traj ./traj/192.168.0.1
cd bin
./Core
```

Start the server
To run one or several of the modules along with Core, modify the runServer.sh script by adding the modules you wish to execute in the variable near the top. Then run the script from the top level directory:
```sh
./runServer.sh
```
To see which modules are available, check the build output inside the ```build/bin``` directory

### Installation
To install the server (recommended) navigate to the build directory and configure the project:
```sh
./TEServer
cd build
cmake -G "Unix Makefiles" ..
```
then build and install the server (be aware that this requires superuser privileges)
```sh
make install
```

## Building the server with CITS module and mqtt
Expand Down Expand Up @@ -83,18 +92,17 @@ make
sudo make install
```

The server will not bu default build the CITS module. This is to prevent the use of the CITS module when it is not necessary. To enable building of the module, run `cmake` from the `build/` directory
The server will not build the CITS module by default. This is to prevent the use of the CITS module when it is not necessary. To enable building of the module, run `cmake` from the `build/` directory
```sh
cmake "Unix Makefiles" -DUSE_CITS:BOOL=TRUE ..
```
then you can build and run the server as normal
```sh
make
./TEServer
make && cd bin
./Core
```

To disable the CITS module, remake the `cmake` procedure

```sh
cmake "Unix Makefiles" -DUSE_CITS:BOOL=FALSE ..
```
Expand Down
37 changes: 22 additions & 15 deletions allMaestroIntegrationTests.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
#!/bin/bash
MAESTRODIR=$(pwd)
cd ${MAESTRODIR}/server/integration-tests
cd ${MAESTRODIR}/core/integration-tests
FAILURES=0
NUM_TESTS=0
NUMBER_REGEX='^[0-9]+'

echo "Running integration tests"
for f in $(pwd)/*; do
rm -f /dev/mqueue/*
if [ ${f: -3} == ".py" ]; then
echo "Running ${f}"
python3 "$f"
if [ "$?" != "0" ]; then
echo "Failed test ${f}"
FAILURES=$((FAILURES+1))
fname="$(basename -- ${f})"
if [[ ${fname:0:3} =~ $NUMBER_REGEX ]] ; then
echo "Running ${fname}"
if [ ${fname: -3} == ".py" ]; then
python3 "$f"
if [ "$?" != "0" ]; then
echo "Failed test ${fname}"
FAILURES=$((FAILURES+1))
fi
NUM_TESTS=$((NUM_TESTS+1))
elif [ ${fname: -3} == ".sh" ]; then
if [ $(sh "$f" -H > /dev/null 2>&1) ]; then
echo "Failed test ${fname}"
FAILURES=$((FAILURES+1))
fi
NUM_TESTS=$((NUM_TESTS+1))
else
echo "Skipping ${fname}"
fi
NUM_TESTS=$((NUM_TESTS+1))
elif [ ${f: -3} == ".sh" ]; then
echo "Running ${f}"
if [ $(sh "$f" -H > /dev/null 2>&1) ]; then
echo "Failed test ${f}"
FAILURES=$((FAILURES+1))
fi
NUM_TESTS=$((NUM_TESTS+1))
else
echo "Skipping ${fname}"
fi
done

Expand Down
52 changes: 0 additions & 52 deletions buildMaestro.sh

This file was deleted.

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions conf/triggeraction.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#trigger_ip;trigger_type[parameter];action_ip;action_type[parameter];
Loading

0 comments on commit cad6bc1

Please sign in to comment.