summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-06 07:01:48 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-09-06 07:12:38 +0200
commit0e907232e04f223059b4cecc1cc4b25e13f09233 (patch)
tree75445c431829c47ebee64fd1255bf8662a0d9cc4
parentbsp/qoriq: Add struct qoriq to allow forward decls (diff)
downloadrtems-0e907232e04f223059b4cecc1cc4b25e13f09233.tar.bz2
sptests/spconfig01: New test
Close #3435.
-rw-r--r--testsuites/sptests/Makefile.am9
-rw-r--r--testsuites/sptests/configure.ac1
-rw-r--r--testsuites/sptests/spconfig01/init.c119
-rw-r--r--testsuites/sptests/spconfig01/spconfig01.doc14
-rw-r--r--testsuites/sptests/spconfig01/spconfig01.scn7
5 files changed, 150 insertions, 0 deletions
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index d3a2e10869..6d28acdfbb 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -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
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index ffbd7330ce..0c9788ae1b 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -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])
diff --git a/testsuites/sptests/spconfig01/init.c b/testsuites/sptests/spconfig01/init.c
new file mode 100644
index 0000000000..6979d2eafd
--- /dev/null
+++ b/testsuites/sptests/spconfig01/init.c
@@ -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>
diff --git a/testsuites/sptests/spconfig01/spconfig01.doc b/testsuites/sptests/spconfig01/spconfig01.doc
new file mode 100644
index 0000000000..f35d73a640
--- /dev/null
+++ b/testsuites/sptests/spconfig01/spconfig01.doc
@@ -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.
diff --git a/testsuites/sptests/spconfig01/spconfig01.scn b/testsuites/sptests/spconfig01/spconfig01.scn
new file mode 100644
index 0000000000..0222cf68ff
--- /dev/null
+++ b/testsuites/sptests/spconfig01/spconfig01.scn
@@ -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 ***