[PATCH 7/7] SD Card : Added basic test suite

Mudit Jain muditjain18011995 at gmail.com
Sun Aug 28 07:25:12 UTC 2016


---
 libbsd.py                     |  1 +
 libbsd_waf.py                 | 10 ++++++++++
 testsuite/sdhci01/test_main.c | 46 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+)
 create mode 100644 testsuite/sdhci01/test_main.c

diff --git a/libbsd.py b/libbsd.py
index 4adf77d..a705977 100755
--- a/libbsd.py
+++ b/libbsd.py
@@ -2571,6 +2571,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 f6aee63..6607836 100644
--- a/libbsd_waf.py
+++ b/libbsd_waf.py
@@ -1482,6 +1482,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/test_main.c b/testsuite/sdhci01/test_main.c
new file mode 100644
index 0000000..5c71cfa
--- /dev/null
+++ b/testsuite/sdhci01/test_main.c
@@ -0,0 +1,46 @@
+/*
+ *  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 <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <bsp/nexus-devices.h>
+
+#define TEST_NAME "LIBBSD SDHCI 01"
+
+static void test_main(void)
+{
+  puts( "Sleeping to see what happens" );
+  sleep( 5 );
+
+  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
+};
+
+#include <rtems/bsd/test/default-init.h>
-- 
2.1.4



More information about the devel mailing list