From 17e9f30f34929658c17159c58b056a806c8ff0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Gauthier?= Date: Wed, 10 Dec 2025 11:12:08 +0100 Subject: [PATCH] clean and add first iteration of gitlab yaml for CI test --- .gitlab-ci.yml | 35 +++++++++++++++++++++++++++++++++++ test/EEPROM_test_struct.cpp | 6 +++--- test/README | 16 +++++++--------- 3 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..d4cb81c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,35 @@ +stages: + - build + - test + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + PLATFORMIO_CACHE_DIR: "$CI_PROJECT_DIR/.cache/platformio" + ARDUINO_ENV: "megaADK" + +cache: + paths: + - .cache/pip + - .cache/platformio + key: "$CI_COMMIT_REF_SLUG" + +pio_build: + image: python:latest + stage: build + + before_script: + - pip install -U platformio + + script: + - "pio run -e $ARDUINO_ENV" + +pio_test: + image: python:latest + stage: test + + before_script: + - pip install -U platformio + + script: + - "pio test -e $ARDUINO_ENV --list-result" + - "pio ci --lib='.' --board=$ARDUINO_ENV" \ No newline at end of file diff --git a/test/EEPROM_test_struct.cpp b/test/EEPROM_test_struct.cpp index f800d87..708143e 100644 --- a/test/EEPROM_test_struct.cpp +++ b/test/EEPROM_test_struct.cpp @@ -322,12 +322,12 @@ void setup(void) //WARNING: Tests are not exhaustive and do not cover all possibilities. int main( int argc, char **argv) { UNITY_BEGIN(); + // The following commented test is here for faciltate the debug "test_get_measure_at", test_get_measure is private function for the storage_interface class + // Maybe removed later // RUN_TEST(test_get_measure); RUN_TEST(test_get_measure_at); RUN_TEST(test_add_measure); RUN_TEST(test_get_struct); - RUN_TEST(test_set_struct); - // RUN_TEST(test_put_measure); - + RUN_TEST(test_set_struct); UNITY_END(); } \ No newline at end of file diff --git a/test/README b/test/README index 9b1e87b..f3a0d5f 100755 --- a/test/README +++ b/test/README @@ -1,11 +1,9 @@ +# Project tests +The project was classic for sensor management, for the treatment and for the main file. +However, the data measure storage (**storage_interface** class), use the EEPROM persistant memory with ordered dynamic storage structure leading to most of the project's complexity who need's to be test. +The [EEPROM_test_struct.cpp](EEPROM_test_struct.cpp) is made for this. -This directory is intended for PlatformIO Test Runner and project tests. +## storage_interface test +The file mainly contain unit test for **getter setter** function and **structure** functions. -Unit Testing is a software testing method by which individual units of -source code, sets of one or more MCU program modules together with associated -control data, usage procedures, and operating procedures, are tested to -determine whether they are fit for use. Unit testing finds problems early -in the development cycle. - -More information about PlatformIO Unit Testing: -- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html +**TODO** : Ideally add integration test for globally test project on simple use case. \ No newline at end of file