summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-11-03 08:21:19 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-12-19 08:26:46 +0100
commitd24211071fb72498872fad0c56913007c80d6a79 (patch)
treec0cb08b31e81480eaa2d2e91db254ee37377c1cc
parent9fbe68af644f04e99df8337ebe717fb81dc82f2a (diff)
libtest: Move parts to extra files
Move the RTEMS test printer and rtems_test_exit() to separate files, to remove dependencies from the begin/end test messsage support. Update #4963.
-rw-r--r--cpukit/libtest/testbeginend.c28
-rw-r--r--cpukit/libtest/testexit.c47
-rw-r--r--cpukit/libtest/testprinter.c63
-rw-r--r--spec/build/cpukit/librtemstest.yml2
4 files changed, 112 insertions, 28 deletions
diff --git a/cpukit/libtest/testbeginend.c b/cpukit/libtest/testbeginend.c
index eca8712b35..d520a45e62 100644
--- a/cpukit/libtest/testbeginend.c
+++ b/cpukit/libtest/testbeginend.c
@@ -42,13 +42,8 @@
#include <rtems/test-info.h>
#include <rtems/test-printer.h>
-#include <rtems/bspIo.h>
#include <rtems/version.h>
-rtems_printer rtems_test_printer = {
- .printer = rtems_printk_printer
-};
-
static const char* const test_state_strings[] =
{
"EXPECTED_PASS",
@@ -102,26 +97,3 @@ int rtems_test_end(const char* name)
"\n*** END OF TEST %s ***\n\n", name
);
}
-
-void rtems_test_exit(int status)
-{
- (void) status;
- rtems_shutdown_executive(0);
-}
-
-int rtems_test_printf(
- const char* format,
- ...
-)
-{
- va_list ap;
- int len;
- va_start(ap, format);
- len = rtems_vprintf(
- &rtems_test_printer,
- format,
- ap
- );
- va_end(ap);
- return len;
-}
diff --git a/cpukit/libtest/testexit.c b/cpukit/libtest/testexit.c
new file mode 100644
index 0000000000..89f0dc341a
--- /dev/null
+++ b/cpukit/libtest/testexit.c
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestFrameworkImpl
+ *
+ * @brief This source file contains the implementation of
+ * rtems_test_exit().
+ */
+
+/*
+ * Copyright (c) 2017 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/test-info.h>
+
+void rtems_test_exit(int status)
+{
+ (void) status;
+ rtems_shutdown_executive(0);
+}
diff --git a/cpukit/libtest/testprinter.c b/cpukit/libtest/testprinter.c
new file mode 100644
index 0000000000..b2b782bf4b
--- /dev/null
+++ b/cpukit/libtest/testprinter.c
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSTestFrameworkImpl
+ *
+ * @brief This source file contains the definition of ::rtems_test_printer and
+ * the implementation of rtems_test_printf().
+ */
+
+/*
+ * Copyright (c) 2017 Chris Johns <chrisj@rtems.org>. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/test-printer.h>
+#include <rtems/bspIo.h>
+
+rtems_printer rtems_test_printer = {
+ .printer = rtems_printk_printer
+};
+
+int rtems_test_printf(
+ const char* format,
+ ...
+)
+{
+ va_list ap;
+ int len;
+ va_start(ap, format);
+ len = rtems_vprintf(
+ &rtems_test_printer,
+ format,
+ ap
+ );
+ va_end(ap);
+ return len;
+}
diff --git a/spec/build/cpukit/librtemstest.yml b/spec/build/cpukit/librtemstest.yml
index fc268f8971..fbce36aace 100644
--- a/spec/build/cpukit/librtemstest.yml
+++ b/spec/build/cpukit/librtemstest.yml
@@ -42,11 +42,13 @@ source:
- cpukit/libtest/t-test.c
- cpukit/libtest/testbeginend.c
- cpukit/libtest/testbusy.c
+- cpukit/libtest/testexit.c
- cpukit/libtest/testextension.c
- cpukit/libtest/testgcovcpufatalhalt.c
- cpukit/libtest/testgcovbspreset.c
- cpukit/libtest/testgcovdumpinfo.c
- cpukit/libtest/testparallel.c
+- cpukit/libtest/testprinter.c
- cpukit/libtest/testrun.c
- cpukit/libtest/testwrappers.c
target: rtemstest