testsuite: Add libdl/dl04 cache test.

This commit is contained in:
Chris Johns
2016-08-15 17:58:01 +10:00
parent 97d395bac3
commit 381c42b01e
10 changed files with 1549 additions and 0 deletions
+3
View File
@@ -47,6 +47,9 @@ endif
if DLTESTS
_SUBDIRS += dl01 dl02 dl03
if HAS_CXX
_SUBDIRS += dl04
endif
endif
include $(top_srcdir)/../automake/test-subdirs.am
+1
View File
@@ -127,6 +127,7 @@ devnullfatal01/Makefile
dl01/Makefile
dl02/Makefile
dl03/Makefile
dl04/Makefile
dumpbuf01/Makefile
ftp01/Makefile
gxx01/Makefile
+50
View File
@@ -0,0 +1,50 @@
rtems_tests_PROGRAMS = dl04
# include a C++ file in the source to trick automake into adding C++ rules <sigh>.
dl04_SOURCES = init.c dl-load.c dl-cpp.cpp dl-tar.c dl-tar.h
BUILT_SOURCES = dl-tar.c dl-tar.h
dist_rtems_tests_DATA = dl04.scn dl04.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(dl04_OBJECTS)
LINK_LIBS = $(dl04_LDLIBS)
dl-o4.o: dl-o4.cpp
dl.tar: dl-o4.o
@rm -f $@
$(PAX) -w -f $@ $<
CLEANFILES += dl.tar
dl-tar.c: dl.tar
$(BIN2C) -C $< $@
CLEANFILES += dl-tar.c
dl-tar.h: dl.tar
$(BIN2C) -H $< $@
CLEANFILES += dl-tar.h
dl04.pre$(EXEEXT): $(dl04_OBJECTS) $(dl04_DEPENDENCIES)
@rm -f dl04.pre$(EXEEXT)
$(make-exe)
rm -f dl04.pre.ralf
dl04.pre: dl04.pre$(EXEEXT)
mv $< $@
CLEANFILES += dl04.pre
dl-sym.o: dl04.pre
rtems-syms -e -c "$(CFLAGS)" -o $@ $<
dl04$(EXEEXT): $(dl04_OBJECTS) $(dl04_DEPENDENCIES) dl-sym.o
@rm -f dl04$(EXEEXT)
$(LINK.c) $(CPU_CFLAGS) $(AM_CFLAGS) $(AM_LDFLAGS) \
-o $(basename $@)$(EXEEXT) $(LINK_OBJS) dl-sym.o $(LINK_LIBS)
include $(top_srcdir)/../automake/local.am
+4
View File
@@ -0,0 +1,4 @@
/* empty file to trick automake. */
class empty
{
};
+37
View File
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2016 Chris Johns <chrisj@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 <stdio.h>
#include <dlfcn.h>
#include <rtems/rtl/rtl-trace.h>
#include "dl-load.h"
int dl_load_test(void)
{
void* handle;
const char* err;
rtems_rtl_trace_set_mask(RTEMS_RTL_TRACE_ALL);
handle = dlopen("/dl-o4.o", RTLD_GLOBAL | RTLD_NOW);
err = dlerror();
if (err != NULL)
printf("dlopen: %s\n", err);
rtems_test_assert(handle != NULL);
rtems_test_assert(dlclose(handle) == 0);
return 0;
}
+14
View File
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2016 Chris Johns <chrisj@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
+30
View File
@@ -0,0 +1,30 @@
class Foo {
public:
Foo() {};
~Foo() {};
virtual void f1() {};
virtual void f2() {};
virtual void f3() {};
virtual void f4() {};
virtual void f5() {};
virtual void f6() {};
virtual void f7() {};
};
class Bar : public Foo {
};
void baz(void)
{
Bar b;
b.f1();
}
extern "C" {
void func(void)
{
baz();
}
}
+21
View File
@@ -0,0 +1,21 @@
# Copyright (c) 2016 Chris Johns <chrisj@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: dl04
directives:
dlopen
dlerror
dlclose
concepts:
+ Load a single ELF object file containing C++ code that tests the cache handling.
+ Unload the ELF file.
File diff suppressed because it is too large Load Diff
+82
View File
@@ -0,0 +1,82 @@
/*
* Copyright (c) 2016 Chris Johns <chrisj@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) 4";
/* forward declarations to avoid warnings */
static rtems_task Init(rtems_task_argument argument);
#include "dl-tar.h"
#define TARFILE_START dl_tar
#define TARFILE_SIZE dl_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_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
#include <rtems/confdefs.h>