[PATCH v2 6/6] SD card : Added basic test suite
Mudit Jain
muditjain18011995 at gmail.com
Mon Aug 22 04:04:18 UTC 2016
---
libbsd.py | 1 +
libbsd_waf.py | 10 +++
testsuite/sdhci01/demo-shell-block-devices.h | 32 +++++++++
testsuite/sdhci01/demo-shell-minimal.h | 37 ++++++++++
testsuite/sdhci01/demo-shell.h | 44 ++++++++++++
testsuite/sdhci01/test_main.c | 104 +++++++++++++++++++++++++++
6 files changed, 228 insertions(+)
create mode 100644 testsuite/sdhci01/demo-shell-block-devices.h
create mode 100644 testsuite/sdhci01/demo-shell-minimal.h
create mode 100644 testsuite/sdhci01/demo-shell.h
create mode 100644 testsuite/sdhci01/test_main.c
diff --git a/libbsd.py b/libbsd.py
index 5927b7c..6e44f32 100755
--- a/libbsd.py
+++ b/libbsd.py
@@ -2544,6 +2544,7 @@ def tests(mm):
mod.addTest(mm.generator['test']('timeout01', ['init', 'timeout_test']))
mod.addTest(mm.generator['test']('init01', ['test_main']))
mod.addTest(mm.generator['test']('thread01', ['test_main']))
+ mod.addTest(mm.generator['test']('sdhci01', ['test_main']))
mod.addTest(mm.generator['test']('mutex01', ['test_main']))
mod.addTest(mm.generator['test']('condvar01', ['test_main']))
mod.addTest(mm.generator['test']('ppp01', ['test_main'], runTest = False))
diff --git a/libbsd_waf.py b/libbsd_waf.py
index f96f402..043a01b 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -1402,6 +1402,16 @@ def build(bld):
lib = ["m", "z"],
install_path = None)
+ test_sdhci01 = ['testsuite/sdhci01/test_main.c']
+ bld.program(target = "sdhci01.exe",
+ features = "cprogram",
+ cflags = cflags,
+ includes = includes,
+ source = test_sdhci01,
+ use = ["bsd"],
+ lib = ["m", "z"],
+ install_path = None)
+
test_selectpollkqueue01 = ['testsuite/selectpollkqueue01/test_main.c']
bld.program(target = "selectpollkqueue01.exe",
features = "cprogram",
diff --git a/testsuite/sdhci01/demo-shell-block-devices.h b/testsuite/sdhci01/demo-shell-block-devices.h
new file mode 100644
index 0000000..a8f1411
--- /dev/null
+++ b/testsuite/sdhci01/demo-shell-block-devices.h
@@ -0,0 +1,32 @@
+/**
+ * @file
+ *
+ * @ingroup demo
+ *
+ * @brief Shell configuration.
+ */
+
+/*
+ * Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems at 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.
+ */
+
+#ifndef DEMO_SHELL_BLOCK_DEVICES_H
+#define DEMO_SHELL_BLOCK_DEVICES_H
+
+#include "demo-shell-minimal.h"
+
+#define CONFIGURE_SHELL_COMMAND_FDISK
+#define CONFIGURE_SHELL_COMMAND_BLKSYNC
+#define CONFIGURE_SHELL_COMMAND_MSDOSFMT
+
+#endif /* DEMO_SHELL_BLOCK_DEVICES_H */
\ No newline at end of file
diff --git a/testsuite/sdhci01/demo-shell-minimal.h b/testsuite/sdhci01/demo-shell-minimal.h
new file mode 100644
index 0000000..3398629
--- /dev/null
+++ b/testsuite/sdhci01/demo-shell-minimal.h
@@ -0,0 +1,37 @@
+/**
+ * @file
+ *
+ * @ingroup demo
+ *
+ * @brief Shell configuration.
+ */
+
+/*
+ * Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems at 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.
+ */
+
+#ifndef DEMO_SHELL_MINIMAL_H
+#define DEMO_SHELL_MINIMAL_H
+
+#define CONFIGURE_SHELL_COMMAND_CPUUSE
+#define CONFIGURE_SHELL_COMMAND_PERIODUSE
+#define CONFIGURE_SHELL_COMMAND_STACKUSE
+
+#if defined(BSP_HAS_IRQ_INFO)
+#include <bsp/irq-info.h>
+
+#define CONFIGURE_SHELL_USER_COMMANDS \
+ &bsp_interrupt_shell_command
+#endif
+
+#endif /* DEMO_SHELL_MINIMAL_H */
\ No newline at end of file
diff --git a/testsuite/sdhci01/demo-shell.h b/testsuite/sdhci01/demo-shell.h
new file mode 100644
index 0000000..06b6863
--- /dev/null
+++ b/testsuite/sdhci01/demo-shell.h
@@ -0,0 +1,44 @@
+/**
+ * @file
+ *
+ * @ingroup demo
+ *
+ * @brief Shell configuration.
+ */
+
+/*
+ * Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems at 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.
+ */
+
+#ifndef DEMO_SHELL_H
+#define DEMO_SHELL_H
+
+#include "demo-shell-minimal.h"
+
+#define CONFIGURE_SHELL_COMMAND_CP
+#define CONFIGURE_SHELL_COMMAND_PWD
+#define CONFIGURE_SHELL_COMMAND_LS
+#define CONFIGURE_SHELL_COMMAND_CHDIR
+#define CONFIGURE_SHELL_COMMAND_CD
+#define CONFIGURE_SHELL_COMMAND_MKDIR
+#define CONFIGURE_SHELL_COMMAND_RMDIR
+#define CONFIGURE_SHELL_COMMAND_CAT
+#define CONFIGURE_SHELL_COMMAND_MV
+#define CONFIGURE_SHELL_COMMAND_RM
+
+#define CONFIGURE_SHELL_COMMAND_MALLOC_INFO
+#define CONFIGURE_SHELL_COMMAND_WKSPACE_INFO
+
+#define CONFIGURE_SHELL_COMMAND_RTC
+
+#endif /* DEMO_SHELL_H */
\ No newline at end of file
diff --git a/testsuite/sdhci01/test_main.c b/testsuite/sdhci01/test_main.c
new file mode 100644
index 0000000..a8f80bf
--- /dev/null
+++ b/testsuite/sdhci01/test_main.c
@@ -0,0 +1,104 @@
+/*
+ * This is the body of the test. It does not do much except ensure
+ * that the target is alive after initializing the TCP/IP stack.
+ */
+
+#include <assert.h>
+#include <inttypes.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+//#include <bsp/nexus-devices.h>
+
+#include <rtems.h>
+#include <rtems/media.h>
+#include <rtems/chain.h>
+#include <rtems/libio_.h>
+#include <rtems/shell.h>
+#include <rtems/console.h>
+#include <rtems/diskdevs.h>
+#include <rtems/bsd/bsd.h>
+
+#define TEST_NAME "LIBBSD SDHCI 01"
+#define ASSERT_SC(sc) assert((sc) == RTEMS_SUCCESSFUL)
+
+static void test_main(void)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+ sc = rtems_disk_io_initialize();
+ ASSERT_SC(sc);
+
+ sc = rtems_shell_init(
+ "SHLL",
+ 16 * 1024,
+ 10,
+ CONSOLE_DEVICE_NAME,
+ false,
+ true,
+ NULL
+ );
+ ASSERT_SC(sc);
+ exit( 0 );
+}
+
+/* for old configuration structure */
+#include <rtems/rtems_bsdnet.h>
+
+/*
+ * Network configuration
+ */
+struct rtems_bsdnet_config rtems_bsdnet_config = {
+ NULL, /* Network interface */
+ NULL, /* Use fixed network configuration */
+ 0, /* Default network task priority */
+ 0, /* Default mbuf capacity */
+ 0, /* Default mbuf cluster capacity */
+ "testSystem", /* Host name */
+ "nowhere.com", /* Domain name */
+ "127.0.0.1", /* Gateway */
+ "127.0.0.1", /* Log host */
+ {"127.0.0.1" }, /* Name server(s) */
+ {"127.0.0.1" }, /* NTP server(s) */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+};
+
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_FILESYSTEM_IMFS
+#define CONFIGURE_FILESYSTEM_DOSFS
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
+
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
+
+#define CONFIGURE_UNLIMITED_OBJECTS
+
+#define CONFIGURE_UNIFIED_WORK_AREAS
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define CONFIGURE_STACK_CHECKER_ENABLED
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+#define CONFIGURE_SHELL_COMMANDS_INIT
+
+#include "demo-shell.h"
+#include "demo-shell-block-devices.h"
+#include <rtems/shellconfig.h>
+
+#include <rtems/bsd/test/default-init.h>
--
1.9.1
More information about the devel
mailing list