sptests/spconfig01: New test

Close #3435.
This commit is contained in:
Sebastian Huber
2018-09-06 07:01:48 +02:00
parent 2f61eb210c
commit 0e907232e0
5 changed files with 150 additions and 0 deletions

View File

@@ -708,6 +708,15 @@ spclock_err02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spclock_err02) \
$(support_includes)
endif
if TEST_spconfig01
sp_tests += spconfig01
sp_screens += spconfig01/spconfig01.scn
sp_docs += spconfig01/spconfig01.doc
spconfig01_SOURCES = spconfig01/init.c
spconfig01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_spconfig01) \
$(support_includes)
endif
if TEST_spconsole01
sp_tests += spconsole01
sp_screens += spconsole01/spconsole01.scn

View File

@@ -117,6 +117,7 @@ RTEMS_TEST_CHECK([spcbssched03])
RTEMS_TEST_CHECK([spchain])
RTEMS_TEST_CHECK([spclock_err01])
RTEMS_TEST_CHECK([spclock_err02])
RTEMS_TEST_CHECK([spconfig01])
RTEMS_TEST_CHECK([spconsole01])
RTEMS_TEST_CHECK([spcontext01])
RTEMS_TEST_CHECK([spcoverage])

View File

@@ -0,0 +1,119 @@
/*
* Copyright (c) 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <sys/stat.h>
#include <errno.h>
#include <bsp.h>
#include <tmacros.h>
const char rtems_test_name[] = "SPCONFIG 1";
static int counter;
static void checkpoint(int expected_counter)
{
int current_counter;
current_counter = counter;
rtems_test_assert(current_counter == expected_counter);
counter = current_counter + 1;
}
static rtems_status_code bsp_prerequisite_drivers_init(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
TEST_BEGIN();
checkpoint(0);
return RTEMS_SUCCESSFUL;
}
static rtems_status_code app_prerequisite_drivers_init(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
struct stat st;
int rv;
checkpoint(1);
errno = 0;
rv = stat("/dev/null", &st);
rtems_test_assert(rv == -1);
rtems_test_assert(errno == ENOENT);
return RTEMS_SUCCESSFUL;
}
static rtems_status_code app_extra_drivers_init(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *arg
)
{
struct stat st;
int rv;
checkpoint(2);
rv = stat("/dev/null", &st);
rtems_test_assert(rv == 0);
return RTEMS_SUCCESSFUL;
}
static void Init(rtems_task_argument arg)
{
checkpoint(3);
TEST_END();
rtems_test_exit(0);
}
#ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
#warning "CONFIGURE_BSP_PREREQUISITE_DRIVERS will be #undef for this test"
#undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
#endif
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_BSP_PREREQUISITE_DRIVERS \
{ bsp_prerequisite_drivers_init, NULL, NULL, NULL, NULL, NULL }
#define CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS \
{ app_prerequisite_drivers_init, NULL, NULL, NULL, NULL, NULL }
#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS \
{ app_extra_drivers_init, NULL, NULL, NULL, NULL, NULL }
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,14 @@
This file describes the directives and concepts tested by this test set.
test set name: spconfig01
directives:
- CONFIGURE_APPLICATION_EXTRA_DRIVERS
- CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
- CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS
- CONFIGURE_BSP_PREREQUISITE_DRIVERS
concepts:
- Ensure that the driver initialization takes place in the right order.

View File

@@ -0,0 +1,7 @@
*** BEGIN OF TEST SPCONFIG 1 ***
*** TEST VERSION: 5.0.0.e0a9336bf939e7bc4b0adb9227e2d2198de8dc7f
*** TEST STATE: EXPECTED-PASS
*** TEST BUILD:
*** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 219a4babbcbbc509bd6d2a85d2e1a5315c7d153c, Newlib d13c84eb07e35984bf7a974cd786a6cdac29e6b9)
*** END OF TEST SPCONFIG 1 ***