[PATCH] tests: Add and use <rtems/testopts.h>
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Sep 29 13:31:47 UTC 2020
Add the build option RTEMS_TEST_VERBOSITY to control the verbosity of
test suites using the RTEMS test framework.
---
spec/build/testsuites/grp.yml | 2 ++
spec/build/testsuites/optverbosity.yml | 27 +++++++++++++++++++++++
spec/build/testsuites/testopts.yml | 13 +++++++++++
testsuites/smptests/smpmulticast01/init.c | 3 ++-
testsuites/validation/ts-validation-0.c | 3 ++-
5 files changed, 46 insertions(+), 2 deletions(-)
create mode 100644 spec/build/testsuites/optverbosity.yml
create mode 100644 spec/build/testsuites/testopts.yml
diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml
index 5c6457f06d..fa2bad1016 100644
--- a/spec/build/testsuites/grp.yml
+++ b/spec/build/testsuites/grp.yml
@@ -62,6 +62,8 @@ links:
uid: tmtests/grp
- role: build-dependency
uid: validation/grp
+- role: build-dependency
+ uid: testopts
type: build
use-after:
- rtemscpu
diff --git a/spec/build/testsuites/optverbosity.yml b/spec/build/testsuites/optverbosity.yml
new file mode 100644
index 0000000000..92fd9dfa7d
--- /dev/null
+++ b/spec/build/testsuites/optverbosity.yml
@@ -0,0 +1,27 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+actions:
+- get-string: null
+- script: |
+ verbosities = {
+ "Verbose": "T_VERBOSE",
+ "Normal": "T_NORMAL",
+ "Quiet": "T_QUIET",
+ }
+ name = self.data["name"]
+ try:
+ conf.define(name, verbosities[value], quote=False)
+ except KeyError:
+ conf.fatal("The value of {} shall be one of {}".format(
+ name, verbosities.keys()))
+build-type: option
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+default: Normal
+default-by-variant: []
+description: |
+ Sets the test verbosity. Valid values are "Verbose", "Normal", and "Quiet".
+enabled-by: true
+format: '{}'
+links: []
+name: RTEMS_TEST_VERBOSITY
+type: build
diff --git a/spec/build/testsuites/testopts.yml b/spec/build/testsuites/testopts.yml
new file mode 100644
index 0000000000..8b6ab38f56
--- /dev/null
+++ b/spec/build/testsuites/testopts.yml
@@ -0,0 +1,13 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+build-type: config-header
+copyrights:
+- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+enabled-by: true
+guard: _RTEMS_TESTOPTS_H
+include-headers: []
+install-path: ${BSP_INCLUDEDIR}/rtems
+links:
+- role: build-dependency
+ uid: optverbosity
+target: cpukit/include/rtems/testopts.h
+type: build
diff --git a/testsuites/smptests/smpmulticast01/init.c b/testsuites/smptests/smpmulticast01/init.c
index f5ed70952a..3d2412427c 100644
--- a/testsuites/smptests/smpmulticast01/init.c
+++ b/testsuites/smptests/smpmulticast01/init.c
@@ -34,6 +34,7 @@
#include <string.h>
#include <rtems/test.h>
+#include <rtems/testopts.h>
#include <tmacros.h>
#define CPU_COUNT 32
@@ -43,7 +44,7 @@ const char rtems_test_name[] = "SMPMULTICAST 1";
static const T_config config = {
.name = "SMPMultiCast",
.putchar = T_putchar_default,
- .verbosity = T_VERBOSE,
+ .verbosity = RTEMS_TEST_VERBOSITY,
.now = T_now_clock
};
diff --git a/testsuites/validation/ts-validation-0.c b/testsuites/validation/ts-validation-0.c
index 3e60fb6ab8..0d641637ee 100644
--- a/testsuites/validation/ts-validation-0.c
+++ b/testsuites/validation/ts-validation-0.c
@@ -49,6 +49,7 @@
#include <rtems/sysinit.h>
#include <rtems/test.h>
+#include <rtems/testopts.h>
/**
* @defgroup RTEMSTestSuiteTestsuitesValidation0 spec:/testsuites/validation-0
@@ -88,7 +89,7 @@ static const T_config test_config = {
.buf = buffer,
.buf_size = sizeof( buffer ),
.putchar = rtems_put_char,
- .verbosity = T_VERBOSE,
+ .verbosity = RTEMS_TEST_VERBOSITY,
.now = T_now_clock,
.action_count = T_ARRAY_SIZE( actions ),
.actions = actions
--
2.26.2
More information about the devel
mailing list