[PATCH 4/4] Add mmtest1 test case

Hesham AL-Matary heshamelmatary at gmail.com
Sat Jul 13 23:05:21 UTC 2013


From: Hesham ALmatary <heshamelmatary at gmail.com>

---
 testsuites/libtests/Makefile.am         |  2 +-
 testsuites/libtests/configure.ac        |  1 +
 testsuites/libtests/mmtest1/Makefile.am | 18 +++++++++++
 testsuites/libtests/mmtest1/init.c      | 55 +++++++++++++++++++++++++++++++++
 testsuites/libtests/mmtest1/mmtest1.doc |  1 +
 testsuites/libtests/mmtest1/mmtests.scn |  7 +++++
 testsuites/libtests/mmtest1/system.h    | 33 ++++++++++++++++++++
 7 files changed, 116 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/libtests/mmtest1/Makefile.am
 create mode 100644 testsuites/libtests/mmtest1/init.c
 create mode 100644 testsuites/libtests/mmtest1/mmtest1.doc
 create mode 100644 testsuites/libtests/mmtest1/mmtests.scn
 create mode 100644 testsuites/libtests/mmtest1/system.h

diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index d1ffabc..d56398b 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -16,7 +16,7 @@ SUBDIRS += flashdisk01
 SUBDIRS += bspcmdline01 cpuuse devfs01 devfs02 devfs03 devfs04 \
     deviceio01 devnullfatal01 dumpbuf01 gxx01 \
     malloctest malloc02 malloc03 malloc04 malloc05 heapwalk \
-    putenvtest monitor monitor02 rtmonuse stackchk stackchk01 \
+    putenvtest monitor monitor02 mmtest1 rtmonuse stackchk stackchk01 \
     termios termios01 termios02 termios03 termios04 termios05 \
     termios06 termios07 termios08 \
     rtems++ tztest block01 block02 block03 block04 block05 block06 block07 \
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index 741c603..c1dbb78 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -85,6 +85,7 @@ malloc02/Makefile
 malloc03/Makefile
 malloc04/Makefile
 malloc05/Makefile
+mmtest1/Makefile
 monitor/Makefile
 monitor02/Makefile
 mouse01/Makefile
diff --git a/testsuites/libtests/mmtest1/Makefile.am b/testsuites/libtests/mmtest1/Makefile.am
new file mode 100644
index 0000000..a08e557
--- /dev/null
+++ b/testsuites/libtests/mmtest1/Makefile.am
@@ -0,0 +1,18 @@
+
+rtems_tests_PROGRAMS = mmtest1
+mmtest1_SOURCES = init.c system.h
+
+dist_rtems_tests_DATA = mmtests.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+LINK_OBJS = $(mmtest1_OBJECTS) $(mmtest1_LDADD)
+LINK_LIBS = $(mmtest1_LDLIBS)
+
+mmtest1$(EXEEXT): $(mmtest1_OBJECTS) $(mmtest1_DEPENDENCIES)
+	  @rm -f mmtest1$(EXEEXT)
+	  $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/mmtest1/init.c b/testsuites/libtests/mmtest1/init.c
new file mode 100644
index 0000000..d90e52d
--- /dev/null
+++ b/testsuites/libtests/mmtest1/init.c
@@ -0,0 +1,55 @@
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ *
+ */
+
+/*
+ * Copyright (c) 2013 Gedare Bloom.
+ * Copyright (c) 2012 Hesham Al-Matary.
+ *
+ * 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.
+ */
+
+#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__
+#define CONFIGURE_INIT
+#include "system.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rtems/score/mm.h>
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  Memory_management_Entry mme1 = {
+    .name = "Valid Entry-1",
+    .base = 0x00100000,
+    .size = 0x200000,
+    .installed = false,
+    .bsp_mme = NULL
+  };
+  Memory_management_Entry mme2 = {
+    .name = "Valid Entry-2",
+    .base = 0x00400000,
+    .size = 0x100000,
+    .installed = false,
+    .bsp_mme = NULL
+  };
+
+  puts( "\n\n*** Start of mmtest1 ***\n" );
+
+  printf("Test 1: Installing Entry-1 \
+and set it as Read only\n");
+  _Memory_management_Install_entry( &mme1, RTEMS_MM_REGION_PROTECTION_READ_ONLY);
+
+  printf("Test 2 : Installing Entry-2\
+and set it as Write enabled\n");
+  _Memory_management_Install_entry( &mme2, RTEMS_MM_REGION_PROTECTION_WRITE);
+
+  printf( "\n\n*** End of mmtest1 ***\n" );
+
+  exit( 0 );
+}
diff --git a/testsuites/libtests/mmtest1/mmtest1.doc b/testsuites/libtests/mmtest1/mmtest1.doc
new file mode 100644
index 0000000..210a761
--- /dev/null
+++ b/testsuites/libtests/mmtest1/mmtest1.doc
@@ -0,0 +1 @@
+Simple tests that tries to install memory management entries.
diff --git a/testsuites/libtests/mmtest1/mmtests.scn b/testsuites/libtests/mmtest1/mmtests.scn
new file mode 100644
index 0000000..6ba15c2
--- /dev/null
+++ b/testsuites/libtests/mmtest1/mmtests.scn
@@ -0,0 +1,7 @@
+*** Start of mmtest1 ***
+
+Test 1: Installing Entry-1 and set it as Read only
+Test 2 : Installing Entry-2and set it as Write enabled
+
+
+*** End of mmtest1 ***
diff --git a/testsuites/libtests/mmtest1/system.h b/testsuites/libtests/mmtest1/system.h
new file mode 100644
index 0000000..7560e1d
--- /dev/null
+++ b/testsuites/libtests/mmtest1/system.h
@@ -0,0 +1,33 @@
+/* system.h
+ *
+ * Copyright (c) 2013 Gedare Bloom.
+ *
+ * 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.
+ */
+
+#include <rtems.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+/* configuration information */
+
+#include <bsp.h> /* for device driver prototypes */
+
+/* NOTICE: the clock driver is explicitly disabled */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_MAXIMUM_TASKS            9
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
+
+#include <rtems/confdefs.h>
+/* end of include file */
-- 
1.8.3.1




More information about the devel mailing list