Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Bidault committed Aug 20, 2018
2 parents 2a4f5fc + f7cef6d commit 60ac713
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 57 deletions.
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM ubuntu:16.04

WORKDIR /app

# common packages
RUN apt-get update && \
apt-get install -y \
ca-certificates curl file tar clang libclang-dev \
build-essential cmake libssl-dev zlib1g-dev \
ruby-dev libboost-dev git wget && \
rm -rf /var/lib/apt/lists/*

# install cucumber package
RUN gem install cucumber -v 2.0.0 --no-rdoc --no-ri

# install rust toolchain
env RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo

RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain 1.20.0 -y

env PATH=/usr/local/cargo/bin:${PATH}

# install arduino toolchain
RUN wget -nv http://arduino.cc/download.php?f=/arduino-1.8.5-linux64.tar.xz -O arduino-1.8.5.tar.xz

RUN tar -xf arduino-1.8.5.tar.xz && \
cd arduino-1.8.5 && \
mkdir -p /usr/share/arduino && \
cp -R * /usr/share/arduino


# Fetch and build cargo deps
RUN mkdir src && echo "fn main() { }" >> build.rs && touch src/tests.rs

COPY ./firmware/brake/kia_soul_ev_niro/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/brake/kia_soul_petrol/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/common/libs/pid/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/steering/tests/property/Cargo.toml .
RUN cargo build

COPY ./firmware/throttle/tests/property/Cargo.toml .
RUN cargo build
119 changes: 67 additions & 52 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,60 +1,75 @@
#!groovy

def cleanCheckout() {
checkout([
$class: 'GitSCM',
branches: scm.branches,
extensions: scm.extensions + [[$class: 'CleanBeforeCheckout']],
userRemoteConfigs: scm.userRemoteConfigs
])
}
node {
checkout scm

def image = docker.build("cmake-build:${env.BUILD_ID}")

def builds = [:]
def output = image.inside {
sh returnStdout: true, script: "cmake -LA ./firmware | grep 'VEHICLE_VALUES' | cut -d'=' -f 2"
}

def platforms = output.trim().tokenize(';')

for(int j=0; j<platforms.size(); j++) {
def platform_idx = j
def platform = platforms[platform_idx]
builds[platform] = {
node {
try {
checkout scm

image = docker.build("cmake-build:${env.BUILD_ID}")

stage("Build ${platform}") {
image.inside {
sh "cd firmware && \
rm -rf build_${platform} && \
mkdir build_${platform} && \
cd build_${platform} && \
cmake -DVEHICLE=${platform} -DCMAKE_BUILD_TYPE=Release .. && \
make"

node('worker'){
def builds = [:]
cleanCheckout()
def output = sh returnStdout: true, script: "cmake -LA ./firmware | grep 'VEHICLE_VALUES' | cut -d'=' -f 2"
def platforms = output.trim().tokenize(';')

for(int j=0; j<platforms.size(); j++) {
def platform_idx = j
def platform = platforms[platform_idx]
builds[platform] = {
node('arduino') {
try {
stage("Checkout") {
cleanCheckout()
}
stage("Build ${platform}") {
sh "cd firmware && mkdir build_${platform} && cd build_${platform} \
&& cmake -DVEHICLE=${platform} -DCMAKE_BUILD_TYPE=Release .. && make"
echo "${platform}: Build Complete!"
}
stage("Test ${platform} unit tests") {
sh "cd firmware && mkdir build_${platform}_tests && \
cd build_${platform}_tests && cmake -DVEHICLE=${platform} \
-DTESTS=ON -DPORT_SUFFIX=${EXECUTOR_NUMBER}${platform_idx} \
-DCMAKE_BUILD_TYPE=Release .. && make run-unit-tests"
echo "${platform}: Unit Tests Complete!"
}
stage("Test ${platform} property-based tests") {
withEnv(["PATH+CARGO=$HOME/.cargo/bin"]) {
sh "cd firmware/build_${platform}_tests && make run-property-tests"
echo "${platform}: Property-Based Tests Complete!"
echo "${platform}: Build Complete!"
}
}

stage("Test ${platform} unit tests") {
image.inside {
sh "cd firmware && \
rm -rf build_${platform}_tests && \
mkdir build_${platform}_tests && \
cd build_${platform}_tests && \
cmake -DVEHICLE=${platform} \
-DTESTS=ON \
-DPORT_SUFFIX=${EXECUTOR_NUMBER}${platform_idx} \
-DCMAKE_BUILD_TYPE=Release \
.. && \
make run-unit-tests"
echo "${platform}: Unit Tests Complete!"
}
}

stage("Test ${platform} property-based tests") {
image.inside("--user root:root") {
sh "cd firmware/build_${platform}_tests && \
make run-property-tests"
echo "${platform}: Property-Based Tests Complete!"
}
}
}
finally {
deleteDir()
}
}
}
}
finally {
deleteDir()
}
}
}
}

try {
parallel builds
}
finally {
deleteDir()
}

try {
parallel builds
}
finally {
deleteDir()
}
}
2 changes: 1 addition & 1 deletion api/include/can_protocols/oscc.dbc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ BO_ 113 BRAKE_DISABLE: 8 BRAKE

BO_ 114 BRAKE_COMMAND: 8 BRAKE
SG_ brake_command_magic : 0|16@1+ (1,0) [0|0] "" BRAKE
SG_ brake_command_pedal_request : 16|32@1+ (1,0) [0|1] "" BRAKE
SG_ brake_command_pedal_request : 16|32@1- (1,0) [0|1] "" BRAKE
SG_ brake_command_reserved : 48|16@1+ (1,0) [0|0] "" BRAKE

BO_ 115 BRAKE_REPORT: 8 BRAKE
Expand Down
10 changes: 8 additions & 2 deletions api/include/vehicles/kia_niro.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@
*/
#define KIA_SOUL_OBD_BRAKE_PRESSURE_CAN_ID ( 0x220 )

/*
* @brief ID of the Kia Niro's OBD throttle pressure CAN frame.
*
*/
#define KIA_SOUL_OBD_THROTTLE_PRESSURE_CAN_ID ( 0x371 )

/*
* @brief ID of the Kia Niro's OBD speed CAN frame.
*
*/
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x371 )
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x52A )

/*
* @brief Factor to scale OBD steering angle to degrees
Expand Down Expand Up @@ -366,7 +372,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down
14 changes: 13 additions & 1 deletion api/include/vehicles/kia_soul_ev.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
*/
#define KIA_SOUL_OBD_BRAKE_PRESSURE_CAN_ID ( 0x220 )

/*
* @brief ID of the Kia Soul's OBD throttle pressure CAN frame.
*
*/
#define KIA_SOUL_OBD_THROTTLE_PRESSURE_CAN_ID ( 0x200 )

/*
* @brief ID of the Kia Niro's OBD speed CAN frame.
*
*/
#define KIA_SOUL_OBD_SPEED_CAN_ID ( 0x524 )

/*
* @brief Factor to scale OBD steering angle to degrees
*
Expand Down Expand Up @@ -339,7 +351,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down
2 changes: 1 addition & 1 deletion api/include/vehicles/kia_soul_petrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ typedef struct
* override.
*
*/
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 1600 )
#define TORQUE_DIFFERENCE_OVERRIDE_THRESHOLD ( 2000 )



Expand Down

0 comments on commit 60ac713

Please sign in to comment.