From 0ed9bcec562f37b1d68f9c402f11f5262b5ab27e Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 2 Aug 2024 01:59:58 -0400 Subject: [PATCH] board unit tests --- _compile_unit_tests.sh | 24 ++++++++++++++++++++++++ board_unit_tests.mk | 1 + tests/test_example.cpp | 5 +++++ 3 files changed, 30 insertions(+) create mode 100755 _compile_unit_tests.sh create mode 100644 board_unit_tests.mk create mode 100644 tests/test_example.cpp diff --git a/_compile_unit_tests.sh b/_compile_unit_tests.sh new file mode 100755 index 0000000..0c924c4 --- /dev/null +++ b/_compile_unit_tests.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +cd ext/rusefi/unit_tests/ + +# This full path of the firmware directory +FDIR=$(cd "$(dirname "$0")"; pwd -P) + +MI="../../../meta-info.env" + + if [ -f "$FDIR/$MI" ]; then + true + # If the file exists relative to our current directory, get the full path + elif [ -f "$MI" ]; then + MI=$(realpath "$MI") + else + echo "Could not find $MI" + exit 1 + fi + +source ../firmware/config/boards/common_script_read_meta_env.inc "$MI" + +make -j$(nproc) + +build/rusefi_test diff --git a/board_unit_tests.mk b/board_unit_tests.mk new file mode 100644 index 0000000..be99d96 --- /dev/null +++ b/board_unit_tests.mk @@ -0,0 +1 @@ +TESTS_SRC_CPP += $(BOARD_DIR)/tests/test_example.cpp \ No newline at end of file diff --git a/tests/test_example.cpp b/tests/test_example.cpp new file mode 100644 index 0000000..95b1628 --- /dev/null +++ b/tests/test_example.cpp @@ -0,0 +1,5 @@ +#include "pch.h" + +TEST(BoardTest, Example) { + +}