[rtems commit] testsuite: Add libdl/dl03 cache test.

Chris Johns chrisj at rtems.org
Mon Aug 15 07:55:46 UTC 2016


Module:    rtems
Branch:    master
Commit:    97d395bac3df44438eed0b639f0292c16b049b93
Changeset: http://git.rtems.org/rtems/commit/?id=97d395bac3df44438eed0b639f0292c16b049b93

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Aug 12 18:55:53 2016 +1000

testsuite: Add libdl/dl03 cache test.

---

 cpukit/Makefile.am                   |   2 +-
 cpukit/preinstall.am                 |   4 +
 testsuites/libtests/Makefile.am      |   2 +-
 testsuites/libtests/configure.ac     |   1 +
 testsuites/libtests/dl03/Makefile.am |  19 +++
 testsuites/libtests/dl03/dl-cache.c  | 296 +++++++++++++++++++++++++++++++++++
 testsuites/libtests/dl03/dl-cache.h  |  14 ++
 testsuites/libtests/dl03/dl03.doc    |  28 ++++
 testsuites/libtests/dl03/dl03.scn    |  67 ++++++++
 testsuites/libtests/dl03/init.c      |  65 ++++++++
 10 files changed, 496 insertions(+), 2 deletions(-)

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index ac97530..feca7ab 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -92,7 +92,7 @@ include_rtems_rtl_HEADERS += libdl/dlfcn-shell.h
 include_rtems_rtl_HEADERS += libdl/rtl.h libdl/rtl-allocator.h libdl/rtl-obj-fwd.h
 include_rtems_rtl_HEADERS += libdl/rtl-fwd.h libdl/rtl-obj.h libdl/rtl-obj-cache.h
 include_rtems_rtl_HEADERS += libdl/rtl-obj-comp.h libdl/rtl-unresolved.h
-include_rtems_rtl_HEADERS += libdl/rtl-indirect-ptr.h libdl/rtl-sym.h
+include_rtems_rtl_HEADERS += libdl/rtl-indirect-ptr.h libdl/rtl-sym.h libdl/rtl-trace.h
 include_rtems_rtl_HEADERS += libdl/rap.h libdl/rap-shell.h
 endif
 
diff --git a/cpukit/preinstall.am b/cpukit/preinstall.am
index 5ba1ee4..5d4649a 100644
--- a/cpukit/preinstall.am
+++ b/cpukit/preinstall.am
@@ -212,6 +212,10 @@ $(PROJECT_INCLUDE)/rtems/rtl/rtl-sym.h: libdl/rtl-sym.h $(PROJECT_INCLUDE)/rtems
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtl/rtl-sym.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtl/rtl-sym.h
 
+$(PROJECT_INCLUDE)/rtems/rtl/rtl-trace.h: libdl/rtl-trace.h $(PROJECT_INCLUDE)/rtems/rtl/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtl/rtl-trace.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtl/rtl-trace.h
+
 $(PROJECT_INCLUDE)/rtems/rtl/rap.h: libdl/rap.h $(PROJECT_INCLUDE)/rtems/rtl/$(dirstamp)
 	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/rtl/rap.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rtl/rap.h
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index ed5eb07..9ea77dc 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -46,7 +46,7 @@ _SUBDIRS += syscall01
 endif
 
 if DLTESTS
-_SUBDIRS += dl01 dl02
+_SUBDIRS += dl01 dl02 dl03
 endif
 
 include $(top_srcdir)/../automake/test-subdirs.am
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index 88dd58f..94b025e 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -126,6 +126,7 @@ deviceio01/Makefile
 devnullfatal01/Makefile
 dl01/Makefile
 dl02/Makefile
+dl03/Makefile
 dumpbuf01/Makefile
 ftp01/Makefile
 gxx01/Makefile
diff --git a/testsuites/libtests/dl03/Makefile.am b/testsuites/libtests/dl03/Makefile.am
new file mode 100644
index 0000000..de8a79a
--- /dev/null
+++ b/testsuites/libtests/dl03/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = dl03
+dl03_SOURCES = init.c dl-cache.c
+
+dist_rtems_tests_DATA = dl03.scn dl03.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(dl03_OBJECTS)
+LINK_LIBS = $(dl03_LDLIBS)
+
+dl03$(EXEEXT):  $(dl03_OBJECTS) $(dl03_DEPENDENCIES)
+	@rm -f dl03$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/dl03/dl-cache.c b/testsuites/libtests/dl03/dl-cache.c
new file mode 100644
index 0000000..a2eb071
--- /dev/null
+++ b/testsuites/libtests/dl03/dl-cache.c
@@ -0,0 +1,296 @@
+/*
+ * Copyright (c) 2016 Chris Johns <chrisj at rtems.org>.  All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include <rtems/rtl/rtl.h>
+#include <rtems/rtl/rtl-obj-cache.h>
+#include <rtems/rtl/rtl-trace.h>
+
+#include "dl-cache.h"
+
+#define CACHE_SIZE         (2048)
+#define CACHE_SIZE_TOO_BIG (-1)
+#define CACHE_BUFFER_SIZE  (CACHE_SIZE * 4)
+
+static uint8_t* contents;
+
+static const char const* filename = "/dl-test";
+
+static void dl_cache_create_file(void)
+{
+  uint16_t* p;
+  int       fd;
+  int       i;
+  rtems_test_assert((contents = malloc(CACHE_BUFFER_SIZE)) != NULL);
+  memset(contents, 0, CACHE_BUFFER_SIZE);
+  p = (uint16_t*) contents;
+  for (i = 0; i < (CACHE_BUFFER_SIZE / sizeof(uint16_t)); ++i)
+    *p++ = i;
+  rtems_test_assert((fd = open(filename,
+                               O_WRONLY | O_TRUNC | O_CREAT,
+                               S_IRUSR | S_IWUSR)) >= 0);
+  rtems_test_assert(write(fd, contents, CACHE_BUFFER_SIZE) == CACHE_BUFFER_SIZE);
+  rtems_test_assert(close(fd) >= 0);
+}
+
+static bool dl_cache_check(void* buffer, off_t offset, size_t length)
+{
+  uint16_t* b;
+  uint16_t* c;
+  int       i;
+  b = buffer;
+  c = (uint16_t*) (contents + offset);
+  printf("cache:   buffer: ");
+  for (i = 0; i < 4; ++i)
+    printf("%04x/%04x ", b[i], c[i]);
+  printf("\n");
+  return memcmp(buffer, contents + offset, length) == 0;
+}
+
+static off_t dl_cache_buffer_offset(rtems_rtl_obj_cache_t* cache, void* buffer)
+{
+  return (off_t) (((uint8_t*) buffer) - ((uint8_t*) cache->buffer));
+}
+
+static void dl_init_rtl(void)
+{
+  /*
+   * Check the RTL object is created and can be locked and unlocked.
+   */
+  rtems_test_assert(rtems_rtl_data () == NULL);
+  rtems_test_assert(rtems_rtl_lock () != NULL);
+  rtems_test_assert(rtems_rtl_unlock () == true);
+  rtems_test_assert(rtems_rtl_data () != NULL);
+  rtems_rtl_trace_set_mask(RTEMS_RTL_TRACE_ALL | RTEMS_RTL_TRACE_CACHE);
+}
+
+int dl_cache_test(void)
+{
+  rtems_rtl_obj_cache_t cache;
+  int                   fd;
+  void*                 buffer;
+  off_t                 offset_in;
+  off_t                 offset;
+  size_t                length_in;
+  size_t                length;
+
+  /*
+   * Make sure the RTL can initialise.
+   */
+  dl_init_rtl();
+
+  /*
+   * Create the file to test the cache with.
+   */
+  dl_cache_create_file();
+
+  /*
+   * Check the too big error is handled.
+   */
+  printf ("cache create with large size\n");
+  rtems_test_assert(rtems_rtl_obj_cache_open(&cache,
+                                             CACHE_SIZE_TOO_BIG) == false);
+
+  /*
+   * Create a cache.
+   */
+  printf ("cache create\n");
+  rtems_test_assert(rtems_rtl_obj_cache_open(&cache,
+                                             CACHE_SIZE) == true);
+  rtems_test_assert(cache.fd == -1);
+  rtems_test_assert(cache.file_size == 0);
+  rtems_test_assert(cache.size == CACHE_SIZE);
+  rtems_test_assert(cache.buffer != NULL);
+
+  /*
+   * Open the file to use with the cache tests.
+   */
+  printf ("cache file open\n");
+  rtems_test_assert((fd = open(filename, O_RDONLY)) >= 0);
+
+  buffer = NULL; offset_in = 0; length_in = length = CACHE_SIZE / 2;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = 0; length_in = length = CACHE_SIZE;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_SIZE / 2; length_in = length = CACHE_SIZE / 2;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - CACHE_SIZE; length_in = length = CACHE_SIZE;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == 0);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - (CACHE_SIZE / 2); length_in = length = CACHE_SIZE / 2;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == (CACHE_SIZE / 2));
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = 0; length_in = length = CACHE_SIZE / 4;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = 0; length_in = length = CACHE_SIZE / 8;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = 0; length_in = length = CACHE_SIZE;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(offset == offset_in);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - 40; length_in = length = 16;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - 40; length_in = length = 40;
+  printf("cache read: in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - 40; length_in = length = 80;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(length == 40);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - CACHE_SIZE + 80;
+  length_in = length = 20;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  buffer = NULL; offset_in = CACHE_BUFFER_SIZE - 40;
+  length_in = length = 40;
+  printf("cache read:  in: offset=%d length=%d\n", (int) offset_in, (int) length);
+  rtems_test_assert(rtems_rtl_obj_cache_read(&cache,
+                                             fd,
+                                             offset_in,
+                                             &buffer,
+                                             &length) == true);
+  offset = dl_cache_buffer_offset(&cache, buffer);
+  printf("cache read: out: offset=%d length=%d\n", (int) offset, (int) length);
+  rtems_test_assert(length == length_in);
+  rtems_test_assert(dl_cache_check(buffer, (int) offset_in, length) == true);
+
+  rtems_rtl_obj_cache_close(&cache);
+
+  return 0;
+}
diff --git a/testsuites/libtests/dl03/dl-cache.h b/testsuites/libtests/dl03/dl-cache.h
new file mode 100644
index 0000000..e46df4b
--- /dev/null
+++ b/testsuites/libtests/dl03/dl-cache.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2016 Chris Johns <chrisj at rtems.org>.  All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if !defined(_DL_CACHE_H_)
+#define _DL_CACHE_H_
+
+int dl_cache_test(void);
+
+#endif
diff --git a/testsuites/libtests/dl03/dl03.doc b/testsuites/libtests/dl03/dl03.doc
new file mode 100644
index 0000000..4a325de
--- /dev/null
+++ b/testsuites/libtests/dl03/dl03.doc
@@ -0,0 +1,28 @@
+# Copyright (c) 2014 Chris Johns <chrisj at rtems.org>
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.org/license/LICENSE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: dl02
+
+directives:
+
+  dlopen
+  dlinfo
+  dlsym
+  dlclose
+
+concepts:
+
++ Load 2 interdependent ELF object files.
++ Check there are no unreolved externals. There should be unresolved
+  externals after the first lond and none after the second load.
++ Locate the rtems_main symbol in dl-o1.
++ Call the rtems_main sym and have that function call the second object.
+  Call the second download with a callback handler to a symbol in the first
+  object file.
++ Unload the ELF files.
diff --git a/testsuites/libtests/dl03/dl03.scn b/testsuites/libtests/dl03/dl03.scn
new file mode 100644
index 0000000..ab22475
--- /dev/null
+++ b/testsuites/libtests/dl03/dl03.scn
@@ -0,0 +1,67 @@
+*** BEGIN OF TEST libdl (RTL) 3 ***
+cache create with large size
+rtl: alloc: new: OBJECT addr=0x0 size=4294967295
+cache create
+rtl: alloc: new: OBJECT addr=0x112448 size=2048
+cache file open
+cache read:  in: offset=0 length=1024
+rtl: cache:  3: fd=-1 offset=0 length=1024 area=[0,1024] cache=[0,0] size=0
+rtl: cache:  3: seek: offset=0 buffer_offset=0 read=2048 cache=[0,2048] dist=0
+cache read: out: offset=0 length=1024
+cache:   buffer: 0000/0000 0001/0001 0002/0002 0003/0003
+cache read:  in: offset=0 length=2048
+rtl: cache:  3: fd=3 offset=0 length=2048 area=[0,2048] cache=[0,2048] size=8192
+cache read: out: offset=0 length=2048
+cache:   buffer: 0000/0000 0001/0001 0002/0002 0003/0003
+cache read:  in: offset=1024 length=1024
+rtl: cache:  3: fd=3 offset=1024 length=1024 area=[1024,2048] cache=[0,2048] size=8192
+cache read: out: offset=1024 length=1024
+cache:   buffer: 0200/0200 0201/0201 0202/0202 0203/0203
+cache read:  in: offset=6144 length=2048
+rtl: cache:  3: fd=3 offset=6144 length=2048 area=[6144,8192] cache=[0,2048] size=8192
+rtl: cache:  3: seek: offset=6144 buffer_offset=0 read=2048 cache=[6144,8192] dist=2048
+cache read: out: offset=0 length=2048
+cache:   buffer: 0c00/0c00 0c01/0c01 0c02/0c02 0c03/0c03
+cache read:  in: offset=7168 length=1024
+rtl: cache:  3: fd=3 offset=7168 length=1024 area=[7168,8192] cache=[6144,8192] size=8192
+cache read: out: offset=1024 length=1024
+cache:   buffer: 0e00/0e00 0e01/0e01 0e02/0e02 0e03/0e03
+cache read:  in: offset=0 length=512
+rtl: cache:  3: fd=3 offset=0 length=512 area=[0,512] cache=[6144,8192] size=8192
+rtl: cache:  3: seek: offset=0 buffer_offset=0 read=2048 cache=[0,2048] dist=8192
+cache read: out: offset=0 length=512
+cache:   buffer: 0000/0000 0001/0001 0002/0002 0003/0003
+cache read:  in: offset=0 length=256
+rtl: cache:  3: fd=3 offset=0 length=256 area=[0,256] cache=[0,2048] size=8192
+cache read: out: offset=0 length=256
+cache:   buffer: 0000/0000 0001/0001 0002/0002 0003/0003
+cache read:  in: offset=0 length=2048
+rtl: cache:  3: fd=3 offset=0 length=2048 area=[0,2048] cache=[0,2048] size=8192
+cache read: out: offset=0 length=2048
+cache:   buffer: 0000/0000 0001/0001 0002/0002 0003/0003
+cache read:  in: offset=8152 length=16
+rtl: cache:  3: fd=3 offset=8152 length=16 area=[8152,8168] cache=[0,2048] size=8192
+rtl: cache:  3: seek: offset=8152 buffer_offset=0 read=40 cache=[8152,8192] dist=40
+cache read: out: offset=0 length=16
+cache:   buffer: 0fec/0fec 0fed/0fed 0fee/0fee 0fef/0fef
+cache read: in: offset=8152 length=40
+rtl: cache:  3: fd=3 offset=8152 length=40 area=[8152,8192] cache=[8152,8192] size=8192
+cache read: out: offset=0 length=40
+cache:   buffer: 0fec/0fec 0fed/0fed 0fee/0fee 0fef/0fef
+cache read:  in: offset=8152 length=80
+rtl: cache:  3: fd=3 offset=8152 length=80 area=[8152,8232] cache=[8152,8192] size=8192
+rtl: cache:  3: truncate length=1082552
+cache read: out: offset=0 length=40
+cache:   buffer: 0fec/0fec 0fed/0fed 0fee/0fee 0fef/0fef
+cache read:  in: offset=6224 length=20
+rtl: cache:  3: fd=3 offset=6224 length=20 area=[6224,6244] cache=[8152,8192] size=8192
+rtl: cache:  3: seek: offset=6224 buffer_offset=0 read=1968 cache=[6224,8192] dist=1968
+cache read: out: offset=0 length=20
+cache:   buffer: 0c28/0c28 0c29/0c29 0c2a/0c2a 0c2b/0c2b
+cache read:  in: offset=8152 length=40
+rtl: cache:  3: fd=3 offset=8152 length=40 area=[8152,8192] cache=[6224,8192] size=8192
+cache read: out: offset=1928 length=40
+cache:   buffer: 0fec/0fec 0fed/0fed 0fee/0fee 0fef/0fef
+rtl: cache:  3: close
+rtl: alloc: del: OBJECT addr=0x112448
+*** END OF TEST libdl (RTL) 3 ***
diff --git a/testsuites/libtests/dl03/init.c b/testsuites/libtests/dl03/init.c
new file mode 100644
index 0000000..68f8150
--- /dev/null
+++ b/testsuites/libtests/dl03/init.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014 Chris Johns <chrisj at rtems.org>.  All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+  #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <errno.h>
+#include <string.h>
+#include <stdint.h>
+#include <unistd.h>
+
+#include "dl-cache.h"
+
+const char rtems_test_name[] = "libdl (RTL) 3";
+
+/* forward declarations to avoid warnings */
+static rtems_task Init(rtems_task_argument argument);
+
+static int test(void)
+{
+  int ret;
+  ret = dl_cache_test();
+  if (ret)
+    rtems_test_exit(ret);
+  return 0;
+}
+
+static void Init(rtems_task_argument arg)
+{
+  TEST_BEGIN();
+
+  test();
+
+  TEST_END();
+
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (8U * 1024U)
+
+#define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_INIT_TASK_ATTRIBUTES   (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>




More information about the vc mailing list