Skip to content

Commit

Permalink
Remove AX_DLOPEN and fix XML output for Junit.
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianAker committed Feb 4, 2014
1 parent 107b1a3 commit d74a838
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 29 deletions.
6 changes: 2 additions & 4 deletions configure.ac
Expand Up @@ -47,6 +47,8 @@ LT_INIT([dlopen])
LT_LANG([C++])
LT_LIB_M

AC_SUBST([lt_cv_dlopen_libs])

AC_PROG_CC_C99
AS_IF([test "x${ac_cv_prog_cc_c99}" == "xno"],[AC_MSG_ERROR([No c99 compatible compiler found])])

Expand Down Expand Up @@ -112,7 +114,6 @@ AX_ENABLE_LIBHIREDIS
# Checks for programs.
AC_CHECK_PROGS([DPKG_GENSYMBOLS],[dpkg-gensymbols])
AC_CHECK_PROGS([OPENSSL],[openssl])
AC_CHECK_PROGS([PERL],[perl])
AC_CHECK_PROGS([VALGRIND],['valgrind'])
AC_CHECK_PROGS([WINE],['wine'])
AC_PATH_PROG([GPERF],['gperf'],[])
Expand Down Expand Up @@ -225,9 +226,6 @@ AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNC([setsockopt],[],[AC_CHECK_LIB([socket],[setsockopt])])
AC_CHECK_FUNC([bind],[],[AC_CHECK_LIB([bind],[bind])])

# Check for the ability to call dlopen (used in libhostile)
AX_DLOPEN

# Check for -lrt
AC_CHECK_LIB([rt],[clock_gettime],
[AX_SAVE_FLAGS
Expand Down
2 changes: 1 addition & 1 deletion gearmand/include.am
Expand Up @@ -41,7 +41,7 @@ gearmand_hostile_gearmand_SOURCES=

gearmand_hostile_gearmand_CXXFLAGS+= $(gearmand_gearmand_CXXFLAGS)
EXTRA_gearmand_hostile_gearmand_DEPENDENCIES+= $(EXTRA_gearmand_gearmand_DEPENDENCIES)
gearmand_hostile_gearmand_LDADD+= @DL_LIB@
gearmand_hostile_gearmand_LDADD+= @lt_cv_dlopen_libs@
gearmand_hostile_gearmand_LDADD+= libgearman-server/libgearman-server.la
if TARGET_HOSTILE
gearmand_hostile_gearmand_LDADD+= libhostile/libhostile.la
Expand Down
2 changes: 1 addition & 1 deletion libgearman-server/include.am
Expand Up @@ -92,7 +92,7 @@ libgearman_server_libgearman_server_la_LIBADD+= @LIBEVENT_LIB@
libgearman_server_libgearman_server_la_LIBADD+= @PTHREAD_LIBS@
libgearman_server_libgearman_server_la_LIBADD+= @BOOST_PROGRAM_OPTIONS_LIB@
libgearman_server_libgearman_server_la_LIBADD+= @LIBM@
libgearman_server_libgearman_server_la_LIBADD+= @DL_LIB@
libgearman_server_libgearman_server_la_LIBADD+= @lt_cv_dlopen_libs@
libgearman_server_libgearman_server_la_LIBADD+= @RT_LIB@
if ENABLE_SSL
if ENABLE_CYASSL
Expand Down
6 changes: 3 additions & 3 deletions libgearman/include.am
Expand Up @@ -74,13 +74,13 @@ noinst_HEADERS+= \

noinst_LTLIBRARIES+= libgearman/libgearman-vector.la
libgearman_libgearman_vector_la_CXXFLAGS= -DBUILDING_LIBGEARMAN
libgearman_libgearman_vector_la_LIBADD= @DL_LIB@
libgearman_libgearman_vector_la_LIBADD= @lt_cv_dlopen_libs@
libgearman_libgearman_vector_la_SOURCES= libgearman/vector.cc
libgearman_libgearman_vector_la_SOURCES+= libgearman/backtrace.cc

noinst_LTLIBRARIES+= libgearman/libgearman-result.la
libgearman_libgearman_result_la_CXXFLAGS= -DBUILDING_LIBGEARMAN
libgearman_libgearman_result_la_LIBADD= @DL_LIB@
libgearman_libgearman_result_la_LIBADD= @lt_cv_dlopen_libs@
libgearman_libgearman_result_la_SOURCES= libgearman/vector.cc
libgearman_libgearman_result_la_SOURCES+= libgearman/result.cc
libgearman_libgearman_result_la_SOURCES+= libgearman/backtrace.cc
Expand Down Expand Up @@ -152,7 +152,7 @@ libgearman_libgearman_la_LDFLAGS+= @OPENSSL_LDFLAGS@
endif
endif
endif
libgearman_libgearman_la_LIBADD+= @DL_LIB@
libgearman_libgearman_la_LIBADD+= @lt_cv_dlopen_libs@
libgearman_libgearman_la_LIBADD+= @LIBUUID_LIB@
libgearman_libgearman_la_LIBADD+= libhashkit/libhashkit.la

Expand Down
2 changes: 1 addition & 1 deletion libgearmancore/include.am
Expand Up @@ -35,6 +35,6 @@ libgearman_libgearmancore_la_SOURCES+= libgearman/vector.cc

libgearman_libgearmancore_la_CXXFLAGS= -DBUILDING_LIBGEARMAN
libgearman_libgearmancore_la_LIBADD=
libgearman_libgearmancore_la_LIBADD+= @DL_LIB@
libgearman_libgearmancore_la_LIBADD+= @lt_cv_dlopen_libs@
libgearman_libgearmancore_la_LIBADD+= @LIBUUID_LIB@
libgearman_libgearmancore_la_LIBADD+= libhashkit/libhashkit.la
2 changes: 1 addition & 1 deletion libhostile/include.am
Expand Up @@ -50,7 +50,7 @@ libhostile_libhostile_la_CXXFLAGS+= @PTHREAD_CFLAGS@
libhostile_libhostile_la_SOURCES+= libhostile/initialize.c

if TARGET_HOSTILE
libhostile_libhostile_la_LIBADD+= @DL_LIB@
libhostile_libhostile_la_LIBADD+= @lt_cv_dlopen_libs@
libhostile_libhostile_la_LIBADD+= @RT_LIB@
libhostile_libhostile_la_LIBADD+= @PTHREAD_LIBS@

Expand Down
74 changes: 69 additions & 5 deletions libtest/formatter.cc
Expand Up @@ -41,6 +41,60 @@
#include <algorithm>
#include <fstream>
#include <iostream>

namespace {

std::string& escape4XML(std::string const& arg, std::string& escaped_string)
{
escaped_string.clear();

escaped_string+= '"';
for (std::string::const_iterator x= arg.begin(), end= arg.end(); x != end; ++x)
{
unsigned char c= *x;
if (c == '&')
{
escaped_string+= "&amp;";
}
else if (c == '>')
{
escaped_string+= "&gt;";
}
else if (c == '<')
{
escaped_string+= "&lt;";
}
else if (c == '\'')
{
escaped_string+= "&apos;"; break;
}
else if (c == '"')
{
escaped_string+= "&quot;";
}
else if (c == ' ')
{
escaped_string+= ' ';
}
else if (isalnum(c))
{
escaped_string+= c;
}
else
{
char const* const hexdig= "0123456789ABCDEF";
escaped_string+= "&#x";
escaped_string+= hexdig[c >> 4];
escaped_string+= hexdig[c & 0xF];
escaped_string+= ';';
}
}
escaped_string+= '"';

return escaped_string;
}

}

namespace libtest {

Expand Down Expand Up @@ -111,7 +165,8 @@ void Legacy::report(const libtest::TestCase* test, size_t) const
Junit::Junit(const Framework* frame_, std::ostream& output_):
Formatter(frame_, output_)
{
_output << "<testsuites name=\"" << name() << "\">" << std::endl;
std::string escaped_string;
_output << "<testsuites name=" << escape4XML(name(), escaped_string) << ">" << std::endl;
}

Junit::~Junit()
Expand All @@ -121,9 +176,11 @@ Junit::~Junit()

void Junit::report(const libtest::TestCase* test, size_t) const
{
_output << "\t\t<testcase name=\""
<< test->name()
<< "\" time=\""
std::string escaped_string;

_output << "\t\t<testcase name="
<< escape4XML(test->name(), escaped_string)
<< " time=\""
<< test->timer()
<< "\">"
<< std::endl;
Expand All @@ -146,7 +203,14 @@ void Junit::report(const libtest::TestCase* test, size_t) const

void Junit::plan(const Collection* collection)
{
_output << "\t<testsuite name=\"" << collection->name() << "\" classname=\"\" package=\"\">" << std::endl;
std::string escaped_string;

_output << "\t<testsuite name="
<< escape4XML(collection->name(), escaped_string)
<< ">" << std::endl;
#if 0
<< "\" classname=\"\" package=\"\">" << std::endl;
#endif
}

void Junit::complete()
Expand Down
2 changes: 1 addition & 1 deletion libtest/include.am
Expand Up @@ -259,7 +259,7 @@ libtest_backtrace_SOURCES=
libtest_backtrace_LDADD=
libtest_backtrace_SOURCES+= libtest/backtrace_test.cc
libtest_backtrace_SOURCES+= libgearman/backtrace.cc
libtest_backtrace_LDADD+= @DL_LIB@
libtest_backtrace_LDADD+= @lt_cv_dlopen_libs@
noinst_PROGRAMS+= libtest/backtrace
test-backtrace: libtest/backtrace
@libtest/backtrace
Expand Down
10 changes: 0 additions & 10 deletions m4/ax_dlopen.m4

This file was deleted.

4 changes: 2 additions & 2 deletions tests/hostile.am
Expand Up @@ -19,7 +19,7 @@ t_hostile_gearmand_CXXFLAGS+= -DHAVE_LIBHOSTILE=1
t_hostile_gearmand_CFLAGS+= -DHAVE_LIBHOSTILE=1
t_hostile_gearmand_LDADD+= libhostile/libhostile.la
if HOST_LINUX
t_hostile_gearmand_LDADD+= @DL_LIB@
t_hostile_gearmand_LDADD+= @lt_cv_dlopen_libs@
t_hostile_gearmand_LDADD+= @RT_LIB@
endif

Expand Down Expand Up @@ -50,7 +50,7 @@ t_hostile_libgearman_CXXFLAGS+= -DSERVER_TARGET="\"gearmand\""
t_hostile_libgearman_CFLAGS+= -DSERVER_TARGET="\"gearmand\""
t_hostile_libgearman_LDADD+= libhostile/libhostile.la
if HOST_LINUX
t_hostile_libgearman_LDADD+= @DL_LIB@
t_hostile_libgearman_LDADD+= @lt_cv_dlopen_libs@
t_hostile_libgearman_LDADD+= @RT_LIB@
endif

Expand Down

0 comments on commit d74a838

Please sign in to comment.