Merge pull request #157 from sureshsundriyal/wip

Fix the tests when not compiled with bz2 support.
This commit is contained in:
Tim Stack 2015-03-28 12:11:03 -07:00
commit fdcb75d198
8 changed files with 31 additions and 16 deletions

View File

@ -249,6 +249,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@ AWK = @AWK@
BZIP2_CMD = @BZIP2_CMD@ BZIP2_CMD = @BZIP2_CMD@
BZIP2_SUPPORT = @BZIP2_SUPPORT@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@

View File

@ -13,6 +13,10 @@ export top_builddir
test_dir="@abssrcdir@/test" test_dir="@abssrcdir@/test"
export test_dir export test_dir
# Let the tests know whether bzip is supported or not.
BZIP2_SUPPORT="@BZIP2_SUPPORT@"
export BZIP2_SUPPORT
BZIP2_CMD="@BZIP2_CMD@" BZIP2_CMD="@BZIP2_CMD@"
export BZIP2_CMD export BZIP2_CMD

6
configure vendored
View File

@ -640,6 +640,7 @@ PCRE_LIBS
CURSES_LIB CURSES_LIB
HAVE_LOCAL_YAJL HAVE_LOCAL_YAJL
jemalloch jemalloch
BZIP2_SUPPORT
EGREP EGREP
GREP GREP
CPP CPP
@ -5965,9 +5966,12 @@ $as_echo "$ac_cv_search_BZ2_bzopen" >&6; }
ac_res=$ac_cv_search_BZ2_bzopen ac_res=$ac_cv_search_BZ2_bzopen
if test "$ac_res" != no; then : if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
BZIP2_SUPPORT=1
else
BZIP2_SUPPORT=0
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5
$as_echo_n "checking for library containing dlopen... " >&6; } $as_echo_n "checking for library containing dlopen... " >&6; }
if ${ac_cv_search_dlopen+:} false; then : if ${ac_cv_search_dlopen+:} false; then :

View File

@ -83,7 +83,10 @@ AC_STRUCT_TIMEZONE
AC_SEARCH_LIBS(openpty, util) AC_SEARCH_LIBS(openpty, util)
AC_SEARCH_LIBS(gzseek, z, [], [AC_MSG_ERROR([libz required to build])]) AC_SEARCH_LIBS(gzseek, z, [], [AC_MSG_ERROR([libz required to build])])
AC_SEARCH_LIBS(BZ2_bzopen, bz2) AC_SEARCH_LIBS(BZ2_bzopen, bz2,
AS_VAR_SET(BZIP2_SUPPORT, 1),
AS_VAR_SET(BZIP2_SUPPORT, 0))
AC_SUBST(BZIP2_SUPPORT)
AC_SEARCH_LIBS(dlopen, dl) AC_SEARCH_LIBS(dlopen, dl)
AC_SEARCH_LIBS(backtrace, execinfo) AC_SEARCH_LIBS(backtrace, execinfo)

View File

@ -336,6 +336,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@ AWK = @AWK@
BZIP2_CMD = @BZIP2_CMD@ BZIP2_CMD = @BZIP2_CMD@
BZIP2_SUPPORT = @BZIP2_SUPPORT@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@

View File

@ -545,6 +545,7 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@ AUTOMAKE = @AUTOMAKE@
AWK = @AWK@ AWK = @AWK@
BZIP2_CMD = @BZIP2_CMD@ BZIP2_CMD = @BZIP2_CMD@
BZIP2_SUPPORT = @BZIP2_SUPPORT@
CC = @CC@ CC = @CC@
CCDEPMODE = @CCDEPMODE@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@

View File

@ -101,18 +101,19 @@ int main(int argc, char *argv[])
else { else {
logfile lf(argv[0]); logfile lf(argv[0]);
struct stat st; struct stat st;
stat(argv[0], &st); stat(argv[0], &st);
assert(strcmp(argv[0], lf.get_filename().c_str()) == 0); assert(strcmp(argv[0], lf.get_filename().c_str()) == 0);
lf.rebuild_index(); lf.rebuild_index();
lf.rebuild_index(); lf.rebuild_index();
if (expected_format == "") { if (expected_format == "") {
assert(lf.get_format() == NULL); assert(lf.get_format() == NULL);
} }
else { else {
//printf("%s %s\n", lf.get_format()->get_name().c_str(), expected_format.c_str()); //printf("%s %s\n", lf.get_format()->get_name().c_str(), expected_format.c_str());
assert(lf.get_format()->get_name() == expected_format); assert(lf.get_format() != NULL);
assert(lf.get_format()->get_name() == expected_format);
} }
if (!lf.is_compressed()) { if (!lf.is_compressed()) {
assert(lf.get_modified_time() == st.st_mtime); assert(lf.get_modified_time() == st.st_mtime);
@ -123,7 +124,7 @@ int main(int argc, char *argv[])
break; break;
case MODE_ECHO: case MODE_ECHO:
for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) { for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) {
printf("%s\n", lf.read_line(iter).c_str()); printf("%s\n", lf.read_line(iter).c_str());
} }
break; break;
case MODE_LINE_COUNT: case MODE_LINE_COUNT:
@ -131,19 +132,19 @@ int main(int argc, char *argv[])
break; break;
case MODE_TIMES: case MODE_TIMES:
for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) { for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) {
char buffer[1024]; char buffer[1024];
time_t lt; time_t lt;
lt = iter->get_time(); lt = iter->get_time();
strftime(buffer, sizeof(buffer), strftime(buffer, sizeof(buffer),
"%b %d %H:%M:%S %Y", "%b %d %H:%M:%S %Y",
gmtime(&lt)); gmtime(&lt));
printf("%s -- %03d\n", buffer, iter->get_millis()); printf("%s -- %03d\n", buffer, iter->get_millis());
} }
break; break;
case MODE_LEVELS: case MODE_LEVELS:
for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) { for (logfile::iterator iter = lf.begin(); iter != lf.end(); ++iter) {
printf("0x%02x\n", iter->get_level()); printf("0x%02x\n", iter->get_level());
} }
break; break;
} }

View File

@ -52,7 +52,7 @@ Dec 03 09:23:38 2006 -- 000
Jan 03 09:47:02 2007 -- 000 Jan 03 09:47:02 2007 -- 000
EOF EOF
if test x"$BZIP2_CMD" != x""; then if test "$BZIP2_SUPPORT" -eq 1 -a test x"$BZIP2_CMD" != x""; then
$BZIP2_CMD -z -c "${srcdir}/logfile_syslog.1" > logfile_syslog.1.bz2 $BZIP2_CMD -z -c "${srcdir}/logfile_syslog.1" > logfile_syslog.1.bz2
touch -t 200711030923 logfile_syslog.1.bz2 touch -t 200711030923 logfile_syslog.1.bz2