From 40a7cb01a54d3bc5196edacbed31cb283a00cd9d Mon Sep 17 00:00:00 2001 From: Charly Zaepfel Date: Mon, 29 Sep 2025 11:43:48 +0200 Subject: [PATCH] Add serial testsuite runner --- vee-port/validation/serial/.gitignore | 3 + vee-port/validation/serial/README.md | 41 +++++++++ vee-port/validation/serial/build.gradle.kts | 52 ++++++++++++ .../validation/serial/config.properties.tpl | 85 +++++++++++++++++++ .../microej-testsuite-common.properties | 35 ++++++++ 5 files changed, 216 insertions(+) create mode 100644 vee-port/validation/serial/.gitignore create mode 100644 vee-port/validation/serial/README.md create mode 100644 vee-port/validation/serial/build.gradle.kts create mode 100644 vee-port/validation/serial/config.properties.tpl create mode 100644 vee-port/validation/serial/validation/microej-testsuite-common.properties diff --git a/vee-port/validation/serial/.gitignore b/vee-port/validation/serial/.gitignore new file mode 100644 index 0000000..56e8774 --- /dev/null +++ b/vee-port/validation/serial/.gitignore @@ -0,0 +1,3 @@ +build/ +.gradle/ +local.properties diff --git a/vee-port/validation/serial/README.md b/vee-port/validation/serial/README.md new file mode 100644 index 0000000..2e22acd --- /dev/null +++ b/vee-port/validation/serial/README.md @@ -0,0 +1,41 @@ +# Serial Test Suite + +This folder contains a ready-to-use project for testing [Serial](https://docs.microej.com/en/latest/VEEPortingGuide/serial.html) implementations on a device. +This Test Suite will typically test the following serial operations: open, close, read, write. + +## Specifications + +- Tested Foundation Library: `Serial `_ +- Test Suite Module: `com.microej.pack.serial#serial-testsuite `_ + +Set the Test Suite's module version in [build.gradle.kts](build.gradle.kts) to match the version of the pack included in the VEE Port tested. + +Please refer to [VEE Port Qualification Test Suite Versioning](https://docs.microej.com/en/latest/VEEPortingGuide/veePortQualification.html#test-suite-versioning) +to determine the Serial Test Suite module version. + +## Requirements + +- Read VEE Port Test Suites [documentation](../README.md). + +## Tests properties + +Before running tests, please fill in the following fields in file `validation/microej-testsuite-common.properties` with expected values: + +- **microej.java.property.serial.port.rx**: [*MANDATORY*] set port used for rx operations (both tx and rx can get mapped to the same port so as to test serial in loopback mode). +- **microej.java.property.serial.port.tx**: [*MANDATORY*] set port used for tx operations (both tx and rx can get mapped to the same port so as to test serial in loopback mode). +- **microej.java.property.serial.port.baudrate**: [*OPTIONAL*] set baudrate of rx/tx ports (default value: 115200). +- **microej.java.property.serial.port.bitsperchar**: [*OPTIONAL*] set data bits of rx/tx ports (default value: 8). +- **microej.java.property.serial.port.stopbits**: [*OPTIONAL*] set stop bits of rx/tx ports (default value: 1). +- **microej.java.property.serial.port.parity**: [*OPTIONAL*] set parity of rx/tx ports (default value: 0). + +## Usage + +- Follow the configuration and execution steps described in VEE Port Test Suites [documentation](../README.md). + +## Test Suite Source Code Navigation + +- See VEE Port Test Suites [documentation](../README.md). + +## Troubleshooting + +- See Vee Port Test Suites [documentation](../README.md). diff --git a/vee-port/validation/serial/build.gradle.kts b/vee-port/validation/serial/build.gradle.kts new file mode 100644 index 0000000..4bd7866 --- /dev/null +++ b/vee-port/validation/serial/build.gradle.kts @@ -0,0 +1,52 @@ +import com.microej.gradle.plugins.TestMode +import com.microej.gradle.plugins.TestTarget + +plugins { + id("com.microej.gradle.testsuite") +} + +microej { + architectureUsage = System.getProperty("com.microej.architecture.usage") ?: "eval" // or "prod" + skippedCheckers = "readme,license,changelog" +} + +dependencies { + // Define the VEE Port absolute path here if you test a VEE Port already built + // microejVee(files("[vee-port-absolute-path]")) + // Uncomment this line and comment the line above it this testsuite project is a part of the VEE Port project + microejVee(project(veePortProject)) +} + +testing { + suites { + val test by getting(JvmTestSuite::class) { + microej.useMicroejTestEngine(this, TestTarget.EMB, TestMode.MAIN) + + dependencies { + implementation(project()) + implementation(libs.ej.junit) + implementation(libs.junit.platform) + + implementation(libs.testsuite.serial) + implementation(libs.ej.edc) + implementation(libs.ej.bon) + implementation(libs.ej.serial) + } + + targets { + all { + testTask.configure { + filter { + // do not embed inner classes as test classes + excludeTestsMatching("*$*") + excludeTestsMatching("*AbstractTest*") + excludeTestsMatching("*AllTestClasses") + + includeTestsMatching("*SingleTest_*") + } + } + } + } + } + } +} diff --git a/vee-port/validation/serial/config.properties.tpl b/vee-port/validation/serial/config.properties.tpl new file mode 100644 index 0000000..70c7569 --- /dev/null +++ b/vee-port/validation/serial/config.properties.tpl @@ -0,0 +1,85 @@ +# Properties +# +# Copyright 2025 MicroEJ Corp. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be found with this software. + +############################################################################### +# Testsuite Configuration Options +# +# Usage: +# Uncomment and set options marked '[required]'. +# Other options are set with a value that shall not be changed by default. +# +# Each option can be declared outside this file as a system property (in the +# gradle.properties with the `systemProp.` prefix for example). +# This can be useful to avoid to share absolute file-system locations in this file. +# In this case, it overrides the option defined in this file if any. +# Moreover, options related to local setup (absolute file-system locations, trace ip & port) +# can be extracted to the file 'local.properties' which is ignored for source control. +# +# This file respects the Java properties file convention: the OS path +# must use the UNIX path convention (path separator is '/'). The WINDOWS +# paths must have been converted manually replacing '\' by '/' or by '\\'. +############################################################################### + +############################################################################### +# BSP Connection [required] +# Uncomment one and only one option block depending on how the target VEE Port is connected to BSP. +# See https://docs.microej.com/en/latest/VEEPortingGuide/platformCreation.html +############################################################################### + +# No BSP Connection +#microej.testsuite.properties.deploy.dir.microejapp=[absolute_path] +#microej.testsuite.properties.deploy.dir.microejlib=[absolute_path] +#microej.testsuite.properties.deploy.dir.microejinc=[absolute_path] +#microej.testsuite.properties.deploy.dir.microejscript=[absolute_path] + +# Partial BSP Connection +#microej.testsuite.properties.deploy.bsp.root.dir=[absolute_path] +#microej.testsuite.properties.deploy.bsp.microejscript=true + +# Full BSP Connection +#microej.testsuite.properties.deploy.bsp.microejscript=true + +############################################################################### +# Trace Redirection (System.out) +############################################################################### + +# Uncomment and define these 2 properties when trace is redirected by 'Serial to Socket Transmitter' tool +#microej.testsuite.properties.testsuite.trace.ip=localhost +#microej.testsuite.properties.testsuite.trace.port=5555 +# Otherwise uncomment this property if the trace is redirected by 'run.bat' or 'run.sh' script. +#microej.testsuite.properties.launch.test.trace.file=true + +# VEE Port specific option to redirect trace on dedicated UART +#microej.testsuite.properties.debug.traces.uart=SET + +####################################################################### +# Advanced Options +# These options shall not be changed by default. +############################################################################### + +# The deploy tool to run after the build of the microejapp.o (defaults to 'Platform Configuration Additions') +microej.testsuite.properties.microejtool.deploy.name=deployToolBSPRun + +# Set the verbose or not. Possible values: `true` or `false` +# When this option is set to `true`, the harness will output the execution trace. +microej.testsuite.verbose=true + +# The testsuite timeout (in seconds) +microej.testsuite.timeout=600 + +# The number of times we'll retry a test if it fails +microej.testsuite.retry.count=1 + +# Retry a test unless this pattern is shown +microej.testsuite.retry.unless=MicroEJ START + +# A jvm args to pass to the testsuite harness +microej.testsuite.jvmArgs=-Xmx768m + +# A jvm args to pass to launch scripts forked vm +microej.testsuite.properties.launch.properties.jvm=-Xmx2048M + +# The foundation jars used for the code coverage, useful only if the target.vm.name = S3 +microej.testsuite.cc.jars.name.regex=serial-(.*)\.jar diff --git a/vee-port/validation/serial/validation/microej-testsuite-common.properties b/vee-port/validation/serial/validation/microej-testsuite-common.properties new file mode 100644 index 0000000..539cd6c --- /dev/null +++ b/vee-port/validation/serial/validation/microej-testsuite-common.properties @@ -0,0 +1,35 @@ +# Testsuite Application Options +# +# Copyright 2025 MicroEJ Corp. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be found with this software. + +# Java memory settings +core.memory.immortal.memory=RAM +core.memory.immortal.size=1024 +core.memory.javaheap.memory=RAM +core.memory.javaheap.size=65536 +core.memory.javaheapsum.size=65536 +core.memory.thread.block.size=512 +core.memory.thread.max.size=10 +core.memory.threads.memory=RAM +core.memory.threads.pool.memory=RAM +core.memory.threads.pool.size=16 +core.memory.threads.size=4 + +# [MANDATORY] set port used for rx operations (both tx and rx can get mapped to the same port so as to test serial in loopback mode). +microej.java.property.serial.port.rx=COM0 + +# [MANDATORY] set port used for tx operations (both tx and rx can get mapped to the same port so as to test serial in loopback mode). +microej.java.property.serial.port.tx=COM0 + +# [OPTIONAL] set baudrate of rx/tx ports (default value: 115200). +microej.java.property.serial.port.baudrate=115200 + +# [OPTIONAL] set data bits of rx/tx ports (default value: 8). +microej.java.property.serial.port.bitsperchar=8 + +# [OPTIONAL] set stop bits of rx/tx ports (default value: 1). +microej.java.property.serial.port.stopbits=1 + +# [OPTIONAL] set parity of rx/tx ports (default value: 0). +microej.java.property.serial.port.parity=0