[PATCH 3/3] testsuites/dl06: Add a test for RAP format.

Chris Johns chrisj at rtems.org
Thu Apr 12 04:57:16 UTC 2018


This test loads a RAP format file that contains calls that are not
in the kernel and linked from libm. It uses and test rtems-ld.

Update #2769
---
 testsuites/libtests/Makefile.am    | 104 +++++++++++++++++++++++++++----------
 testsuites/libtests/configure.ac   |   1 +
 testsuites/libtests/dl06/dl-load.c |  95 +++++++++++++++++++++++++++++++++
 testsuites/libtests/dl06/dl-load.h |  14 +++++
 testsuites/libtests/dl06/dl06-o1.c |  53 +++++++++++++++++++
 testsuites/libtests/dl06/dl06-o2.c |  38 ++++++++++++++
 testsuites/libtests/dl06/dl06-o2.h |  16 ++++++
 testsuites/libtests/dl06/dl06.doc  |  28 ++++++++++
 testsuites/libtests/dl06/dl06.scn  |  22 ++++++++
 testsuites/libtests/dl06/init.c    |  89 +++++++++++++++++++++++++++++++
 10 files changed, 434 insertions(+), 26 deletions(-)
 create mode 100644 testsuites/libtests/dl06/dl-load.c
 create mode 100644 testsuites/libtests/dl06/dl-load.h
 create mode 100644 testsuites/libtests/dl06/dl06-o1.c
 create mode 100644 testsuites/libtests/dl06/dl06-o2.c
 create mode 100644 testsuites/libtests/dl06/dl06-o2.h
 create mode 100644 testsuites/libtests/dl06/dl06.doc
 create mode 100644 testsuites/libtests/dl06/dl06.scn
 create mode 100644 testsuites/libtests/dl06/init.c

diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index ba4e1e8528..692df90b6f 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -323,8 +323,12 @@ lib_screens += dl01/dl01.scn
 lib_docs += dl01/dl01.doc
 dl01_SOURCES = dl01/init.c dl01/dl-load.c dl01-tar.c dl01-tar.h
 dl01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl01) $(support_includes)
-dl01-o1.o: dl01/dl-o1.c
-	$(AM_V_GEN)$(COMPILE) -c -o $@ $<
+dl01/init.c: dl01-tar.o
+dl01.pre: $(dl01_OBJECTS) $(dl01_DEPENDENCIES)
+	@rm -f dl01.pre
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl01-o1.o: dl01/dl-o1.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl01.tar: dl01-o1.o
 	@rm -f $@
 	$(AM_V_GEN)$(PAX) -w -f $@ $<
@@ -333,15 +337,12 @@ dl01-tar.c: dl01.tar
 dl01-tar.h: dl01.tar
 	$(AM_V_GEN)$(BIN2C) -H $< $@
 dl01-tar.o: dl01-tar.c dl01-tar.h
-dl01/init.c: dl01-tar.o
-dl01.pre: $(dl01_OBJECTS) $(dl01_DEPENDENCIES)
-	@rm -f dl01.pre
-	$(AM_V_CLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl01-sym.o: dl01.pre
 	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
 dl01$(EXEEXT):  $(dl01_OBJECTS) $(dl01_DEPENDENCIES) dl01-sym.o
 	@rm -f $@
-	$(AM_V_CLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
 CLEANFILES += dl01.pre dl01-sym.o dl02-o1.o dl01.tar dl01-tar.h
 endif
 endif
@@ -353,10 +354,14 @@ lib_screens += dl02/dl02.scn
 lib_docs += dl02/dl02.doc
 dl02_SOURCES = dl02/init.c dl02/dl-load.c dl02-tar.c dl02-tar.h
 dl02_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl02) $(support_includes)
-dl02-o1.o: dl02/dl-o1.c
-	$(AM_V_GEN)$(COMPILE) -c -o $@ $<
-dl02-o2.o: dl02/dl-o2.c
-	$(AM_V_GEN)$(COMPILE) -c -o $@ $<
+dl02/init.c: dl02-tar.o
+dl02.pre: $(dl02_OBJECTS) $(dl02_DEPENDENCIES)
+	@rm -f dl02.pre
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl02-o1.o: dl02/dl-o1.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl02-o2.o: dl02/dl-o2.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl02.tar: dl02-o1.o dl02-o2.o
 	@rm -f $@
 	$(AM_V_GEN)$(PAX) -w -f $@ $<
@@ -365,15 +370,12 @@ dl02-tar.c: dl02.tar
 dl02-tar.h: dl02.tar
 	$(AM_V_GEN)$(BIN2C) -H $< $@
 dl02-tar.o: dl02-tar.c dl02-tar.h
-dl02/init.c: dl02-tar.o
-dl02.pre: $(dl02_OBJECTS) $(dl02_DEPENDENCIES)
-	@rm -f dl02.pre
-	$(AM_V_CLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl02-sym.o: dl02.pre
 	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
 dl02$(EXEEXT):  $(dl02_OBJECTS) $(dl02_DEPENDENCIES) dl02-sym.o
 	@rm -f $@
-	$(AM_V_CLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
 CLEANFILES += dl02.pre dl02-sym.o dl02-o1.o dl02-o2.o dl02.tar dl02-tar.h
 endif
 endif
@@ -397,7 +399,11 @@ lib_docs += dl04/dl04.doc
 dl04_SOURCES = dl04/init.c dl04/dl-load.c dl04/dl-cpp.cpp dl04-tar.c \
 	dl04-tar.h
 dl04_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl04) $(support_includes)
-dl04-o4.o: dl04/dl-o4.cpp
+dl04/init.c: dl04-tar.o
+dl04.pre: $(dl04_OBJECTS) $(dl04_DEPENDENCIES)
+	@rm -f dl04.pre
+	$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl04-o4.o: dl04/dl-o4.cpp Makefile
 	$(AM_V_GEN)$(CXXCOMPILE) -c -o $@ $<
 dl04.tar: dl04-o4.o
 	@rm -f $@
@@ -407,10 +413,7 @@ dl04-tar.c: dl04.tar
 dl04-tar.h: dl04.tar
 	$(AM_V_GEN)$(BIN2C) -H $< $@
 dl04-tar.o: dl04-tar.c dl04-tar.h
-dl04/init.c: dl04-tar.o
-dl04.pre: $(dl04_OBJECTS) $(dl04_DEPENDENCIES)
-	@rm -f dl04.pre
-	$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl04-sym.o: dl04.pre
 	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
 dl04$(EXEEXT):  $(dl04_OBJECTS) $(dl04_DEPENDENCIES) dl04-sym.o
@@ -430,6 +433,10 @@ lib_docs += dl05/dl05.doc
 dl05_SOURCES = dl05/init.c dl05/dl-load.c dl05/dl-cpp.cpp dl05-tar.c \
 	dl05-tar.h
 dl05_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl05) $(support_includes)
+dl05/init.c: dl05-tar.o
+dl05.pre: $(dl05_OBJECTS) $(dl05_DEPENDENCIES)
+	@rm -f dl05.pre
+	$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
 dl05-o5.o: dl05/dl-o5.cpp
 	$(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $<
 dl05.tar: dl05-o5.o
@@ -440,13 +447,10 @@ dl05-tar.c: dl05.tar
 dl05-tar.h: dl05.tar
 	$(AM_V_GEN)$(BIN2C) -H $< $@
 dl05-tar.o: dl05-tar.c dl05-tar.h
-dl05/init.c: dl05-tar.o
-dl05.pre: $(dl05_OBJECTS) $(dl05_DEPENDENCIES)
-	@rm -f dl05.pre
-	$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
 dl05-sym.o: dl05.pre
 	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
-dl05$(EXEEXT):  $(dl05_OBJECTS) $(dl05_DEPENDENCIES) dl05-sym.o
+dl05$(EXEEXT): $(dl05_OBJECTS) $(dl05_DEPENDENCIES) dl05-sym.o
 	@rm -f $@
 	$(AM_V_CXXLD)$(LINK.cc) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
 CLEANFILES += dl05.pre dl05-sym.o dl05-o5.o dl05.tar dl05-tar.h
@@ -454,6 +458,54 @@ endif
 endif
 endif
 
+if DLTESTS
+if TEST_dl06
+lib_tests += dl06
+lib_screens += dl06/dl06.scn
+lib_docs += dl06/dl06.doc
+dl06_SOURCES = dl06/init.c dl06/dl-load.c dl06-tar.c dl06-tar.h
+dl06_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_dl06) $(support_includes)
+dl06/init.c: dl06-tar.o
+dl06-pre.tar: Makefile
+	$(AM_V_at)echo "Something in a file" > dl06_pre_file
+	$(AM_V_GEN)$(PAX) -w -f $@ dl06_pre_file
+dl06-pre-tar.c: dl06-pre.tar
+	$(AM_V_GEN)$(BIN2C) -N dl06_tar -C $< $@
+dl06-pre-tar.h: dl06-pre.tar
+	$(AM_V_GEN)$(BIN2C) -N dl06_tar -H $< $@
+dl06-pre-tar.o: dl06-pre-tar.c dl06-pre-tar.h
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl06-pre-init.o: dl06-pre-tar.o
+	$(AM_V_CC)$(COMPILE)  $(dl06_CPPFLAGS) $(CPU_CFLAGS) $(AM_CFLAGS) \
+		-DDL06_PRE -c -o $@ $(srcdir)/dl06/init.c
+dl06.pre: dl06-pre-init.o dl06/dl06-dl-load.o dl06-pre-tar.o
+	@rm -f $@
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+dl06-o1.o: dl06/dl06-o1.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl06-o2.o: dl06/dl06-o2.c Makefile
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl06.rap: dl06.pre dl06-o1.o dl06-o2.o
+	$(AM_V_GEN)rtems-ld -r $(RTEMS_BUILD_ROOT) -O rap -b $< -e rtems_main -s \
+	 -o $@ $(filter-out dl06.pre,$+) -lm
+dl06.tar: dl06.rap
+	@rm -f $@
+	$(AM_V_GEN)$(PAX) -w -f $@ $<
+dl06-tar.c: dl06.tar
+	$(AM_V_GEN)$(BIN2C) -C $< $@
+dl06-tar.h: dl06.tar
+	$(AM_V_GEN)$(BIN2C) -H $< $@
+dl06-tar.o: dl06-tar.c dl06-tar.h
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+dl06-sym.o: dl06.pre
+	$(AM_V_GEN)rtems-syms -e -c "$(CFLAGS)" -o $@ $<
+dl06$(EXEEXT): $(dl06_OBJECTS) dl06-sym.o
+	@rm -f $@
+	$(AM_V_CCLD)$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) -o $@ $+
+CLEANFILES += dl06.pre dl06-sym.o dl06-o1.o dl06-o2.o dl06.tar dl06-tar.h
+endif
+endif
+
 if TEST_dumpbuf01
 lib_tests += dumpbuf01
 lib_screens += dumpbuf01/dumpbuf01.scn
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index af9e1a390c..481a33569d 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -132,6 +132,7 @@ RTEMS_TEST_CHECK([dl02])
 RTEMS_TEST_CHECK([dl03])
 RTEMS_TEST_CHECK([dl04])
 RTEMS_TEST_CHECK([dl05])
+RTEMS_TEST_CHECK([dl06])
 RTEMS_TEST_CHECK([dumpbuf01])
 RTEMS_TEST_CHECK([dup2])
 RTEMS_TEST_CHECK([exit01])
diff --git a/testsuites/libtests/dl06/dl-load.c b/testsuites/libtests/dl06/dl-load.c
new file mode 100644
index 0000000000..d78e9d1ef8
--- /dev/null
+++ b/testsuites/libtests/dl06/dl-load.c
@@ -0,0 +1,95 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+
+#include <dlfcn.h>
+
+#include <rtems/rtl/rtl-trace.h>
+
+#include "dl-load.h"
+
+typedef int (*call_t)(int argc, const char* argv[]);
+
+static const char* call_args[] = { "1", "2", "3", "4" };
+
+static void* dl_load_obj(const char* name)
+{
+  void* handle;
+  int   unresolved;
+  char* message = "loaded";
+
+#if DL06_DEBUG_TRACING
+  rtems_rtl_trace_set_mask(RTEMS_RTL_TRACE_ALL);
+#endif
+
+  printf("\nload: %s\n", name);
+
+  handle = dlopen (name, RTLD_NOW | RTLD_GLOBAL);
+  if (!handle)
+  {
+    printf("dlopen failed: %s\n", dlerror());
+    return NULL;
+  }
+
+  if (dlinfo (handle, RTLD_DI_UNRESOLVED, &unresolved) < 0)
+    message = "dlinfo error checking unresolved status";
+  else if (unresolved)
+    message = "has unresolved externals";
+
+  printf ("handle: %p %s\n", handle, message);
+
+  return handle;
+}
+
+int dl_load_test(void)
+{
+  void*  r1;
+  call_t call;
+  int    call_ret;
+  int    ret;
+
+  r1 = dl_load_obj("/dl06.rap");
+  if (!r1)
+    return 1;
+
+#if 0
+  {
+    char* list[] = { "rtl", "list", NULL };
+    rtems_rtl_shell_command (2, list);
+    char* sym[] = { "rtl", "sym", NULL };
+    rtems_rtl_shell_command (2, sym);
+  }
+#endif
+
+  call = dlsym (r1, "rtems_main");
+  if (call == NULL)
+  {
+    printf("dlsym failed: symbol not found\n");
+    return 1;
+  }
+
+  call_ret = call (4, call_args);
+  if (call_ret != 4)
+  {
+    printf("dlsym call failed: ret value bad\n");
+    return 1;
+  }
+
+  ret = 0;
+
+  if (dlclose (r1) < 0)
+  {
+    printf("dlclose o1 failed: %s\n", dlerror());
+    ret = 1;
+  }
+
+  printf ("handle: %p closed\n", r1);
+
+  return ret;
+}
diff --git a/testsuites/libtests/dl06/dl-load.h b/testsuites/libtests/dl06/dl-load.h
new file mode 100644
index 0000000000..3f3910a90d
--- /dev/null
+++ b/testsuites/libtests/dl06/dl-load.h
@@ -0,0 +1,14 @@
+/*
+ * 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.
+ */
+
+#if !defined(_DL_LOAD_H_)
+#define _DL_LOAD_H_
+
+int dl_load_test(void);
+
+#endif
diff --git a/testsuites/libtests/dl06/dl06-o1.c b/testsuites/libtests/dl06/dl06-o1.c
new file mode 100644
index 0000000000..d3c882ebfb
--- /dev/null
+++ b/testsuites/libtests/dl06/dl06-o1.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#include "dl06-o2.h"
+
+#include <dlfcn.h>
+#include <math.h>
+
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+typedef void (*func1_t)(unsigned short s[7]);
+
+static void* find_sym(const char* name)
+{
+  void* sym = dlsym(RTLD_DEFAULT, name);
+  if (sym == NULL)
+    printf("dlsym failed: not found: %s\n", name);
+  return sym;
+}
+
+/*
+ * Yes a decl in the source. This is a modules main and I could not find which
+ * header main is defined in.
+ */
+int rtems_main (int argc, const char* argv[]);
+
+int rtems_main (int argc, const char* argv[])
+{
+  func1_t        f1;
+  int            arg;
+  double         d;
+  unsigned short s[7] = { 12, 34, 56, 78, 90, 13, 57 };
+
+  printf("Loaded module: argc:%d [%s]\n", argc, __FILE__);
+
+  f1 = find_sym ("dl_o2_func1");
+  if (f1 == NULL)
+    return 0;
+
+  f1 (s);
+
+  d = dl_o2_func2 (7.1, 33.0);
+  d = dl_o2_func3 (0.778899);
+
+  return argc;
+}
diff --git a/testsuites/libtests/dl06/dl06-o2.c b/testsuites/libtests/dl06/dl06-o2.c
new file mode 100644
index 0000000000..7d6f6c8d57
--- /dev/null
+++ b/testsuites/libtests/dl06/dl06-o2.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018 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.
+ */
+
+#include "dl06-o2.h"
+
+#include <stdlib.h>
+#include <math.h>
+
+#include <rtems/test.h>
+
+#define printf(...) rtems_printf(&rtems_test_printer, __VA_ARGS__);
+
+/*
+ * Call function that are not part of the RTEMS kernel base image.
+ */
+
+void dl_o2_func1 (unsigned short s[7])
+{
+  printf("libm: lcong48\n")
+  lcong48 (s);
+}
+
+double dl_o2_func2 (double d1, double d2)
+{
+  printf("libm: atan2\n")
+  return atan2 (d1, d2);
+}
+
+double dl_o2_func3 (double d)
+{
+  printf("libm: tan\n")
+  return tan (d);
+}
diff --git a/testsuites/libtests/dl06/dl06-o2.h b/testsuites/libtests/dl06/dl06-o2.h
new file mode 100644
index 0000000000..12be7ee197
--- /dev/null
+++ b/testsuites/libtests/dl06/dl06-o2.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2018 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(DL06_02_H)
+#define DL06_02_H
+
+void dl_o2_func1 (unsigned short s[7]);
+double dl_o2_func2 (double d1, double d2);
+double dl_o2_func3 (double d);
+
+#endif
diff --git a/testsuites/libtests/dl06/dl06.doc b/testsuites/libtests/dl06/dl06.doc
new file mode 100644
index 0000000000..4a325de9cc
--- /dev/null
+++ b/testsuites/libtests/dl06/dl06.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/dl06/dl06.scn b/testsuites/libtests/dl06/dl06.scn
new file mode 100644
index 0000000000..f1b4489a5f
--- /dev/null
+++ b/testsuites/libtests/dl06/dl06.scn
@@ -0,0 +1,22 @@
+*** BEGIN OF TEST libdl (RTL) 2 ***
+load: /dl-o1.o
+handle: 0x2150d0 has unresolved externals
+load: /dl-o2.o
+handle: 0x215838 loaded
+Loaded module: argc:4
+[../../../../../../../../rtems.master/c/src/../../testsuites/libtests/dl02/dl-o1.c]
+  0: 1
+  1: 2
+  2: 3
+  3: 4
+Loaded module: argc:4
+[../../../../../../../../rtems.master/c/src/../../testsuites/libtests/dl02/dl-o2.c]
+  0: 1
+  1: 2
+  2: 3
+  3: 4
+dl_o1_callback: string in dl_o2
+rtems_main: callback count: 3
+handle: 0x2150d0 closed
+handle: 0x215838 closed
+*** END OF TEST libdl (RTL) 2 ***
diff --git a/testsuites/libtests/dl06/init.c b/testsuites/libtests/dl06/init.c
new file mode 100644
index 0000000000..4c28c6a06a
--- /dev/null
+++ b/testsuites/libtests/dl06/init.c
@@ -0,0 +1,89 @@
+/*
+ * 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 <rtems/rtl/rtl.h>
+#include <rtems/untar.h>
+
+#include "dl-load.h"
+
+const char rtems_test_name[] = "libdl (RTL) 6";
+
+/* forward declarations to avoid warnings */
+static rtems_task Init(rtems_task_argument argument);
+
+#if DL06_PRE
+#include "dl06-pre-tar.h"
+#else
+#include "dl06-tar.h"
+#endif
+
+#define TARFILE_START dl06_tar
+#define TARFILE_SIZE  dl06_tar_size
+
+static int test(void)
+{
+  int ret;
+  ret = dl_load_test();
+  if (ret)
+    rtems_test_exit(ret);
+  return 0;
+}
+
+static void Init(rtems_task_argument arg)
+{
+  int te;
+
+  TEST_BEGIN();
+
+  te = Untar_FromMemory((void *)TARFILE_START, (size_t)TARFILE_SIZE);
+  if (te != 0)
+  {
+    printf("untar failed: %d\n", te);
+    rtems_test_exit(1);
+    exit (1);
+  }
+
+  test();
+
+  TEST_END();
+
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_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_MAXIMUM_SEMAPHORES 1
+
+#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>
-- 
2.15.1




More information about the devel mailing list