Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
steps:
- label: ':hammer: native build and :mag: test'
command: "./ci/native-build-and-test.sh"
id: native-gcc-build-and-test
command: "./ci/native-gcc-build-and-test.sh"
artifact_paths:
- "build_ci_native/libuavcan"
- "build_ci_native/docs/**/*"
- "build_ci_native_gcc/libuavcan"
- "build_ci_native_gcc/docs/**/*"
plugins:
- docker#v3.1.0:
workdir: /repo
Expand All @@ -12,7 +13,21 @@ steps:
VERBOSE: 1
agents:
queue: 'default'
timeout_in_minutes: 15
- label: ':hammer: native build using clang'
id: native-clang-build
command: "./ci/native-clang-build.sh"
plugins:
- docker#v3.1.0:
workdir: /repo
image: "uavcan/libuavcan:latest"
env:
VERBOSE: 1
agents:
queue: 'default'
timeout_in_minutes: 15
- label: ':hammer: s32k build'
id: ontarget-s32k-build
command: "./ci/ontarget-s32k-build.sh"
artifact_paths:
- "build_ci_ontarget_s32k/**/*.log"
Expand All @@ -28,6 +43,7 @@ steps:
VERBOSE: 1
agents:
queue: 'default'
timeout_in_minutes: 15
- wait
- label: ":mag: ontarget testing"
command: "./ci/ontarget-s32k-test.sh"
Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ file(MAKE_DIRECTORY ${EXTERNAL_PROJECT_DIRECTORY})

set(LIBUAVCAN_INCLUDE "${CMAKE_SOURCE_DIR}/libuavcan/include")
set(LIBUAVCAN_INCLUDE_GENERATED "${CMAKE_CURRENT_BINARY_DIR}/dsdl")
set(LIBUAVCAN_INCLUDE_LVS_PTEST "${CMAKE_SOURCE_DIR}/libuavcan_validation_suite/include")

include_directories(
${LIBUAVCAN_INCLUDE}
${LIBUAVCAN_INCLUDE_GENERATED}
${LIBUAVCAN_INCLUDE_LVS_PTEST}
)

if(NOT LIBUAVCAN_FLAG_SET)
Expand Down Expand Up @@ -55,11 +57,6 @@ find_package(public_regulated_data_types REQUIRED)
#
find_package(gtest REQUIRED)

#
# We generate coverage reports. Please look at them.
#
find_package(lcov REQUIRED)

#
# Finds programs needed to build the libuavcan documentation
#
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ To use visual studio code to debug ontarget tests for the S32K146EVB you'll need
```
{
"cwd": "${workspaceRoot}",
"executable": "build/test_bus.elf",
"executable": "build/test_util_math.elf",
"name": "On-target unit test.",
"request": "launch",
"type": "cortex-debug",
Expand Down
17 changes: 7 additions & 10 deletions ci/native-build-and-test.sh → ci/native-clang-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ set -o pipefail
# | deploy (i.e. There's really no 'I' going on).
# +----------------------------------------------------------+

mkdir -p build_ci_native
pushd build_ci_native
# We build native tests using clang since we use gcc for
# cross-compiling. This gives us coverage by two different
# compilers.
mkdir -p build_ci_native_clang
pushd build_ci_native_clang
# We ensure we can build using clang but we rely on GCC for testing
# since clang's coverage metrics have been broken for the last
# several years.
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/clang-native.cmake \
-DLIBUAVCAN_EXT_FOLDER=build_ci_ext \
-DLIBUAVCAN_EXT_FOLDER=build_ci_ext_clang \
..
make -j4

ctest -VV

make docs
make -j4

popd
49 changes: 49 additions & 0 deletions ci/native-gcc-build-and-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash

# +----------------------------------------------------------+
# | BASH : Modifying Shell Behaviour
# | (https://www.gnu.org/software/bash/manual)
# +----------------------------------------------------------+
# Treat unset variables and parameters other than the special
# parameters ‘@’ or ‘*’ as an error when performing parameter
# expansion. An error message will be written to the standard
# error, and a non-interactive shell will exit.
set -o nounset

# Exit immediately if a pipeline returns a non-zero status.
set -o errexit

# If set, the return value of a pipeline is the value of the
# last (rightmost) command to exit with a non-zero status, or
# zero if all commands in the pipeline exit successfully.
set -o pipefail

# +----------------------------------------------------------+
# | This script is one of the common set of commands run as
# | part of a continuous integration build pipeline.
# | These scrips are named using the following scheme:
# |
# | [build_type]-[(optional)build_type qualifier]-[build|test|report|upload].sh
# |
# | Of course, libuavcan is a header-only distribution so
# | CI is used to verify and test rather than package and
# | deploy (i.e. There's really no 'I' going on).
# +----------------------------------------------------------+

mkdir -p build_ci_native_gcc
pushd build_ci_native_gcc
# GCC is our reference compiler since it does a better job with
# coverage metrics.
cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/gcc-native.cmake \
-DLIBUAVCAN_EXT_FOLDER=build_ci_ext_gcc \
..

make -j4

# TODO: when we integrate with coveralls or codacity run make cov_info
# instead to skip the genhtml step.
make cov_all

make docs

popd
6 changes: 5 additions & 1 deletion cmake/modules/Findlcov.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@


find_program(LCOV lcov)
find_program(GENHTML genhtml)

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(lcov
LCOV_FOUND
)

find_package_handle_standard_args(genhtml
GENHTML_FOUND
)
6 changes: 6 additions & 0 deletions cmake/toolchains/clang-native.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_ASM_COMPILER clang)

# Signal to unit tests that the coverage data will be generated by
# clang so they should try to use llvm-cov if it's available.
# Things are weird between gcov and llvm-cov right now but this
# seems to work in our Ubuntu 18 Docker container, so...?
set(LIBUAVCAN_USE_LLVM_COV ON)
8 changes: 8 additions & 0 deletions cmake/toolchains/gcc-native.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Toolchain for using gcc on what-ever-platform-this-is (aka "native").
#
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
set(CMAKE_ASM_COMPILER gcc)
103 changes: 0 additions & 103 deletions libuavcan/include/libuavcan/bus/can.hpp

This file was deleted.

14 changes: 7 additions & 7 deletions libuavcan/include/libuavcan/introspection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
__attribute__((format(printf, 2, 3)))
# endif
static void
UAVCAN_TRACE(const char* src, const char* fmt, ...)
LIBUAVCAN_TRACE(const char* src, const char* fmt, ...)
{
va_list args;
(void) std::printf("UAVCAN: %s: ", src);
(void) std::printf("LIBUAVCAN: %s: ", src);
va_start(args, fmt);
(void) std::vprintf(fmt, args);
va_end(args);
Expand All @@ -46,18 +46,18 @@ UAVCAN_TRACE(const char* src, const char* fmt, ...)

#else

# define UAVCAN_TRACE(...) ((void) 0)
# define LIBUAVCAN_TRACE(...) ((void) 0)

#endif

#if LIBUAVCAN_INTROSPECTION_ENABLE_ASSERT
# include <cassert>
# define UAVCAN_ASSERT(statement) \
{ \
assert(statement); \
# define LIBUAVCAN_ASSERT(statement) \
{ \
assert(statement); \
}
#else
# define UAVCAN_ASSERT(...) ((void) 0)
# define LIBUAVCAN_ASSERT(...) ((void) 0)
#endif

#endif // LIBUAVCAN_INTROSPECTION_HPP_INCLUDED
Loading