From ad2082db758caa131cefa7a25ffa1dfd43955a32 Mon Sep 17 00:00:00 2001
From: kongr45gpen <electrovesta@gmail.com>
Date: Sun, 18 Nov 2018 14:18:46 +0200
Subject: [PATCH] Show CI tests in Gitlab

---
 .gitlab-ci.yml    | 9 +++++++--
 CMakeLists.txt    | 6 +++---
 ci/clang-tidy.sh  | 2 +-
 tests/Message.cpp | 2 +-
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3289ff7a..baebf0ef 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,8 +20,13 @@ tests:
   stage: test
   script:
     - cmake .
-    - make tests -j4
-    - ./tests
+    - make test -j4
+    - ./test
+  after_script:
+    - ./test -r junit -o junit.xml
+  artifacts:
+    reports:
+      junit: junit.xml
 
 cppcheck:
   stage: build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ecb94afa..764116df 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,8 +16,8 @@ add_custom_target(check
 # Specify the .cpp files for the executables
 add_executable(ecss_services src/main.cpp src/Message.cpp src/Service.cpp src/Services/TestService.cpp)
 
-IF(EXISTS lib/Catch2/CMakeLists.txt)
+IF(EXISTS "${PROJECT_SOURCE_DIR}/lib/Catch2/CMakeLists.txt")
 add_subdirectory(lib/Catch2)
-add_executable(tests src/Message.cpp src/Service.cpp src/Services/TestService.cpp tests/tests.cpp tests/Message.cpp)
-target_link_libraries(tests Catch2::Catch2)
+add_executable(test src/Message.cpp src/Service.cpp src/Services/TestService.cpp tests/tests.cpp tests/Message.cpp)
+target_link_libraries(test Catch2::Catch2)
 ENDIF()
diff --git a/ci/clang-tidy.sh b/ci/clang-tidy.sh
index 7d67a9fd..1e676ce2 100755
--- a/ci/clang-tidy.sh
+++ b/ci/clang-tidy.sh
@@ -11,4 +11,4 @@ echo -e "\033[0;34mRunning clang-tidy...\033[0m"
 
 cd "$(dirname "$0")"
 clang-tidy-4.0 `find ../src/ -type f -regextype posix-egrep -regex '.*\.(cpp|hpp|c|h)'` \
-    -- -std=c++14 -I../inc -fcolor-diagnostics
+    -extra-arg=-fcolor-diagnostics -- -std=c++14 -I../inc
diff --git a/tests/Message.cpp b/tests/Message.cpp
index f7698e3b..251945e1 100644
--- a/tests/Message.cpp
+++ b/tests/Message.cpp
@@ -75,7 +75,7 @@ TEST_CASE("Requirement 7.3.2 (Boolean)", "[message][ecss]") {
 TEST_CASE("Requirement 7.3.3 (Enumerated)", "[message][ecss]") {
 	Message message(0, 0, Message::TC, 0);
 
-	message.appendEnum8(230);
+	message.appendEnum8(231);
 	message.appendEnum16(15933);
 	message.appendEnum32(2000001);
 	message.appendEnumerated(12, 2052);
-- 
GitLab