1
1

Add a simple test inspired by Ashley Pittman to double check that the

msgq DLL is at least lt_dlopen-able.

This commit was SVN r22295.
Этот коммит содержится в:
Jeff Squyres 2009-12-11 21:09:16 +00:00
родитель 781164a96c
Коммит 528a22d1eb
2 изменённых файлов: 79 добавлений и 0 удалений

Просмотреть файл

@ -19,6 +19,8 @@
noinst_LTLIBRARIES = libdebuggers.la libompi_debugger_canary.la
pkglib_LTLIBRARIES = libompi_dbg_msgq.la
check_PROGRAMS = dlopen_test
TESTS = $(check_PROGRAMS)
# This is not quite in the Automake spirit, but we have to do it.
# Since the totalview portion of the library must be built with -g, we
@ -36,6 +38,11 @@ headers = \
ompi_common_dll_defs.h \
msgq_interface.h ompi_msgq_dll_defs.h
# Simple checks to ensure that the DSOs are functional
dlopen_test_SOURCES = dlopen_test.c
dlopen_test_LDADD = $(top_builddir)/opal/libltdl/libltdlc.la
libdebuggers_la_SOURCES = \
$(headers) \
ompi_debuggers.c

72
ompi/debuggers/dlopen_test.c Обычный файл
Просмотреть файл

@ -0,0 +1,72 @@
/*
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "opal_config.h"
#include <stdio.h>
#include "opal/libltdl/ltdl.h"
int main(int argc, char *argv[])
{
char *filename = "./libompi_dbg_msgq";
lt_dlhandle dlhandle;
#if OPAL_HAVE_LTDL_ADVISE
lt_dladvise dladvise;
#endif
if (lt_dlinit() != 0) {
printf("Failed to lt_dlinit\n");
return 1;
}
printf("Trying to lt_dlopen file with dladvise_local: %s\n", filename);
#if OPAL_HAVE_LTDL_ADVISE
if (lt_dladvise_init(&dladvise) ||
lt_dladvise_ext(&dladvise) ||
lt_dladvise_local(&dladvise)) {
printf("lt_dladvise failed to initialize properly\n");
return 1;
}
dlhandle = lt_dlopenadvise(filename, dladvise);
lt_dladvise_destroy(&dladvise);
#else
dlhandle = lt_dlopenext(filename);
#endif
if (NULL != dlhandle) {
lt_dlclose(dlhandle);
printf("File opened with dladvise_local, all passed\n");
return 0;
}
printf("Failed to open with dladvise_local: %s\n", lt_dlerror());
printf("Retrying with dladvise_global\n");
#if OPAL_HAVE_LTDL_ADVISE
if (lt_dladvise_init(&dladvise) ||
lt_dladvise_ext(&dladvise) ||
lt_dladvise_global(&dladvise)) {
printf("lt_dladvise failed to initialize properly\n");
return 1;
}
dlhandle = lt_dlopenadvise(filename, dladvise);
lt_dladvise_destroy(&dladvise);
#else
dlhandle = lt_dlopenext(filename);
#endif
if (NULL != dlhandle) {
lt_dlclose(dlhandle);
printf("File opened with dladvise_global\n");
return 1;
}
printf("File failed to opene with dladvise_global: %s\n", lt_dlerror());
return 2;
}