forked from Imagelibrary/rtems
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.
This commit is contained in:
committed by
Gedare Bloom
parent
be8aa9b09d
commit
26b95e148c
@@ -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;
|
||||
}
|
||||
|
||||
47
cpukit/libtest/testexit.c
Normal file
47
cpukit/libtest/testexit.c
Normal file
@@ -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);
|
||||
}
|
||||
63
cpukit/libtest/testprinter.c
Normal file
63
cpukit/libtest/testprinter.c
Normal file
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user