Skip to content

Commit

Permalink
Merge pull request #189 from RI-SE/dev
Browse files Browse the repository at this point in the history
Master-merge
  • Loading branch information
LukasWikander authored Jan 10, 2020
2 parents 93d749c + 361fc23 commit 2108c88
Show file tree
Hide file tree
Showing 130 changed files with 105,492 additions and 53,795 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
*.obj
*.elf

# Compiled python code
*.pyc

# Precompiled Headers
*.gch
*.pch
Expand Down Expand Up @@ -39,3 +42,7 @@
# Catalogs
build*/
PlaygroundPlatform*/

# Autosave files
*.save
*.autosave
30 changes: 30 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

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'
}
}
}
}


67 changes: 65 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# Chronos test server
# Maestro
<img align="left" width="100" height="100" src="https://github.com/RI-SE/Maestro/blob/dev/server/src/icon/MaestroICON.svg">

The Maestro server is a communication hub for all test objects. The server monitors and controls the test objects and is also responsible for creating logfiles.

<br />
<br />

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


## How to build and run the server

Clone the repo and make sure you run the following command to update all submodules:

```sh
git submodule update --init --recursive
```

Navigate to the the repo and enter the build folder

```sh
Expand All @@ -28,14 +43,62 @@ cp -R ../conf/ .
Create a folder for Trajectory files in /build and move one of the existing trajectory files to this folder.
```sh
mkdir traj
cp ../traj/0.traj ./traj/192.168.0.1
cp ../traj/0.traj ./traj/192.168.0.1
```

Start the server
```sh
./TEServer
```

## Building the server with CITS module and mqtt

The CITS module uses PAHO MQTT, which can be found through the following link:
https://www.eclipse.org/paho/

To be able to run the server with the CITS module you must first build and install paho mqtt.

Paho mqtt requires OpenSSL to be able to run. To install OpenSSL do
```sh
apt-get install libssl-dev
```
In order to get and build the documentation for paho mqtt, do the following
```sh
apt-get install doxygen graphviz
```

Now get the latest source code for paho mqtt
```sh
git clone https://github.com/eclipse/paho.mqtt.c.git
```

Go to the root of the cloned git repo and build the documentation by doing
```sh
cd paho.mqtt.c.git
make html
```
This will build the documentation for all the code. Then proceede to build and install paho
```sh
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
```sh
cmake "Unix Makefiles" -DUSE_CITS:BOOL=TRUE ..
```
then you can build and run the server as normal
```sh
make
./TEServer
```

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

```sh
cmake "Unix Makefiles" -DUSE_CITS:BOOL=FALSE ..
```

# To communicate with server start program.
./UserControl [IP] [port]

Expand Down
31 changes: 31 additions & 0 deletions allMaestroIntegrationTests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
MAESTRODIR=$(pwd)
cd ${MAESTRODIR}/server/integration-tests
FAILURES=0
NUM_TESTS=0

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))
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))
fi
done

SUCCESSES=$((NUM_TESTS-$FAILURES))
echo "Tests passed: ${SUCCESSES} / ${NUM_TESTS}"

exit $FAILURES
55 changes: 46 additions & 9 deletions buildMaestro.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
#!/bin/sh
export PATH=$PATH:/usr/bin

if [ $USER = "jenkins" ] || [ $USER = "tomcat" ]; then
# Show jenkins environment
echo "Running as ${USER} with environment"
printenv
rm -rf ~/.maestro
fi

MAESTRODIR=$(pwd)
git submodule update --init --recursive
git submodule update --init --recursive || exit 1

# Build util
cd util/C
cmake -G "Unix Makefiles" .
make
echo "Building util"
cmake -G "Unix Makefiles" . && make || exit 1

# Build core modules
cd $MAESTRODIR/server
mkdir build
cd build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug ..
cp -R ../conf/ .
mkdir traj && mkdir log
cp ../traj/0.traj ./traj/127.0.0.1
make
cd $MAESTRODIR
echo "Building core modules"
cmake -G "Unix Makefiles" -DUSE_CITS:BOOL=FALSE -DCMAKE_BUILD_TYPE=Debug .. && make || exit 1

# Build ScenarioControl module
mkdir $MAESTRODIR/modules/ScenarioControl/build
cd $MAESTRODIR/modules/ScenarioControl/build
echo "Building ScenarioControl"
cmake .. && make || exit 1

# Build Supervision module
mkdir $MAESTRODIR/modules/Supervision/build
cd $MAESTRODIR/modules/Supervision/build
echo "Building Supervision"
cmake .. && make || exit 1

# Set up running directory in home
cd
echo "Setting up running directory"
if [ ! -d ".maestro" ]; then
mkdir .maestro
cd .maestro
mkdir journal
mkdir traj
mkdir conf
mkdir geofence
cp -R $MAESTRODIR/server/conf/ .
else
echo "Running directory already exists, nothing to do"
fi

40 changes: 40 additions & 0 deletions checkCodeFormat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

if ! git diff-index --quiet HEAD --; then
echo "Uncommitted changes detected: please commit changes before checking code format"
exit 1
fi

./formatSourceFiles.sh
git diff > formatDiff.patch

# Reset changes made
find . -iname "*.c" -a -not -ipath "*ASN1*" -a -not -ipath "*CMakeFiles*" -a -not -ipath "*util/*" | xargs git checkout --

if [ ! -s formatDiff.patch ]; then
# It was empty
rm formatDiff.patch
echo "No code formatting errors detected"
exit 0
else
echo "Formatting errors detected. Attempting to fix ..."
rm formatDiff.patch

./formatSourceFiles.sh
./formatSourceFiles.sh

git diff > formatDiff.patch

find . -iname "*.c" -a -not -ipath "*ASN1*" -a -not -ipath "*CMakeFiles*" -a -not -ipath "*util/*" | xargs git checkout --

if [ ! -s formatDiff.patch ]; then
rm formatDiff.patch
echo "No code formatting errors detected after rerun"
exit 0
else
# Very wordy printout:
cat formatDiff.patch
rm formatDiff.patch
exit 1
fi
fi
101 changes: 101 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Last edited 15/10- 2019

Contents
==============================
[v.0.4.0 December Server-Snapshot](#December-release-v040---serversnapshot)

[v.0.3.0 Trigger and Action](#maestro-v030-trigger-and-action)

[v.0.2.0 July Server-snapshot](#july-release-v020---serversnapshot)

[v.0.1.0 Drottning Kristina](drottning-kristina-v010)

December release v0.4.0 - ServerSnapshot
==============================

This version is compatible with Maestro-Tools v0.4.0 and Util v0.4.0

New Features
-------

1. Supervisor now is its own c++ module.
2. Supervisor now sends disarm if any object is not within a short distance to its starting position and somewhat aligned to the trajectory
3. Supervisor now sends disconnect if any trajectory files do not match its standards (right now, its standards only state that the files should be parseable)
4. Supervisor now sends abort if an object exits a permitted geofence or enters a forbidden one

Enhancements
-------
1. Implemented testing utility which allows starting an executable and polling its status from Python
2. Implemented test which starts and kills core executable, failing if one or more modules crash before the killing commences
3. Implemented testing utility which emulates external MSCP communication to system control
4. Implemented testing utility which checks availability of ports
5. Implemented testing utility which opens and parses a trajectory file
6. Implemented test which connects via MSCP and sends initializeScenario, after which it disconnects. It fails if the MSCP connection fails or the server crashes
7. Implemented test which steps through the "normal" test procedure i.e. connect MSCP, upload file, init, connect, arm, start, abort, reset


Fixed bugs
-------
- MQ priorities were wrong: highest priority was lowest. This has been remedied.
- Fixed error in C-ITS control DENM timestamps
- Fixed mismatch with ISO HEAB, MONR, STRT, TRAJ based on 4a workshop

Maestro v0.3.0 Trigger and Action
==============================

This version is compatible with Maestro-Tools v0.3.0 and Util v0.3.0

New Features
-------

1. Server is now able to send and handle basic Trigger and Action messages. More specifically EXAC and ACCM.
2. Brake detection algorithm for creating an internal trigger event
3. C-ITS control initial implementation of CAM and DENM messages for demo


Enhancements
-------
The location for all files necessary to run the server has can now be defined. Defaults to ~/.maestro


Fixed bugs
-------
Uploading .traj files from the GUC no longer results in a corrupted file with POST messages at the end.


July release v0.2.0 - ServerSnapshot
==============================

This version is compatible with the July release of Maestro-Tools and the July release of util

New Features
-------

1. Geofencing has been enabled. Server checks if an object is located inside or outside a given geofence and prints this to terminal.
2. MQbus defined in the util repo is now beeing used instead of the old message


"Enhancements"
-------
Latidude spelling error has been changed to Latitude


Fixed bugs
-------
Server no longer creates Junk files in root directory

Drottning Kristina v0.1.0
==============================

This version is compatible with the Drottning Kristina release of Maestro-Tools

New Features
-------

1. Server now has a new and improved logger
2. Server has an UDP connection to the GUC which is used to send MONR

Enhancements
-------
iCommReceive now has UTC timestamp

Binary file added doc/DrawIOBugDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2108c88

Please sign in to comment.