diff options
author | Petr Rockai <prockai@redhat.com> | 2014-10-01 18:58:06 +0200 |
---|---|---|
committer | Petr Rockai <prockai@redhat.com> | 2014-10-01 18:58:06 +0200 |
commit | 6db44687d24eed61a58731e6595c6b392c5a8154 (patch) | |
tree | a67c09106d6f472731ee46d85dde486e9006da14 | |
parent | c6df5570930f3d4b1c1b66661bfbba478ffd28fd (diff) | |
parent | 6929b5f488363d32ff44b0facf8c5499aaa34adb (diff) | |
download | lvm2-dev-mornfall-dctmerge.tar.gz |
Merge branch 'dev-mornfall-test' into dev-mornfall-dctmerge.dev-mornfall-dctmerge
41 files changed, 2235 insertions, 505 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 6f752f28b..d60e2f841 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.13.4 -*- Autoconf -*- +# generated automatically by aclocal 1.12.6 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2012 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -11,9 +11,7 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. # @@ -40,12 +38,8 @@ m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) -m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) -m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) -AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) -AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) -AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) - +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi @@ -58,6 +52,7 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi + fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -66,20 +61,21 @@ fi[]dnl # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # -# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -# only at the first occurence in configure.ac, so if the first place -# it's called might be skipped (such as if it is within an "if", you -# have to call PKG_CHECK_EXISTS manually +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then - m4_default([$2], [:]) + m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) + # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], @@ -87,8 +83,7 @@ m4_define([_PKG_CONFIG], pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], - [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes ], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried @@ -133,17 +128,16 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - m4_default([$4], [AC_MSG_ERROR( + ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS @@ -151,80 +145,26 @@ $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. -_PKG_TEXT])[]dnl - ]) +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( + ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT -To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl - ]) +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], + [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) - $3 + ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES - -# PKG_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable pkgconfigdir as the location where a module -# should install pkg-config .pc files. By default the directory is -# $libdir/pkgconfig, but the default can be changed by passing -# DIRECTORY. The user can override through the --with-pkgconfigdir -# parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_INSTALLDIR - - -# PKG_NOARCH_INSTALLDIR(DIRECTORY) -# ------------------------- -# Substitutes the variable noarch_pkgconfigdir as the location where a -# module should install arch-independent pkg-config .pc files. By -# default the directory is $datadir/pkgconfig, but the default can be -# changed by passing DIRECTORY. The user can override through the -# --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -]) dnl PKG_NOARCH_INSTALLDIR - - -# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ------------------------------------------- -# Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])# PKG_CHECK_VAR - m4_include([acinclude.m4]) @@ -736,6 +736,7 @@ UDEV_CFLAGS BLKID_LIBS BLKID_CFLAGS VALGRIND_POOL +HAVE_VALGRIND VALGRIND_LIBS VALGRIND_CFLAGS CUNIT_LIBS @@ -765,8 +766,6 @@ CMAN_LIBS CMAN_CFLAGS PKGCONFIGINIT_LIBS PKGCONFIGINIT_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH PKG_CONFIG CACHE_RESTORE_CMD CACHE_REPAIR_CMD @@ -793,6 +792,9 @@ INSTALL_PROGRAM EGREP GREP CPP +ac_ct_CXX +CXXFLAGS +CXX OBJEXT EXEEXT ac_ct_CC @@ -948,10 +950,11 @@ CFLAGS LDFLAGS LIBS CPPFLAGS +CXX +CXXFLAGS +CCC CPP PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR PKGCONFIGINIT_CFLAGS PKGCONFIGINIT_LIBS CMAN_CFLAGS @@ -1740,12 +1743,10 @@ Some influential environment variables: LIBS libraries to pass to the linker, e.g. -l<library> CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> + CXX C++ compiler command + CXXFLAGS C++ compiler flags CPP C preprocessor PKG_CONFIG path to pkg-config utility - PKG_CONFIG_PATH - directories to add to pkg-config's search path - PKG_CONFIG_LIBDIR - path overriding pkg-config's built-in search path PKGCONFIGINIT_CFLAGS C compiler flags for PKGCONFIGINIT, overriding pkg-config PKGCONFIGINIT_LIBS @@ -1905,6 +1906,44 @@ fi } # ac_fn_c_try_compile +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. @@ -3896,6 +3935,263 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +$as_echo "$CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CXX+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +$as_echo "$ac_ct_CXX" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX="g++" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi +fi +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 +$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } +if ${ac_cv_cxx_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +$as_echo_n "checking whether $CXX accepts -g... " >&6; } +if ${ac_cv_prog_cxx_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +else + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + +else + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +$as_echo "$ac_cv_prog_cxx_g" >&6; } +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + ac_ext=c @@ -8387,11 +8683,6 @@ pkg_config_init() { if test "$PKGCONFIG_INIT" != 1; then - - - - - if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. @@ -8504,6 +8795,7 @@ $as_echo "yes" >&6; } $as_echo "no" >&6; } PKG_CONFIG="" fi + fi pkg_failed=no @@ -8520,7 +8812,6 @@ if test -n "$PKGCONFIGINIT_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PKGCONFIGINIT_CFLAGS=`$PKG_CONFIG --cflags "pkgconfiginit" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8537,7 +8828,6 @@ if test -n "$PKGCONFIGINIT_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_PKGCONFIGINIT_LIBS=`$PKG_CONFIG --libs "pkgconfiginit" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8548,8 +8838,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8557,18 +8845,18 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkgconfiginit" 2>&1` + PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "pkgconfiginit" 2>&1` else - PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkgconfiginit" 2>&1` + PKGCONFIGINIT_PKG_ERRORS=`$PKG_CONFIG --print-errors "pkgconfiginit" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PKGCONFIGINIT_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: pkg-config initialized" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: pkg-config initialized" >&5 $as_echo "pkg-config initialized" >&6; } elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: pkg-config initialized" >&5 $as_echo "pkg-config initialized" >&6; } else @@ -8576,7 +8864,7 @@ else PKGCONFIGINIT_LIBS=$pkg_cv_PKGCONFIGINIT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - + : fi PKGCONFIG_INIT=1 fi @@ -8759,7 +9047,6 @@ if test -n "$CMAN_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CMAN_CFLAGS=`$PKG_CONFIG --cflags "libcman" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8776,7 +9063,6 @@ if test -n "$CMAN_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CMAN_LIBS=`$PKG_CONFIG --libs "libcman" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8787,8 +9073,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8796,14 +9080,16 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CMAN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcman" 2>&1` + CMAN_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcman" 2>&1` else - CMAN_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcman" 2>&1` + CMAN_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcman" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CMAN_PKG_ERRORS" >&5 - NOTFOUND=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + NOTFOUND=0 for ac_header in libcman.h do : ac_fn_c_check_header_mongrel "$LINENO" "libcman.h" "ac_cv_header_libcman_h" "$ac_includes_default" @@ -8826,8 +9112,6 @@ $as_echo "no pkg for libcman, using -lcman" >&6; } HAVE_CMAN=yes fi elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } NOTFOUND=0 for ac_header in libcman.h do : @@ -8877,7 +9161,6 @@ if test -n "$COROSYNC_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_COROSYNC_CFLAGS=`$PKG_CONFIG --cflags "corosync" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8894,7 +9177,6 @@ if test -n "$COROSYNC_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_COROSYNC_LIBS=`$PKG_CONFIG --libs "corosync" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8905,8 +9187,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8914,17 +9194,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - COROSYNC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "corosync" 2>&1` + COROSYNC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "corosync" 2>&1` else - COROSYNC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "corosync" 2>&1` + COROSYNC_PKG_ERRORS=`$PKG_CONFIG --print-errors "corosync" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$COROSYNC_PKG_ERRORS" >&5 - $bailout -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then $bailout else COROSYNC_CFLAGS=$pkg_cv_COROSYNC_CFLAGS @@ -8953,7 +9233,6 @@ if test -n "$QUORUM_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_QUORUM_CFLAGS=`$PKG_CONFIG --cflags "libquorum" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8970,7 +9249,6 @@ if test -n "$QUORUM_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_QUORUM_LIBS=`$PKG_CONFIG --libs "libquorum" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -8981,8 +9259,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -8990,17 +9266,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - QUORUM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libquorum" 2>&1` + QUORUM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libquorum" 2>&1` else - QUORUM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libquorum" 2>&1` + QUORUM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libquorum" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$QUORUM_PKG_ERRORS" >&5 - $bailout -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then $bailout else QUORUM_CFLAGS=$pkg_cv_QUORUM_CFLAGS @@ -9029,7 +9305,6 @@ if test -n "$SALCK_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SALCK_CFLAGS=`$PKG_CONFIG --cflags "libSaLck" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9046,7 +9321,6 @@ if test -n "$SALCK_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SALCK_LIBS=`$PKG_CONFIG --libs "libSaLck" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9057,8 +9331,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9066,17 +9338,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SALCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libSaLck" 2>&1` + SALCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libSaLck" 2>&1` else - SALCK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libSaLck" 2>&1` + SALCK_PKG_ERRORS=`$PKG_CONFIG --print-errors "libSaLck" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SALCK_PKG_ERRORS" >&5 - $bailout -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then $bailout else SALCK_CFLAGS=$pkg_cv_SALCK_CFLAGS @@ -9106,7 +9378,6 @@ if test -n "$CONFDB_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CONFDB_CFLAGS=`$PKG_CONFIG --cflags "libconfdb" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9123,7 +9394,6 @@ if test -n "$CONFDB_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CONFDB_LIBS=`$PKG_CONFIG --libs "libconfdb" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9134,8 +9404,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9143,17 +9411,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CONFDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libconfdb" 2>&1` + CONFDB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libconfdb" 2>&1` else - CONFDB_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libconfdb" 2>&1` + CONFDB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libconfdb" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CONFDB_PKG_ERRORS" >&5 - HAVE_CONFDB=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + HAVE_CONFDB=no +elif test $pkg_failed = untried; then HAVE_CONFDB=no else CONFDB_CFLAGS=$pkg_cv_CONFDB_CFLAGS @@ -9204,7 +9472,6 @@ if test -n "$CMAP_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CMAP_CFLAGS=`$PKG_CONFIG --cflags "libcmap" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9221,7 +9488,6 @@ if test -n "$CMAP_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CMAP_LIBS=`$PKG_CONFIG --libs "libcmap" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9232,8 +9498,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9241,17 +9505,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CMAP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcmap" 2>&1` + CMAP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcmap" 2>&1` else - CMAP_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcmap" 2>&1` + CMAP_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcmap" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CMAP_PKG_ERRORS" >&5 - HAVE_CMAP=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + HAVE_CMAP=no +elif test $pkg_failed = untried; then HAVE_CMAP=no else CMAP_CFLAGS=$pkg_cv_CMAP_CFLAGS @@ -9306,7 +9570,6 @@ if test -n "$CPG_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CPG_CFLAGS=`$PKG_CONFIG --cflags "libcpg" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9323,7 +9586,6 @@ if test -n "$CPG_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CPG_LIBS=`$PKG_CONFIG --libs "libcpg" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9334,8 +9596,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9343,17 +9603,17 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcpg" 2>&1` + CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcpg" 2>&1` else - CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcpg" 2>&1` + CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcpg" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CPG_PKG_ERRORS" >&5 - $bailout -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } + $bailout +elif test $pkg_failed = untried; then $bailout else CPG_CFLAGS=$pkg_cv_CPG_CFLAGS @@ -9380,7 +9640,6 @@ if test -n "$DLM_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DLM_CFLAGS=`$PKG_CONFIG --cflags "libdlm" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9397,7 +9656,6 @@ if test -n "$DLM_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DLM_LIBS=`$PKG_CONFIG --libs "libdlm" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9408,8 +9666,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9417,14 +9673,16 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - DLM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdlm" 2>&1` + DLM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libdlm" 2>&1` else - DLM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdlm" 2>&1` + DLM_PKG_ERRORS=`$PKG_CONFIG --print-errors "libdlm" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$DLM_PKG_ERRORS" >&5 - NOTFOUND=0 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + NOTFOUND=0 for ac_header in libdlm.h do : ac_fn_c_check_header_mongrel "$LINENO" "libdlm.h" "ac_cv_header_libdlm_h" "$ac_includes_default" @@ -9447,8 +9705,6 @@ $as_echo "no pkg for libdlm, using -ldlm" >&6; } HAVE_DLM=yes fi elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } NOTFOUND=0 for ac_header in libdlm.h do : @@ -9591,7 +9847,6 @@ if test -n "$SACKPT_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SACKPT_CFLAGS=`$PKG_CONFIG --cflags "libSaCkpt" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9608,7 +9863,6 @@ if test -n "$SACKPT_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_SACKPT_LIBS=`$PKG_CONFIG --libs "libSaCkpt" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9619,8 +9873,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9628,21 +9880,21 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - SACKPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libSaCkpt" 2>&1` + SACKPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libSaCkpt" 2>&1` else - SACKPT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libSaCkpt" 2>&1` + SACKPT_PKG_ERRORS=`$PKG_CONFIG --print-errors "libSaCkpt" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$SACKPT_PKG_ERRORS" >&5 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no libSaCkpt, compiling without it" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no libSaCkpt, compiling without it" >&5 $as_echo "no libSaCkpt, compiling without it" >&6; } $as_echo "#define CMIRROR_HAS_CHECKPOINT 0" >>confdefs.h elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: no libSaCkpt, compiling without it" >&5 $as_echo "no libSaCkpt, compiling without it" >&6; } @@ -9672,7 +9924,6 @@ if test -n "$CPG_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CPG_CFLAGS=`$PKG_CONFIG --cflags "libcpg" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9689,7 +9940,6 @@ if test -n "$CPG_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CPG_LIBS=`$PKG_CONFIG --libs "libcpg" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -9700,8 +9950,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -9709,9 +9957,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcpg" 2>&1` + CPG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libcpg" 2>&1` else - CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcpg" 2>&1` + CPG_PKG_ERRORS=`$PKG_CONFIG --print-errors "libcpg" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CPG_PKG_ERRORS" >&5 @@ -9725,10 +9973,9 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables CPG_CFLAGS and CPG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 +See the pkg-config man page for more details. +" "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it @@ -9746,7 +9993,7 @@ else CPG_LIBS=$pkg_cv_CPG_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - + : fi fi fi @@ -10070,8 +10317,11 @@ else GENHTML="$ac_cv_path_GENHTML" fi - test -z "$LCOV" -o -z "$GENHTML" && as_fn_error $? "lcov and genhtml are required for profiling" "$LINENO" 5 - if test -n "$ac_tool_prefix"; then + if test -z "$LCOV" -o -z "$GENHTML"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: lcov and genhtml are required for profiling" >&5 +$as_echo "$as_me: WARNING: lcov and genhtml are required for profiling" >&2;} + else + if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}genpng", so it can be a program name with args. set dummy ${ac_tool_prefix}genpng; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -10169,19 +10419,20 @@ else GENPNG="$ac_cv_path_GENPNG" fi - if test -n "$GENPNG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $GENPNG has all required modules" >&5 + if test -n "$GENPNG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $GENPNG has all required modules" >&5 $as_echo_n "checking whether $GENPNG has all required modules... " >&6; } - if "$GENPNG" --help > /dev/null 2>&1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 + if "$GENPNG" --help > /dev/null 2>&1 ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } - GENHTML="$GENHTML --frames" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 + GENHTML="$GENHTML --frames" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not supported" >&5 $as_echo "not supported" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GD.pm perl module is not installed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GD.pm perl module is not installed" >&5 $as_echo "$as_me: WARNING: GD.pm perl module is not installed" >&2;} - GENPNG= + GENPNG= + fi fi fi fi @@ -10216,7 +10467,6 @@ if test -n "$CUNIT_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CUNIT_CFLAGS=`$PKG_CONFIG --cflags "cunit >= 2.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10233,7 +10483,6 @@ if test -n "$CUNIT_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CUNIT_LIBS=`$PKG_CONFIG --libs "cunit >= 2.0" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10244,8 +10493,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -10253,9 +10500,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - CUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cunit >= 2.0" 2>&1` + CUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "cunit >= 2.0" 2>&1` else - CUNIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cunit >= 2.0" 2>&1` + CUNIT_PKG_ERRORS=`$PKG_CONFIG --print-errors "cunit >= 2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CUNIT_PKG_ERRORS" >&5 @@ -10269,10 +10516,9 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables CUNIT_CFLAGS and CUNIT_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 +See the pkg-config man page for more details. +" "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it @@ -10290,7 +10536,7 @@ else CUNIT_LIBS=$pkg_cv_CUNIT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - + : fi fi @@ -10307,8 +10553,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND_POOL" >&5 $as_echo "$VALGRIND_POOL" >&6; } -if test "$VALGRIND_POOL" = yes; then - pkg_config_init +pkg_config_init pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for VALGRIND" >&5 @@ -10324,7 +10569,6 @@ if test -n "$VALGRIND_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_VALGRIND_CFLAGS=`$PKG_CONFIG --cflags "valgrind" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10341,7 +10585,6 @@ if test -n "$VALGRIND_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_VALGRIND_LIBS=`$PKG_CONFIG --libs "valgrind" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10352,8 +10595,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -10361,28 +10602,37 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - VALGRIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "valgrind" 2>&1` + VALGRIND_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "valgrind" 2>&1` else - VALGRIND_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "valgrind" 2>&1` + VALGRIND_PKG_ERRORS=`$PKG_CONFIG --print-errors "valgrind" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$VALGRIND_PKG_ERRORS" >&5 - as_fn_error $? "bailing out" "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "bailing out" "$LINENO" 5 + if test x$VALGRIND_POOL = xyes; then as_fn_error $? "bailing out" "$LINENO" 5; fi +elif test $pkg_failed = untried; then + if test x$VALGRIND_POOL = xyes; then as_fn_error $? "bailing out" "$LINENO" 5; fi else VALGRIND_CFLAGS=$pkg_cv_VALGRIND_CFLAGS VALGRIND_LIBS=$pkg_cv_VALGRIND_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + HAVE_VALGRIND=yes +fi + + +if test x$HAVE_VALGRIND = xyes; then + +$as_echo "#define HAVE_VALGRIND 1" >>confdefs.h + fi -$as_echo "#define VALGRIND_POOL 1" >>confdefs.h +if test x$VALGRIND_POOL = xyes; then +$as_echo "#define VALGRIND_POOL 1" >>confdefs.h fi @@ -10467,7 +10717,6 @@ if test -n "$BLKID_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BLKID_CFLAGS=`$PKG_CONFIG --cflags "blkid >= 2.24" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10484,7 +10733,6 @@ if test -n "$BLKID_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BLKID_LIBS=`$PKG_CONFIG --libs "blkid >= 2.24" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10495,8 +10743,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -10504,21 +10750,21 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - BLKID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "blkid >= 2.24" 2>&1` + BLKID_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "blkid >= 2.24" 2>&1` else - BLKID_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "blkid >= 2.24" 2>&1` + BLKID_PKG_ERRORS=`$PKG_CONFIG --print-errors "blkid >= 2.24" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BLKID_PKG_ERRORS" >&5 - if test "$BLKID_WIPING" = maybe; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + if test "$BLKID_WIPING" = maybe; then BLKID_WIPING=no else as_fn_error $? "bailing out... blkid library >= 2.24 is required" "$LINENO" 5 fi elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if test "$BLKID_WIPING" = maybe; then BLKID_WIPING=no else @@ -10582,7 +10828,6 @@ if test -n "$UDEV_CFLAGS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev >= 143" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10599,7 +10844,6 @@ if test -n "$UDEV_LIBS"; then $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev >= 143" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi @@ -10610,8 +10854,6 @@ fi if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes @@ -10619,9 +10861,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libudev >= 143" 2>&1` + UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libudev >= 143" 2>&1` else - UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libudev >= 143" 2>&1` + UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors "libudev >= 143" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$UDEV_PKG_ERRORS" >&5 @@ -10635,10 +10877,9 @@ installed software in a non-standard prefix. Alternatively, you may set the environment variables UDEV_CFLAGS and UDEV_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 +See the pkg-config man page for more details. +" "$LINENO" 5 elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it diff --git a/configure.in b/configure.in index 3956ff073..3e8e6b0fc 100644 --- a/configure.in +++ b/configure.in @@ -69,6 +69,7 @@ dnl -- Checks for programs. AC_PROG_SED AC_PROG_AWK AC_PROG_CC +AC_PROG_CXX dnl probably no longer needed in 2008, but... AC_PROG_GCC_TRADITIONAL @@ -965,17 +966,20 @@ if test "$PROFILING" = yes; then COPTIMISE_FLAG="$COPTIMISE_FLAG -fprofile-arcs -ftest-coverage" AC_PATH_TOOL(LCOV, lcov) AC_PATH_TOOL(GENHTML, genhtml) - test -z "$LCOV" -o -z "$GENHTML" && AC_MSG_ERROR([lcov and genhtml are required for profiling]) - AC_PATH_TOOL(GENPNG, genpng) - if test -n "$GENPNG"; then - AC_MSG_CHECKING([whether $GENPNG has all required modules]) - if "$GENPNG" --help > /dev/null 2>&1 ; then - AC_MSG_RESULT(ok) - GENHTML="$GENHTML --frames" - else - AC_MSG_RESULT([not supported]) - AC_MSG_WARN([GD.pm perl module is not installed]) - GENPNG= + if test -z "$LCOV" -o -z "$GENHTML"; then + AC_MSG_WARN([lcov and genhtml are required for profiling]) + else + AC_PATH_TOOL(GENPNG, genpng) + if test -n "$GENPNG"; then + AC_MSG_CHECKING([whether $GENPNG has all required modules]) + if "$GENPNG" --help > /dev/null 2>&1 ; then + AC_MSG_RESULT(ok) + GENHTML="$GENHTML --frames" + else + AC_MSG_RESULT([not supported]) + AC_MSG_WARN([GD.pm perl module is not installed]) + GENPNG= + fi fi fi fi @@ -1003,12 +1007,18 @@ AC_ARG_ENABLE(valgrind_pool, VALGRIND_POOL=$enableval, VALGRIND_POOL=no) AC_MSG_RESULT($VALGRIND_POOL) -if test "$VALGRIND_POOL" = yes; then - pkg_config_init - PKG_CHECK_MODULES(VALGRIND, valgrind, [], [AC_MSG_ERROR(bailing out)]) +pkg_config_init +PKG_CHECK_MODULES(VALGRIND, valgrind, [HAVE_VALGRIND=yes], [if test x$VALGRIND_POOL = xyes; then AC_MSG_ERROR(bailing out); fi]) +AC_SUBST(VALGRIND_CFLAGS) + +if test x$HAVE_VALGRIND = xyes; then + AC_DEFINE([HAVE_VALGRIND], 1, [valgrind.h found]) + AC_SUBST(HAVE_VALGRIND) +fi + +if test x$VALGRIND_POOL = xyes; then AC_DEFINE([VALGRIND_POOL], 1, [Enable a valgrind aware build of pool]) AC_SUBST(VALGRIND_POOL) - AC_SUBST(VALGRIND_CFLAGS) fi ################################################################################ diff --git a/lib/Makefile.in b/lib/Makefile.in index bad5d8cd3..2d8b9b219 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -220,7 +220,7 @@ CFLOW_LIST_TARGET = $(LIB_NAME).cflow include $(top_builddir)/make.tmpl -CFLAGS += $(BLKID_CFLAGS) $(UDEV_CFLAGS) +CFLAGS += $(BLKID_CFLAGS) $(UDEV_CFLAGS) $(VALGRIND_CFLAGS) $(SUBDIRS): $(LIB_STATIC) diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in index f137f1471..d4968a602 100644 --- a/lib/misc/configure.h.in +++ b/lib/misc/configure.h.in @@ -450,6 +450,9 @@ /* Define to 1 if you have the <utmpx.h> header file. */ #undef HAVE_UTMPX_H +/* valgrind.h found */ +#undef HAVE_VALGRIND + /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index 547fb46a7..15cdfc6af 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -25,6 +25,11 @@ #include <sys/mman.h> #include <sys/time.h> #include <sys/resource.h> +#include <malloc.h> + +#ifdef HAVE_VALGRIND +#include <valgrind.h> +#endif #ifndef DEVMAPPER_SUPPORT @@ -132,10 +137,16 @@ static void _touch_memory(void *mem, size_t size) static void _allocate_memory(void) { -#ifndef VALGRIND_POOL - /* With Valgrind don't waste time in with preallocating memory */ void *stack_mem, *temp_malloc_mem; struct rlimit limit; + int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks; + char *areas[max_areas]; + +#ifdef HAVE_VALGRIND + /* With Valgrind don't waste time in with preallocating memory */ + if (RUNNING_ON_VALGRIND) + return; +#endif /* Check if we could preallocate requested stack */ if ((getrlimit (RLIMIT_STACK, &limit) == 0) && @@ -144,14 +155,40 @@ static void _allocate_memory(void) _touch_memory(stack_mem, _size_stack); /* FIXME else warn user setting got ignored */ - if ((temp_malloc_mem = malloc(_size_malloc_tmp))) - _touch_memory(temp_malloc_mem, _size_malloc_tmp); + while (missing > 0) { + struct mallinfo inf = mallinfo(); + hblks = inf.hblks; + + if ((areas[area] = malloc(_size_malloc_tmp))) + _touch_memory(areas[area], _size_malloc_tmp); + + inf = mallinfo(); + + if (hblks < inf.hblks) { + /* malloc cheated and used mmap, even though we told it + not to; we try with twice as many areas, each half + the size, to circumvent the faulty logic in glibc */ + free(areas[area]); + _size_malloc_tmp /= 2; + } else { + ++ area; + missing -= _size_malloc_tmp; + } + + if (area == max_areas && missing > 0) { + /* Too bad. Warn the user and proceed, as things are + * most likely going to work out anyway. */ + log_warn("WARNING: Failed to reserve memory, %d bytes missing.", missing); + break; + } + } if ((_malloc_mem = malloc(_size_malloc))) _touch_memory(_malloc_mem, _size_malloc); - free(temp_malloc_mem); -#endif + /* free up the reserves so subsequent malloc's can use that memory */ + for (i = 0; i < area; ++i) + free(areas[i]); } static void _release_memory(void) @@ -215,12 +252,13 @@ static int _maps_line(const struct dm_config_node *cn, lvmlock_t lock, } } -#ifdef VALGRIND_POOL +#ifdef HAVE_VALGRIND /* * Valgrind is continually eating memory while executing code * so we need to deactivate check of locked memory size */ - sz -= sz; /* = 0, but avoids getting warning about dead assigment */ + if (RUNNING_ON_VALGRIND) + sz -= sz; /* = 0, but avoids getting warning about dead assigment */ #endif *mstats += sz; diff --git a/libdaemon/client/daemon-io.c b/libdaemon/client/daemon-io.c index 6d81ed86e..d19acd641 100644 --- a/libdaemon/client/daemon-io.c +++ b/libdaemon/client/daemon-io.c @@ -49,9 +49,18 @@ int buffer_read(int fd, struct buffer *buffer) { } else if (result == 0) { errno = ECONNRESET; return 0; /* we should never encounter EOF here */ - } else if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) + } else if (result < 0 && ( errno == EAGAIN || errno == EWOULDBLOCK || + errno == EINTR || errno == EIO)) { + struct timeval tval; + fd_set in; + tval.tv_sec = 1; + tval.tv_usec = 0; + FD_ZERO(&in); + FD_SET(fd, &in); + /* ignore the result, this is just a glorified sleep */ + select(FD_SETSIZE, &in, NULL, NULL, NULL); + } else if (result < 0) return 0; - /* TODO call select here if we encountered EAGAIN/EWOULDBLOCK/EINTR */ } return 1; @@ -60,8 +69,6 @@ int buffer_read(int fd, struct buffer *buffer) { /* * Write a buffer to a filedescriptor. Keep trying. Blocks (even on * SOCK_NONBLOCK) until all of the write went through. - * - * TODO use select on EWOULDBLOCK/EAGAIN/EINTR to avoid useless spinning */ int buffer_write(int fd, const struct buffer *buffer) { static const struct buffer _terminate = { .mem = (char *) "\n##\n", .used = 4 }; @@ -74,7 +81,17 @@ int buffer_write(int fd, const struct buffer *buffer) { result = write(fd, use->mem + written, use->used - written); if (result > 0) written += result; - else if (result < 0 && errno != EWOULDBLOCK && errno != EAGAIN && errno != EINTR) + else if (result < 0 && ( errno == EAGAIN || errno == EWOULDBLOCK || + errno == EINTR || errno == EIO)) { + struct timeval tval; + fd_set out; + tval.tv_sec = 1; + tval.tv_usec = 0; + FD_ZERO(&out); + FD_SET(fd, &out); + /* ignore the result, this is just a glorified sleep */ + select(FD_SETSIZE, NULL, &out, NULL, NULL); + } else if (result < 0) return 0; /* too bad */ } } diff --git a/libdm/Makefile.in b/libdm/Makefile.in index e50b174af..8e057c385 100644 --- a/libdm/Makefile.in +++ b/libdm/Makefile.in @@ -34,10 +34,7 @@ SOURCES =\ $(interface)/libdm-iface.c INCLUDES = -I$(srcdir)/$(interface) -I$(srcdir) -ifeq ("@VALGRIND_POOL@", "yes") -INCLUDES += @VALGRIND_CFLAGS@ -endif -CFLAGS += $(UDEV_CFLAGS) +CFLAGS += $(UDEV_CFLAGS) $(VALGRIND_CFLAGS) ifeq ("@STATIC_LINK@", "yes") LIB_STATIC = $(interface)/libdevmapper.a diff --git a/make.tmpl.in b/make.tmpl.in index 7efe46b9c..cfa065cfc 100644 --- a/make.tmpl.in +++ b/make.tmpl.in @@ -61,6 +61,7 @@ UDEV_CFLAGS = @UDEV_CFLAGS@ UDEV_LIBS = @UDEV_LIBS@ BLKID_CFLAGS = @BLKID_CFLAGS@ BLKID_LIBS = @BLKID_LIBS@ +VALGRIND_CFLAGS = @VALGRIND_CFLAGS@ TESTING = @TESTING@ # Setup directory variables @@ -73,10 +74,12 @@ bindir = $(DESTDIR)@bindir@ confdir = $(DESTDIR)@CONFDIR@/lvm includedir = $(DESTDIR)@includedir@ libdir = $(DESTDIR)@libdir@ +libexecdir = $(DESTDIR)@libexecdir@ usrlibdir = $(DESTDIR)@usrlibdir@ sbindir = $(DESTDIR)@sbindir@ usrsbindir = $(DESTDIR)@usrsbindir@ datarootdir = @datarootdir@ +datadir = $(DESTDIR)/@datadir@ infodir = $(DESTDIR)@infodir@ mandir = $(DESTDIR)@mandir@ localedir = $(DESTDIR)@LOCALEDIR@ @@ -106,6 +109,7 @@ DEFAULT_MANGLING = @MANGLING@ # Setup vpath search paths for some suffixes vpath %.c $(srcdir) +vpath %.cpp $(srcdir) vpath %.in $(srcdir) vpath %.po $(srcdir) vpath %.exported_symbols $(srcdir) @@ -136,7 +140,7 @@ INSTALL_ROOT_DIR = $(INSTALL) -m 700 -d INSTALL_ROOT_DATA = $(INSTALL) -m 600 INSTALL_SCRIPT = $(INSTALL) -p $(M_INSTALL_PROGRAM) -.SUFFIXES: .c .d .o .so .a .po .pot .mo .dylib +.SUFFIXES: .c .cpp .d .o .so .a .po .pot .mo .dylib WFLAGS += -Wall -Wundef -Wshadow -Wcast-align -Wwrite-strings \ -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \ @@ -239,7 +243,7 @@ INC_LNS = $(top_builddir)/include/.symlinks_created DEPS = $(top_builddir)/make.tmpl $(top_srcdir)/VERSION \ $(top_builddir)/Makefile $(INC_LNS) -OBJECTS = $(SOURCES:%.c=%.o) +OBJECTS = $(SOURCES:%.c=%.o) $(CXXSOURCES:%.cpp=%.o) POTFILES = $(SOURCES:%.c=%.pot) .PHONY: all pofile distclean clean cleandir cflow device-mapper @@ -366,6 +370,9 @@ $(TARGETS): $(OBJECTS) %.o: %.c $(CC) -c $(INCLUDES) $(DEFS) $(WFLAGS) $(CFLAGS) $(CFLAGS_$@) $< -o $@ +%.o: %.cpp + $(CXX) -c $(INCLUDES) $(DEFS) $(WFLAGS) $(CXXFLAGS) $(CXXFLAGS_$@) $< -o $@ + %.pot: %.c Makefile $(CC) -E $(INCLUDES) -include $(top_builddir)/include/pogen.h \ $(DEFS) $(WFLAGS) $(CFLAGS) $< > $@ @@ -454,7 +461,7 @@ distclean: cleandir $(SUBDIRS.distclean) ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov \ help check check_local check_cluster check_lvmetad)) ifdef SOURCES - -include $(SOURCES:.c=.d) + -include $(SOURCES:.c=.d) $(CXXSOURCES:.cpp=.d) endif ifdef SOURCES2 -include $(SOURCES2:.c=.d) diff --git a/nix/default.nix b/nix/default.nix index 228047f3d..f021146ff 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,48 +1,173 @@ +# -*- mode: nix; indent-tabs-mode: nil -*- { nixpkgs ? <nixpkgs>, lvm2Src, release ? false, rawhide32 ? "" , rawhide64 ? "" , + fc20_32_updates ? "", fc20_64_updates ? "", fc19_32_updates ? "", fc19_64_updates ? "", fc18_32_updates ? "", fc18_64_updates ? "", - lvm2Nix ? lvm2Src, T ? "" }: + T ? "", ENV ? "", timeout ? 60 }: let pkgs = import nixpkgs {}; - mkVM = { VM, extras ? [], diskFun, kernel }: - VM rec { - inherit kernel; - name = "lvm2"; - fullName = "LVM2"; - src = jobs.tarball; + lib = pkgs.lib; + + mkTest = args: pkgs.stdenv.mkDerivation rec { + name = "lvm2-test-${(args.diskFun {}).name}"; + + builder = pkgs.writeScript "lvm2-collect-results" '' + #!${pkgs.bash}/bin/bash + . $stdenv/setup + mkdir -p $out/test-results + for i in ${lib.concatStringsSep " " buildInputs}; do + cat $i/test-results/list >> $out/test-results/list + cp $i/test-results'/'*.txt $out/test-results/ || true + done + mkdir -p $out/nix-support + grep '\<failed\>' $out/test-results/list && touch $out/nix-support/failed || true + ''; + + buildInputs = map (x: runTest (args // { flavour = x; })) + [ "ndev-vanilla" "ndev-lvmetad" "ndev-cluster" "udev-vanilla" "udev-lvmetad" "udev-cluster" ]; + }; + + runTest = { build, diskFun, extras ? [], kernel, vmtools, flavour, ... }: pkgs.stdenv.mkDerivation rec { diskImage = diskFun { extraPackages = extras; }; - memSize = 768; - - # fc16 lcov is broken and el6 has none... be creative - prepareImagePhase = '' - rpm -Uv ${pkgs.fetchurl { - url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i386/lcov-1.9-2.fc16.noarch.rpm"; - sha256 = "0ycdh5mb7p5ll76mqk0p6gpnjskvxxgh3a3bfr1crh94nvpwhp4z"; }} - dmesg -n 1 # avoid spilling dmesg into the main log, we capture it in harness + name = "lvm2-test-${diskImage.name}-${flavour}"; + + # this is the builder that runs in the guest + origBuilder = pkgs.writeScript "vm-test-guest" '' + #!/bin/bash + export PATH=/usr/bin:/bin:/usr/sbin:/sbin + + # we always run in a fresh image, so need to install everything again + ls ${build}/rpms/*/*.rpm | grep -v sysvinit | xargs rpm -Uv # */ + rpm -Uv ${pkgs.fetchurl { + url = "http://archives.fedoraproject.org/pub/archive/fedora/linux/updates/16/i386/lcov-1.9-2.fc16.noarch.rpm"; + sha256 = "0ycdh5mb7p5ll76mqk0p6gpnjskvxxgh3a3bfr1crh94nvpwhp4z"; }} + + mkdir -p /xchg/results + touch /xchg/booted + + dmsetup targets + + export LVM_TEST_BACKING_DEVICE=/dev/sdb + + watch= + if echo ${flavour} | grep -q udev; then + (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \ + find / -xdev -name \*udevd) >> /xchg/udevd.log 2>&1 & + watch="--watch /xchg/udevd.log" + fi + + export ${ENV} + lvm2-testsuite --batch --outdir /xchg/results --continue \ + --timeout ${toString timeout} --fatal-timeouts --heartbeat /xchg/heartbeat \ + --flavours ${flavour} $watch --kmsg ${if lib.eqStrings T "" then "" else "--only ${T}"} + + # TODO: coverage reports + # make lcov || true + # cp -R lcov_reports $out/coverage && \ + # echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products || \ + # true # not really fatal, although kinda disappointing ''; - postBuild = '' - mkdir -p $out/nix-support - cd `cat /tmp/build-location` - mv test/results/list test/results/list-rpm - ls /tmp/rpmout/RPMS/*/*.rpm | grep -v sysvinit | xargs rpm -Uvh # */ - (/usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || find / -xdev -name \*udevd) & - make check_system QUIET=1 T=${T} || touch $out/nix-support/failed - mv test/results/list test/results/list-system - cat test/results/list-* > test/results/list - cp -R test/results $out/test-results && \ - echo "report tests $out/test-results" >> $out/nix-support/hydra-build-products || \ - true - make lcov || true - cp -R lcov_reports $out/coverage && \ - echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products || \ - true # not really fatal, although kinda disappointing + buildInputs = [ pkgs.coreutils pkgs.bash pkgs.utillinux ]; + + # make a qcow copy of the main image + preVM = '' + diskImage=$(pwd)/disk-image.qcow2 + origImage=${diskImage} + if test -d "$origImage"; then origImage="$origImage/disk-image.qcow2"; fi + ${vmtools.qemu}/bin/qemu-img create -b "$origImage" -f qcow2 $diskImage + ''; + + builder = pkgs.writeScript "vm-test" '' + #!${pkgs.bash}/bin/bash + . $stdenv/setup + + export QEMU_OPTS="-drive file=/dev/shm/testdisk.img,if=ide -m 256M" + export QEMU_DRIVE_OPTS=",if=ide" + export KERNEL_OPTS="log_buf_len=131072 loglevel=1" + export mountDisk=1 + + mkdir -p $out/test-results $out/nix-support + touch $out/nix-support/failed + + monitor() { + set +e + counter=0 + rm -f j.current j.last t.current t.last + while true; do + if ! test -f pid; then + counter=0 + sleep 60 + continue + fi + + cat xchg/results/journal > j.current 2> /dev/null + cat xchg/heartbeat > hb.current 2> /dev/null + if diff j.current j.last >& /dev/null; then + counter=$(($counter + 1)); + else + counter=0 + fi + if test $counter -eq 10 || test $(cat hb.current | wc -c) -eq $(cat hb.last | wc -c); then + echo + echo "VM got stuck; heartbeat: $(cat hb.current | wc -c) $(cat hb.last | wc -c), counter = $counter." + echo "last journal entry: $(tail -n 1 j.current), previously $(tail -n 1 j.last)" + kill -- -$(cat pid) + fi + sleep 60 + mv j.current j.last >& /dev/null + mv hb.current hb.last >& /dev/null + done + } + + monitor & + + for i in `seq 1 20`; do # we allow up to 20 VM restarts + rm -f xchg/booted + ${vmtools.qemu}/bin/qemu-img create -f qcow2 /dev/shm/testdisk.img 4G + setsid bash -e ${vmtools.vmRunCommand (vmtools.qemuCommandLinux kernel)} & + pid=$! + + # give the VM some time to get up and running + slept=0 + while test $slept -le 180 && test ! -e xchg/booted; do + sleep 10 + slept=$(($slept + 10)) + done + echo $pid > pid # monitor go + wait $pid || true + rm -f pid # disarm the monitor process + + # if we have any new results, stash them + mv xchg/results'/'*.txt $out/test-results/ || true + + if test -n "$(cat xchg/in-vm-exit)"; then # the VM is done + test 0 -eq "$(cat xchg/in-vm-exit)" && rm -f $out/nix-support/failed + break + fi + + sleep 10 # wait for the VM to clean up before starting up a new one + done + + cat xchg/results/list > $out/test-results/list || true ''; + }; + + mkBuild = { VM, extras ? [], diskFun, ... }: + VM rec { + name = "lvm2-build-${diskImage.name}"; + fullName = "lvm2-build-${diskImage.name}"; + + src = jobs.tarball; + diskImage = diskFun { extraPackages = extras; }; + memSize = 512; + checkPhase = ":"; postInstall = '' - for i in $out/rpms/*/*.rpm; do + mkdir -p $out/nix-support + for i in $out/rpms/*/*.rpm; do # */ if echo $i | grep -vq "\.src\.rpm$"; then echo "file rpm $i" >> $out/nix-support/hydra-build-products else @@ -53,16 +178,17 @@ let }; rootmods = [ "virtio_pci" "virtio_blk" "virtio_balloon" "ext4" "unix" - "cifs" "virtio_net" "unix" "hmac" "md4" "ecb" "des_generic" "sha256" ]; + "cifs" "virtio_net" "unix" "hmac" "md4" "ecb" "des_generic" "sha256" + "ata_piix" "sd_mod" ]; centos_url = ver: arch: if ver == "6.5" then "http://ftp.fi.muni.cz/pub/linux/centos/${ver}/os/${arch}/" else "http://vault.centos.org/${ver}/os/${arch}/"; - fedora_url = ver: arch: if pkgs.lib.eqStrings ver "rawhide" || pkgs.lib.eqStrings ver "19" + fedora_url = ver: arch: if lib.eqStrings ver "rawhide" || lib.eqStrings ver "19" then "ftp://ftp.fi.muni.cz/pub/linux/fedora/linux/development/${ver}/${arch}/os/" else "mirror://fedora/linux/releases/${ver}/Everything/${arch}/os/"; fedora_update_url = ver: arch: "mirror://fedora/linux/updates/${ver}/${arch}"; - extra_distros = with pkgs.lib; let + extra_distros = with lib; let centos = { version, sha, arch }: { name = "centos-${version}-${arch}"; fullName = "CentOS ${version} (${arch})"; @@ -105,6 +231,8 @@ let in { rawhidex86_64 = rawhide "rawhide" "x86_64" rawhide64; rawhidei386 = rawhide "rawhide" "i386" rawhide32; + fedora20ux86_64 = update "20" "x86_64" fc20_64_updates pkgs.vmTools.rpmDistros.fedora20x86_64; + fedora20ui386 = update "20" "i386" fc20_32_updates pkgs.vmTools.rpmDistros.fedora20i386; fedora19ux86_64 = update "19" "x86_64" fc19_64_updates pkgs.vmTools.rpmDistros.fedora19x86_64; fedora19ui386 = update "19" "i386" fc19_32_updates pkgs.vmTools.rpmDistros.fedora19i386; fedora18ux86_64 = update "18" "x86_64" fc18_64_updates pkgs.vmTools.rpmDistros.fedora18x86_64; @@ -141,10 +269,11 @@ let }; }; - vm = pkgs: xmods: with pkgs.lib; rec { + vm = { pkgs, xmods, dmmods ? false }: with lib; rec { tools = import "${nixpkgs}/pkgs/build-support/vm/default.nix" { inherit pkgs; rootModules = rootmods ++ xmods ++ - [ "loop" "dm_mod" "dm_snapshot" "dm_mirror" "dm_zero" "dm_raid" "dm_thin_pool" ]; }; + (if dmmods then [ "loop" "dm_mod" "dm_snapshot" "dm_mirror" "dm_zero" "dm_raid" "dm_thin_pool" ] + else []); }; release = import "${nixpkgs}/pkgs/build-support/release/default.nix" { pkgs = pkgs // { vmTools = tools; }; }; imgs = tools.diskImageFuns // @@ -156,6 +285,7 @@ let extra_rpms = rec { common = [ "libselinux-devel" "libsepol-devel" "ncurses-devel" "readline-devel" "corosynclib-devel" + "valgrind" "valgrind-devel" "strace" "redhat-rpm-config" # needed for rpmbuild of lvm "which" "e2fsprogs" # needed for fsadm "perl-GD" # for lcov @@ -166,25 +296,67 @@ let fedora16 = [ "clusterlib-devel" "openaislib-devel" "cman" "systemd-devel" "libudev-devel" ]; fedora17 = [ "dlm-devel" "corosynclib-devel" "device-mapper-persistent-data" "dlm" "systemd-devel" "perl-Digest-MD5" "libudev-devel" ]; + fedora18 = [ "dlm-devel" "corosynclib-devel" "device-mapper-persistent-data" "dlm" "systemd-devel" "perl-Digest-MD5" ]; fedora18u = fedora18; + fedora19 = [ "dlm-devel" "dlm" "corosynclib-devel" "perl-Digest-MD5" "systemd-devel" "procps-ng" ]; fedora19u = fedora19; - rawhide = fedora19; + + fedora20 = fedora19; + fedora20u = fedora20; + + rawhide = fedora20; }; - mkRPM = { arch, image }: with pkgs.lib; - let use = vm (if eqStrings arch "i386" then pkgs.pkgsi686Linux else pkgs) - (if image == "centos64" || image == "centos65" then [] else [ "9p" "9pnet_virtio" ]); - in mkVM { + wrapper = fun: { arch, image, build ? {}, istest ? false }: with lib; + let use = vm { pkgs = if eqStrings arch "i386" then pkgs.pkgsi686Linux else pkgs; + xmods = if istest && (image == "centos64" || image == "centos65") + then [] else [ "9p" "9pnet_virtio" ]; + dmmods = istest; }; + in fun { + inherit build istest; VM = use.rpmbuild; diskFun = builtins.getAttr "${image}${arch}" use.imgs; extras = extra_rpms.common ++ builtins.getAttr image extra_rpms; + vmtools = use.tools; kernel = use.tools.makeKernelFromRPMDist (builtins.getAttr "${image}${arch}" use.rpmdistros); }; - jobs = rec { + configs = { + fc20_x86_64 = { arch = "x86_64"; image = "fedora20"; }; + fc20_i386 = { arch = "i386" ; image = "fedora20"; }; + fc19_x86_64 = { arch = "x86_64"; image = "fedora19"; }; + fc19_i386 = { arch = "i386" ; image = "fedora19"; }; + fc18_x86_64 = { arch = "x86_64"; image = "fedora18"; }; + fc18_i386 = { arch = "i386" ; image = "fedora18"; }; + fc17_x86_64 = { arch = "x86_64"; image = "fedora17"; }; + fc17_i386 = { arch = "i386" ; image = "fedora17"; }; + fc16_x86_64 = { arch = "x86_64"; image = "fedora16"; }; + fc16_i386 = { arch = "i386" ; image = "fedora16"; }; + + fc18u_x86_64 = { arch = "x86_64"; image = "fedora18u"; }; + fc18u_i386 = { arch = "i386"; image = "fedora18u"; }; + fc19u_x86_64 = { arch = "x86_64"; image = "fedora19u"; }; + fc19u_i386 = { arch = "i386"; image = "fedora19u"; }; + + #centos63_i386 = { arch = "i386" ; image = "centos63"; }; + #centos63_x86_64 = { arch = "x86_64" ; image = "centos63"; }; + centos64_i386 = { arch = "i386" ; image = "centos64"; }; + centos64_x86_64 = { arch = "x86_64" ; image = "centos64"; }; + centos65_i386 = { arch = "i386" ; image = "centos65"; }; + centos65_x86_64 = { arch = "x86_64" ; image = "centos65"; }; + + rawhide_i386 = { arch = "i386" ; image = "rawhide"; }; + rawhide_x86_64 = { arch = "x86_64" ; image = "rawhide"; }; + }; + + rpms = lib.mapAttrs (n: v: wrapper mkBuild v) configs; + tests = let make = n: v: wrapper mkTest (v // { build = builtins.getAttr n rpms; istest = true; }); + in lib.mapAttrs make configs; + + jobs = tests // { tarball = pkgs.releaseTools.sourceTarball rec { name = "lvm2-tarball"; versionSuffix = if lvm2Src ? revCount @@ -193,31 +365,34 @@ let src = lvm2Src; autoconfPhase = ":"; distPhase = '' - set -x make distclean + version=`cat VERSION | cut "-d(" -f1`${versionSuffix} version_dm=`cat VERSION_DM | cut "-d-" -f1`${versionSuffix} - sed -e s,-git,${versionSuffix}, -i VERSION VERSION_DM - rm -rf spec; cp -R ${lvm2Nix}/spec/* . + chmod u+w * - (echo "%define enable_profiling 1"; - echo "%define check_commands \\"; - echo "make lcov-reset \\"; - echo "dmsetup targets\\"; - echo "mkdir -p \$out/nix-support \\"; - echo "make check QUIET=1 T=${T} || touch \$out/nix-support/failed \\" - echo "pwd > /tmp/build-location \\" - echo "touch rpm-no-clean") >> source.inc + + # set up versions + sed -e s,-git,${versionSuffix}, -i VERSION VERSION_DM sed -e "s,\(device_mapper_version\) [0-9.]*$,\1 $version_dm," \ -e "s,^\(Version:[^0-9%]*\)[0-9.]*$,\1 $version," \ -e "s,^\(Release:[^0-9%]*\)[0-9.]\+,\1 0.HYDRA," \ - -e "s:%with clvmd corosync:%with clvmd corosync,singlenode:" \ - -i source.inc - sed -e '/^%changelog/,$d' \ - -i lvm2.spec - echo "%changelog" >> lvm2.spec; - echo "* `date +"%a %b %d %Y"` Petr Rockai <prockai@redhat.com> - $version" >> lvm2.spec; - echo "- AUTOMATED BUILD BY Hydra" >> lvm2.spec + -i spec/source.inc + + # tweak RPM configuration + echo "%define enable_profiling 1" >> spec/source.inc + echo "%define enable_testsuite 1" >> spec/source.inc + sed -e "s:%with clvmd corosync:%with clvmd corosync,singlenode:" -i spec/source.inc + + # synthesize a changelog + sed -e '/^%changelog/,$d' -i spec/lvm2.spec + (echo "%changelog"; + echo "* `date +"%a %b %d %Y"` Petr Rockai <prockai@redhat.com> - $version"; + echo "- AUTOMATED BUILD BY Hydra") >> spec/lvm2.spec + + mv spec/* . && rmdir spec # */ # RPM needs the spec file in the source root + + # make a tarball mkdir ../LVM2.$version mv * ../LVM2.$version ensureDir $out/tarballs @@ -225,29 +400,5 @@ let tar cvzf $out/tarballs/LVM2.$version.tgz LVM2.$version ''; }; - - fc19_x86_64 = mkRPM { arch = "x86_64"; image = "fedora19"; }; - fc19_i386 = mkRPM { arch = "i386" ; image = "fedora19"; }; - fc18_x86_64 = mkRPM { arch = "x86_64"; image = "fedora18"; }; - fc18_i386 = mkRPM { arch = "i386" ; image = "fedora18"; }; - fc17_x86_64 = mkRPM { arch = "x86_64"; image = "fedora17"; }; - fc17_i386 = mkRPM { arch = "i386" ; image = "fedora17"; }; - fc16_x86_64 = mkRPM { arch = "x86_64"; image = "fedora16"; }; - fc16_i386 = mkRPM { arch = "i386" ; image = "fedora16"; }; - - fc18u_x86_64 = mkRPM { arch = "x86_64"; image = "fedora18u"; }; - fc18u_i386 = mkRPM { arch = "i386"; image = "fedora18u"; }; - fc19u_x86_64 = mkRPM { arch = "x86_64"; image = "fedora19u"; }; - fc19u_i386 = mkRPM { arch = "i386"; image = "fedora19u"; }; - - #centos63_i386 = mkRPM { arch = "i386" ; image = "centos63"; }; - #centos63_x86_64 = mkRPM { arch = "x86_64" ; image = "centos63"; }; - centos64_i386 = mkRPM { arch = "i386" ; image = "centos64"; }; - centos64_x86_64 = mkRPM { arch = "x86_64" ; image = "centos64"; }; - centos65_i386 = mkRPM { arch = "i386" ; image = "centos65"; }; - centos65_x86_64 = mkRPM { arch = "x86_64" ; image = "centos65"; }; - - rawhide_i386 = mkRPM { arch = "i386" ; image = "rawhide"; }; - rawhide_x86_64 = mkRPM { arch = "x86_64" ; image = "rawhide"; }; }; in jobs diff --git a/spec/build.inc b/spec/build.inc index 95c9b8357..176fdb13b 100644 --- a/spec/build.inc +++ b/spec/build.inc @@ -37,6 +37,9 @@ make install_initscripts DESTDIR=$RPM_BUILD_ROOT make install_systemd_units DESTDIR=$RPM_BUILD_ROOT make install_tmpfiles_configuration DESTDIR=$RPM_BUILD_ROOT %endif +%if %{enable_testsuite} +make -C test install DESTDIR=$RPM_BUILD_ROOT +%endif # when building an src.rpm from freestanding specfiles test -e %{_sourcedir}/source.inc || cp source.inc build.inc packages.inc macros.inc %{_sourcedir} diff --git a/spec/packages.inc b/spec/packages.inc index f0b7cfdd5..d36883833 100644 --- a/spec/packages.inc +++ b/spec/packages.inc @@ -494,3 +494,18 @@ the device-mapper event library. %{_includedir}/libdevmapper-event.h %{_libdir}/pkgconfig/devmapper-event.pc +%if %{enable_testsuite} +%package testsuite +Summary: LVM2 Testsuite +License: LGPLv2 +Group: Development + +%description testsuite +An extensive functional testsuite for LVM2. + +%files testsuite +%defattr(-,root,root,-) +%{_datadir}/lvm2-testsuite/ +%{_libexecdir}/lvm2-testsuite/ +%{_bindir}/lvm2-testsuite +%endif diff --git a/spec/source.inc b/spec/source.inc index 6ef479130..21fbf7d0c 100644 --- a/spec/source.inc +++ b/spec/source.inc @@ -4,6 +4,7 @@ # Defaults (rawhide)... %global enable_profiling 0 +%global enable_testsuite 0 %global enable_udev 1 %global enable_systemd 1 %global enable_cmirror 1 diff --git a/test/Makefile.in b/test/Makefile.in index 46aeaec5e..fc74d32bc 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -32,6 +32,7 @@ export LVM_TEST_THIN_RESTORE_CMD?=@THIN_RESTORE_CMD@ SUBDIRS = api unit SOURCES = lib/not.c lib/harness.c +CXXSOURCES = lib/runner.cpp include $(top_builddir)/make.tmpl @@ -55,7 +56,7 @@ ifeq ("@UDEV_SYNC@", "yes") dm_udev_synchronisation = 1 endif -all: check +all: .tests-stamp help: @echo -e "\nAvailable targets:" @@ -90,38 +91,57 @@ help: @echo " VERBOSE Verbose output (1), timing (2)." check: .tests-stamp - VERBOSE=$(VERBOSE) \ - cluster_LVM_TEST_LOCKING=3 \ - lvmetad_LVM_TEST_LVMETAD=1 \ - ./lib/harness $(patsubst %,normal:%,$(RUN_BASE)) \ - $(patsubst %,cluster:%,$(RUN_BASE)) \ - $(patsubst %,lvmetad:%,$(LVMETAD_RUN_BASE)) + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours ndev-vanilla,ndev-cluster,ndev-lvmetad --only $(T) --skip $(S) check_system: .tests-stamp - VERBOSE=$(VERBOSE) \ - scluster_LVM_TEST_LOCKING=3 \ - slvmetad_LVM_TEST_LVMETAD=1 \ - snormal_LVM_TEST_DEVDIR=/dev \ - scluster_LVM_TEST_DEVDIR=/dev \ - slvmetad_LVM_TEST_DEVDIR=/dev \ - ./lib/harness $(patsubst %,snormal:%,$(RUN_BASE)) \ - $(patsubst %,scluster:%,$(RUN_BASE)) \ - $(patsubst %,slvmetad:%,$(LVMETAD_RUN_BASE)) + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours udev-vanilla,udev-cluster,udev-lvmetad --only $(T) --skip $(S) check_cluster: .tests-stamp - @echo Testing with locking_type 3 - VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=3 ./lib/harness $(RUN_BASE) + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours ndev-cluster --only $(T) --skip $(S) check_local: .tests-stamp - @echo Testing with locking_type 1 - VERBOSE=$(VERBOSE) LVM_TEST_LOCKING=1 ./lib/harness $(RUN_BASE) + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours ndev-vanilla --only $(T) --skip $(S) ifeq ("@BUILD_LVMETAD@", "yes") check_lvmetad: .tests-stamp - @echo Testing with lvmetad on - VERBOSE=$(VERBOSE) LVM_TEST_LVMETAD=1 ./lib/harness $(RUN_BASE) + VERBOSE=$(VERBOSE) ./lib/runner \ + --testdir . --outdir results \ + --flavours ndev-lvmetad --only $(T) --skip $(S) endif +DATADIR = $(datadir)/lvm2-testsuite +EXECDIR = $(libexecdir)/lvm2-testsuite + +LIB_FLAVOURS = lib/flavour-ndev-vanilla lib/flavour-ndev-cluster lib/flavour-ndev-lvmetad \ + lib/flavour-udev-vanilla lib/flavour-udev-cluster lib/flavour-udev-lvmetad + +LIB_LOCAL = lib/paths lib/runner +LIB_EXEC = lib/not lib/invalid lib/fail lib/should +LIB_SHARED = lib/check lib/aux lib/inittest lib/utils lib/get lib/lvm-wrapper + +install: .tests-stamp lib/paths-installed + @echo $(srcdir) + @echo $(LIB_FLAVOURS) + $(INSTALL_DIR) $(DATADIR)/{shell,api,lib} + $(INSTALL_DATA) shell/*.sh $(DATADIR)/shell/ + $(INSTALL_DATA) api/*.sh $(DATADIR)/api/ + $(INSTALL_DATA) lib/paths-installed $(DATADIR)/lib/paths + $(INSTALL_DATA) $(LIB_FLAVOURS) $(DATADIR)/lib/ + $(INSTALL_SCRIPT) $(LIB_SHARED) $(DATADIR)/lib/ + for i in $(CMDS); do (cd $(DATADIR)/lib && ln -fs lvm-wrapper $$i); done + + $(INSTALL_DIR) $(EXECDIR) + $(INSTALL_PROGRAM) $(LIB_EXEC) $(EXECDIR) + $(INSTALL_PROGRAM) -D lib/runner $(bindir)/lvm2-testsuite + lib/should: lib/not ln -sf not lib/should @@ -131,6 +151,10 @@ lib/invalid: lib/not lib/fail: lib/not ln -sf not lib/fail +lib/runner: lib/runner.o .lib-dir-stamp + $(CXX) $(LDFLAGS) -o $@ $< + +lib/runner.o: $(wildcard $(srcdir)/lib/*.h) lib/%: lib/%.o .lib-dir-stamp $(CC) $(LDFLAGS) -o $@ $< @@ -139,13 +163,10 @@ lib/%: $(srcdir)/lib/%.sh .lib-dir-stamp cp $< $@ chmod +x $@ -lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp Makefile - $(RM) $@-t - echo 'top_srcdir="$(top_srcdir)"' >> $@-t - echo 'abs_top_builddir="$(abs_top_builddir)"' >> $@-t - echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> $@-t - echo 'abs_srcdir="$(abs_srcdir)"' >> $@-t - echo 'abs_builddir="$(abs_builddir)"' >> $@-t +lib/flavour-%: $(srcdir)/lib/flavour-%.sh .lib-dir-stamp + cp $< $@ + +lib/paths-common: $(srcdir)/Makefile.in .lib-dir-stamp Makefile echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t echo 'export THIN=@THIN@' >> $@-t echo 'export RAID=@RAID@' >> $@-t @@ -155,11 +176,25 @@ lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp Makefile echo 'export CLVMD_PIDFILE="@CLVMD_PIDFILE@"' >> $@-t mv $@-t $@ -LIB = lib/not lib/invalid lib/fail lib/should lib/harness \ - lib/check lib/aux lib/inittest lib/utils lib/get lib/lvm-wrapper \ - lib/paths +lib/paths-installed: lib/paths-common + $(RM) $@-t + cat lib/paths-common > $@-t + echo 'installed_testsuite=1' >> $@-t + echo 'export PATH=@libexecdir@/lvm2-testsuite:@datadir@/lvm2-testsuite/lib:$$PATH' >> $@-t + mv $@-t $@ + +lib/paths: lib/paths-common + $(RM) $@-t + cat lib/paths-common > $@-t + echo 'top_srcdir="$(top_srcdir)"' >> $@-t + echo 'abs_top_builddir="$(abs_top_builddir)"' >> $@-t + echo 'abs_top_srcdir="$(abs_top_srcdir)"' >> $@-t + echo 'abs_srcdir="$(abs_srcdir)"' >> $@-t + echo 'abs_builddir="$(abs_builddir)"' >> $@-t + mv $@-t $@ CMDS = lvm $(shell cat $(top_builddir)/tools/.commands) +LIB = $(LIB_SHARED) $(LIB_LOCAL) $(LIB_EXEC) $(LIB_FLAVOURS) .tests-stamp: $(ALL) $(LIB) $(SUBDIRS) @if test "$(srcdir)" != . ; then \ diff --git a/test/lib/aux.sh b/test/lib/aux.sh index dcc86edfc..c83ee09f1 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -14,7 +14,7 @@ run_valgrind() { # Execute script which may use $TESTNAME for creating individual # log files for each execute command - exec "${VALGRIND:-valg}" "$@" + exec "${VALGRIND:-valgrind}" "$@" } expect_failure() { @@ -22,7 +22,7 @@ expect_failure() { } prepare_clvmd() { - rm -f debug.log + rm -f debug.log strace.log test "${LVM_TEST_LOCKING:-0}" -ne 3 && return # not needed if pgrep clvmd ; then @@ -53,7 +53,7 @@ prepare_clvmd() { } prepare_dmeventd() { - rm -f debug.log + rm -f debug.log strace.log if pgrep dmeventd ; then echo "Cannot test dmeventd with real dmeventd ($(pgrep dmeventd)) running." skip @@ -79,7 +79,8 @@ prepare_dmeventd() { } prepare_lvmetad() { - rm -f debug.log + test $# -eq 0 && default_opts="-l wire,debug" + rm -f debug.log strace.log # skip if we don't have our own lvmetad... (which lvmetad 2>/dev/null | grep "$abs_builddir") || skip @@ -89,8 +90,10 @@ prepare_lvmetad() { local run_valgrind= test "${LVM_VALGRIND_LVMETAD:-0}" -eq 0 || run_valgrind="run_valgrind" + kill_sleep_kill_ LOCAL_LVMETAD ${LVM_VALGRIND_LVMETAD:-0} + echo "preparing lvmetad..." - $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" -l wire,debug & + $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" $default_opts "$@" & echo $! > LOCAL_LVMETAD while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket echo ok @@ -206,11 +209,18 @@ teardown_devs() { } kill_sleep_kill_() { - if test -s "$1" ; then - if kill -TERM "$(< $1)" ; then - if test "$2" -eq 0 ; then sleep .1 ; else sleep 1 ; fi - kill -KILL "$(< $1)" 2>/dev/null || true - fi + pidfile=$1 + slow=$2 + if test -s $pidfile ; then + pid=$(< $pidfile) + kill -TERM $pid || return 0 + if test $slow -eq 0 ; then sleep .1 ; else sleep 1 ; fi + kill -KILL $pid 2>/dev/null || true + wait=0 + while ps $pid > /dev/null && test $wait -le 10; do + sleep .5 + wait=$(($wait + 1)) + done fi } @@ -223,7 +233,7 @@ teardown() { # Avoid activation of dmeventd if there is no pid cfg=$(test -s LOCAL_DMEVENTD || echo "--config activation{monitoring=0}") vgremove -ff $cfg \ - $vg $vg1 $vg2 $vg3 $vg4 &>/dev/null || rm -f debug.log + $vg $vg1 $vg2 $vg3 $vg4 &>/dev/null || rm -f debug.log strace.log } kill_sleep_kill_ LOCAL_CLVMD ${LVM_VALGRIND_CLVMD:-0} @@ -272,7 +282,7 @@ prepare_loop() { echo -n . local LOOPFILE="$PWD/test.img" - dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size-1)) 2> /dev/null + dd if=/dev/zero of="$LOOPFILE" bs=$((1024*1024)) count=0 seek=$(($size)) 2> /dev/null if LOOP=$(losetup -s -f "$LOOPFILE" 2>/dev/null); then : elif LOOP=$(losetup -f) && losetup "$LOOP" "$LOOPFILE"; then @@ -294,7 +304,9 @@ prepare_loop() { done fi test -n "$LOOP" # confirm or fail + BACKING_DEV="$LOOP" echo "$LOOP" > LOOP + echo "$LOOP" > BACKING_DEV echo "ok ($LOOP)" } @@ -328,9 +340,9 @@ prepare_scsi_debug_dev() { # Create symlink to scsi_debug device in $DM_DEV_DIR SCSI_DEBUG_DEV="$DM_DEV_DIR/$(basename $DEBUG_DEV)" echo "$SCSI_DEBUG_DEV" > SCSI_DEBUG_DEV - echo "$SCSI_DEBUG_DEV" > LOOP + echo "$SCSI_DEBUG_DEV" > BACKING_DEV # Setting $LOOP provides means for prepare_devs() override - test "$LVM_TEST_DEVDIR" = "/dev" || ln -snf "$DEBUG_DEV" "$SCSI_DEBUG_DEV" + test "$DEBUG_DEV" = "$SCSI_DEBUG_DEV" || ln -snf "$DEBUG_DEV" "$SCSI_DEBUG_DEV" } cleanup_scsi_debug_dev() { @@ -338,20 +350,26 @@ cleanup_scsi_debug_dev() { rm -f SCSI_DEBUG_DEV LOOP } +prepare_backing_dev() { + if test -f BACKING_DEV; then + BACKING_DEV=$(< BACKING_DEV) + elif test -b "$LVM_TEST_BACKING_DEVICE"; then + BACKING_DEV="$LVM_TEST_BACKING_DEVICE" + echo "$BACKING_DEV" > BACKING_DEV + else + prepare_loop "$@" + fi +} + prepare_devs() { local n=${1:-3} local devsize=${2:-34} local pvname=${3:-pv} - local loopsz - prepare_loop $(($n*$devsize)) + prepare_backing_dev $(($n*$devsize)) echo -n "## preparing $n devices..." - if ! loopsz=$(blockdev --getsz "$LOOP" 2>/dev/null); then - loopsz=$(blockdev --getsize "$LOOP" 2>/dev/null) - fi - - local size=$(($loopsz/$n)) + local size=$(($devsize*2048)) # sectors local count=0 init_udev_transaction for i in $(seq 1 $n); do @@ -359,11 +377,23 @@ prepare_devs() { local dev="$DM_DEV_DIR/mapper/$name" DEVICES[$count]=$dev count=$(( $count + 1 )) - echo 0 $size linear "$LOOP" $((($i-1)*$size)) > "$name.table" - dmsetup create -u "TEST-$name" "$name" "$name.table" + echo 0 $size linear "$BACKING_DEV" $((($i-1)*$size)) > "$name.table" + if not dmsetup create -u "TEST-$name" "$name" "$name.table" && + test -n "$LVM_TEST_BACKING_DEVICE"; + then # maybe the backing device is too small for this test + LVM_TEST_BACKING_DEVICE= + rm -f BACKING_DEV + prepare_devs "$@" + return $? + fi done finish_udev_transaction + # non-ephemeral devices need to be cleared between tests + test -f LOOP || for d in ${DEVICES[@]}; do + dd if=/dev/zero of=$d bs=1M count=1 + done + #for i in `seq 1 $n`; do # local name="${PREFIX}$pvname$i" # dmsetup info -c $name @@ -454,7 +484,7 @@ enable_dev() { shift fi - rm -f debug.log + rm -f debug.log strace.log init_udev_transaction for dev in "$@"; do local name=$(echo "$dev" | sed -e 's,.*/,,') @@ -577,7 +607,7 @@ unhide_dev() { } mkdev_md5sum() { - rm -f debug.log + rm -f debug.log strace.log mkfs.ext2 "$DM_DEV_DIR/$1/$2" || return 1 md5sum "$DM_DEV_DIR/$1/$2" > "md5.$1-$2" } @@ -680,12 +710,12 @@ apitest() { local t=$1 shift test -x "$abs_top_builddir/test/api/$t.t" || skip - "$abs_top_builddir/test/api/$t.t" "$@" && rm -f debug.log + "$abs_top_builddir/test/api/$t.t" "$@" && rm -f debug.log strace.log } api() { test -x "$abs_top_builddir/test/api/wrapper" || skip - "$abs_top_builddir/test/api/wrapper" "$@" && rm -f debug.log + "$abs_top_builddir/test/api/wrapper" "$@" && rm -f debug.log strace.log } mirror_recovery_works() { @@ -775,7 +805,7 @@ can_use_16T() { # # i.e. dm_target_at_least dm-thin-pool 1 0 target_at_least() { - rm -f debug.log + rm -f debug.log strace.log case "$1" in dm-*) modprobe "$1" || true ;; esac diff --git a/test/lib/brick-shelltest.h b/test/lib/brick-shelltest.h new file mode 100644 index 000000000..99e663974 --- /dev/null +++ b/test/lib/brick-shelltest.h @@ -0,0 +1,1162 @@ +// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +/* + * This brick allows you to build a test runner for shell-based functional + * tests. It comes with fairly elaborate features (although most are only + * available on posix systems), geared toward difficult-to-test software. + * + * It provides a full-featured "main" function (brick::shelltest::run) that you + * can use as a drop-in shell test runner. + * + * Features include: + * - interactive and batch-mode execution + * - collects test results and test logs in a simple text-based format + * - measures resource use of individual tests + * - rugged: suited for running in monitored virtual machines + * - supports test flavouring + */ + +/* + * (c) 2014 Petr Ročkai <me@mornfall.net> + * (c) 2014 Red Hat, Inc. + */ + +/* Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ + +#include <fcntl.h> +#include <limits.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdint.h> +#include <errno.h> + +#include <vector> +#include <map> +#include <deque> +#include <string> +#include <iostream> +#include <iomanip> +#include <fstream> +#include <sstream> +#include <cassert> +#include <iterator> +#include <algorithm> +#include <stdexcept> + +#include <dirent.h> + +#ifdef __unix +#include <sys/stat.h> +#include <sys/resource.h> /* rusage */ +#include <sys/select.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/klog.h> +#include <time.h> +#include <unistd.h> +#endif + +#ifndef BRICK_SHELLTEST_H +#define BRICK_SHELLTEST_H + +namespace brick { +namespace shelltest { + +/* TODO: remove this section in favour of brick-filesystem.h */ + +inline std::runtime_error syserr( std::string msg, std::string ctx = "" ) { + return std::runtime_error( std::string( strerror( errno ) ) + " " + msg + " " + ctx ); +} + +struct dir { + DIR *d; + dir( std::string p ) { + d = opendir( p.c_str() ); + if ( !d ) + throw syserr( "error opening directory", p ); + } + ~dir() { closedir( d ); } +}; + +typedef std::vector< std::string > Listing; + +inline void fsync_name( std::string n ) +{ + int fd = open( n.c_str(), O_WRONLY ); + if ( fd >= 0 ) { + fsync( fd ); + close( fd ); + } +} + +inline Listing listdir( std::string p, bool recurse = false, std::string prefix = "" ) +{ + Listing r; + + dir d( p ); + struct dirent entry, *iter = 0; + int readerr; + + while ( (readerr = readdir_r( d.d, &entry, &iter )) == 0 && iter ) { + std::string ename( entry.d_name ); + + if ( ename == "." || ename == ".." ) + continue; + + if ( recurse ) { + struct stat64 stat; + std::string s = p + "/" + ename; + if ( ::stat64( s.c_str(), &stat ) == -1 ) + continue; + if ( S_ISDIR(stat.st_mode) ) { + Listing sl = listdir( s, true, prefix + ename + "/" ); + for ( Listing::iterator i = sl.begin(); i != sl.end(); ++i ) + r.push_back( prefix + *i ); + } else + r.push_back( prefix + ename ); + } else + r.push_back( ename ); + }; + + if ( readerr != 0 ) + throw syserr( "error reading directory", p ); + + return r; +} + +/* END remove this section */ + +struct Journal { + enum R { + STARTED, + RETRIED, + UNKNOWN, + FAILED, + INTERRUPTED, + KNOWNFAIL, + PASSED, + SKIPPED, + TIMEOUT, + WARNED, + }; + + friend std::ostream &operator<<( std::ostream &o, R r ) { + switch ( r ) { + case STARTED: return o << "started"; + case RETRIED: return o << "retried"; + case FAILED: return o << "failed"; + case INTERRUPTED: return o << "interrupted"; + case PASSED: return o << "passed"; + case SKIPPED: return o << "skipped"; + case TIMEOUT: return o << "timeout"; + case WARNED: return o << "warnings"; + default: return o << "unknown"; + } + } + + friend std::istream &operator>>( std::istream &i, R &r ) { + std::string x; + i >> x; + + r = UNKNOWN; + if ( x == "started" ) r = STARTED; + if ( x == "retried" ) r = RETRIED; + if ( x == "failed" ) r = FAILED; + if ( x == "interrupted" ) r = INTERRUPTED; + if ( x == "passed" ) r = PASSED; + if ( x == "skipped" ) r = SKIPPED; + if ( x == "timeout" ) r = TIMEOUT; + if ( x == "warnings" ) r = WARNED; + return i; + } + + template< typename S, typename T > + friend std::istream &operator>>( std::istream &i, std::pair< S, T > &r ) { + return i >> r.first >> r.second; + } + + typedef std::map< std::string, R > Status; + Status status, written; + + std::string location, list; + int timeouts; + + void append( std::string path ) { + std::ofstream of( path.c_str(), std::fstream::app ); + Status::iterator writ; + for ( Status::iterator i = status.begin(); i != status.end(); ++i ) { + writ = written.find( i->first ); + if ( writ == written.end() || writ->second != i->second ) + of << i->first << " " << i->second << std::endl; + } + written = status; + of.close(); + } + + void write( std::string path ) { + std::ofstream of( path.c_str() ); + for ( Status::iterator i = status.begin(); i != status.end(); ++i ) + of << i->first << " " << i->second << std::endl; + of.close(); + } + + void sync() { + append( location ); + fsync_name( location ); + write ( list ); + fsync_name( list ); + } + + void started( std::string n ) { + if ( status.count( n ) && status[ n ] == STARTED ) + status[ n ] = RETRIED; + else + status[ n ] = STARTED; + sync(); + } + + void done( std::string n, R r ) { + status[ n ] = r; + if ( r == TIMEOUT ) + ++ timeouts; + else + timeouts = 0; + sync(); + } + + bool done( std::string n ) { + if ( !status.count( n ) ) + return false; + return status[ n ] != STARTED && status[ n ] != INTERRUPTED; + } + + int count( R r ) { + int c = 0; + for ( Status::iterator i = status.begin(); i != status.end(); ++i ) + if ( i->second == r ) + ++ c; + return c; + } + + void banner() { + std::cout << std::endl << "### " << status.size() << " tests: " + << count( PASSED ) << " passed, " + << count( SKIPPED ) << " skipped, " + << count( TIMEOUT ) + count( WARNED ) << " broken, " + << count( FAILED ) << " failed" << std::endl; + } + + void details() { + for ( Status::iterator i = status.begin(); i != status.end(); ++i ) + if ( i->second != PASSED ) + std::cout << i->second << ": " << i->first << std::endl; + } + + void read( std::string n ) { + std::ifstream ifs( n.c_str() ); + typedef std::istream_iterator< std::pair< std::string, R > > It; + for ( It i( ifs ); i != It(); ++i ) + status[ i->first ] = i->second; + } + + void read() { read( location ); } + + Journal( std::string dir ) + : location( dir + "/journal" ), + list( dir + "/list" ), + timeouts( 0 ) + {} +}; + +struct TimedBuffer { + typedef std::pair< time_t, std::string > Line; + + std::deque< Line > data; + Line incomplete; + + Line shift( bool force = false ) { + Line result = std::make_pair( 0, "" ); + if ( force && data.empty() ) + std::swap( result, incomplete ); + else { + result = data.front(); + data.pop_front(); + } + return result; + } + + void push( std::string buf ) { + time_t now = time( 0 ); + std::string::iterator b = buf.begin(), e = buf.begin(); + + while ( e != buf.end() ) + { + e = std::find( b, buf.end(), '\n' ); + incomplete.second += std::string( b, e ); + + if ( !incomplete.first ) + incomplete.first = now; + + if ( e != buf.end() ) { + incomplete.second += "\n"; + data.push_back( incomplete ); + incomplete = std::make_pair( now, "" ); + } + b = (e == buf.end() ? e : e + 1); + } + } + + bool empty( bool force = false ) { + if ( force && !incomplete.second.empty() ) + return false; + return data.empty(); + } +}; + +struct Sink { + virtual void outline( bool ) {} + virtual void push( std::string x ) = 0; + virtual void sync( bool ) {} + virtual ~Sink() {} +}; + +struct Substitute { + typedef std::map< std::string, std::string > Map; + Map _map; + + std::string map( std::string line ) { + if ( std::string( line, 0, 9 ) == "@TESTDIR=" ) + _map[ "@TESTDIR@" ] = std::string( line, 9, std::string::npos ); + else if ( std::string( line, 0, 8 ) == "@PREFIX=" ) + _map[ "@PREFIX@" ] = std::string( line, 8, std::string::npos ); + else { + int off; + for ( Map::iterator s = _map.begin(); s != _map.end(); ++s ) + while ( (off = line.find( s->first )) != std::string::npos ) + line.replace( off, s->first.length(), s->second ); + } + return line; + } +}; + +struct Format { + time_t start; + bool stamp; + Substitute subst; + + std::string format( TimedBuffer::Line l ) { + std::stringstream result; + if ( stamp ) { + int rel = l.first - start; + result << "[" << std::setw( 2 ) << std::setfill( ' ' ) << rel / 60 + << ":" << std::setw( 2 ) << std::setfill( '0' ) << rel % 60 << "] "; + } + result << subst.map( l.second ); + return result.str(); + } + + Format() : start( time( 0 ) ), stamp( true ) {} +}; + +struct BufSink : Sink { + TimedBuffer data; + Format fmt; + + virtual void push( std::string x ) { + data.push( x ); + } + + void dump( std::ostream &o ) { + o << std::endl; + while ( !data.empty( true ) ) + o << "| " << fmt.format( data.shift( true ) ); + } +}; + +struct FdSink : Sink { + int fd; + + TimedBuffer stream; + Format fmt; + bool killed; + + virtual void outline( bool force ) + { + TimedBuffer::Line line = stream.shift( force ); + std::string out = fmt.format( line ); + write( fd, out.c_str(), out.length() ); + } + + virtual void sync( bool force ) { + if ( killed ) + return; + while ( !stream.empty( force ) ) + outline( force ); + } + + virtual void push( std::string x ) { + if ( !killed ) + stream.push( x ); + } + + FdSink( int _fd ) : fd( _fd ), killed( false ) {} +}; + +struct FileSink : FdSink { + std::string file; + FileSink( std::string n ) : FdSink( -1 ), file( n ) {} + + void sync( bool force ) { + if ( fd < 0 && !killed ) { + fd = open( file.c_str(), O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, 0644 ); + if ( fd < 0 ) + killed = true; + } + FdSink::sync( force ); + } + + ~FileSink() { + if ( fd >= 0 ) { + fsync( fd ); + close( fd ); + } + } +}; + +#define BRICK_SYSLOG_ACTION_READ_CLEAR 4 +#define BRICK_SYSLOG_ACTION_CLEAR 5 + +struct Source { + int fd; + + virtual void sync( Sink *sink ) { + ssize_t sz; + char buf[ 128 * 1024 ]; + while ( (sz = read(fd, buf, sizeof(buf) - 1)) > 0 ) + sink->push( std::string( buf, sz ) ); + if ( sz < 0 && errno != EAGAIN ) + throw syserr( "reading pipe" ); + } + + virtual void reset() {} + + virtual int fd_set( fd_set *set ) { + if ( fd >= 0 ) { + FD_SET( fd, set ); + return fd; + } else + return -1; + } + + Source( int fd = -1 ) : fd( fd ) {} + virtual ~Source() { + if ( fd >= 0 ) + ::close( fd ); + } +}; + +struct FileSource : Source { + std::string file; + FileSource( std::string n ) : Source( -1 ), file( n ) {} + + int fd_set( ::fd_set * ) { return -1; } /* reading a file is always non-blocking */ + void sync( Sink *s ) { + if ( fd < 0 ) { + fd = open( file.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK ); + if ( fd >= 0 ) + lseek( fd, 0, SEEK_END ); + } + if ( fd >= 0 ) + Source::sync( s ); + } +}; + +struct KMsg : Source { + bool can_clear; + + KMsg() : can_clear( true ) {} + + bool dev_kmsg() { + return fd >= 0; + } + + void reset() { +#ifdef __unix + int sz; + + if ( dev_kmsg() ) { + if ( (fd = open("/dev/kmsg", O_RDONLY | O_NONBLOCK)) < 0 ) { + if (errno != ENOENT) /* Older kernels (<3.5) do not support /dev/kmsg */ + perror("opening /dev/kmsg"); + } else if (lseek(fd, 0L, SEEK_END) == (off_t) -1) + perror("lseek /dev/kmsg"); + } else + if ( klogctl( BRICK_SYSLOG_ACTION_CLEAR, 0, 0 ) < 0 ) + can_clear = false; +#endif + } + + void sync( Sink *s ) { +#ifdef __unix + int sz; + char buf[ 128 * 1024 ]; + + if ( dev_kmsg() ) { + while ( (sz = ::read(fd, buf, sizeof(buf) - 1)) > 0 ) + s->push( std::string( buf, sz ) ); + if ( sz < 0 ) { + fd = -1; + sync( s ); + } + } else if ( can_clear ) { + while ( (sz = klogctl( BRICK_SYSLOG_ACTION_READ_CLEAR, buf, + sizeof(buf) - 1 )) > 0 ) + s->push( std::string( buf, sz ) ); + if ( sz < 0 && errno == EPERM ) + can_clear = false; + } +#endif + } +}; + +struct Observer : Sink { + TimedBuffer stream; + + bool warnings; + Observer() : warnings( false ) {} + + void push( std::string s ) { + stream.push( s ); + } + + void sync( bool force ) { + while ( !stream.empty( force ) ) { + TimedBuffer::Line line = stream.shift( force ); + if ( line.second.find( "TEST WARNING" ) != std::string::npos ) + warnings = true; + } + } +}; + +struct IO : Sink { + typedef std::vector< Sink* > Sinks; + typedef std::vector< Source* > Sources; + + mutable Sinks sinks; + mutable Sources sources; + + Observer *_observer; + + virtual void push( std::string x ) { + for ( Sinks::iterator i = sinks.begin(); i != sinks.end(); ++i ) + (*i)->push( x ); + } + + void sync( bool force ) { + for ( Sources::iterator i = sources.begin(); i != sources.end(); ++i ) + (*i)->sync( this ); + + for ( Sinks::iterator i = sinks.begin(); i != sinks.end(); ++i ) + (*i)->sync( force ); + } + + void close() { + for ( Sources::iterator i = sources.begin(); i != sources.end(); ++i ) + delete *i; + sources.clear(); + } + + int fd_set( fd_set *set ) { + int max = -1; + + for ( Sources::iterator i = sources.begin(); i != sources.end(); ++i ) + max = std::max( (*i)->fd_set( set ), max ); + return max + 1; + } + + Observer &observer() { return *_observer; } + + IO() { + clear(); + } + + /* a stealing copy constructor */ + IO( const IO &io ) : sinks( io.sinks ), sources( io.sources ), _observer( io._observer ) + { + io.sinks.clear(); + io.sources.clear(); + } + + IO &operator= ( const IO &io ) { + this->~IO(); + return *new (this) IO( io ); + } + + void clear() { + for ( Sinks::iterator i = sinks.begin(); i != sinks.end(); ++i ) + delete *i; + sinks.clear(); + sinks.push_back( _observer = new Observer ); + } + + ~IO() { close(); clear(); } + +}; + +namespace { +pid_t kill_pid = 0; +bool fatal_signal = false; +bool interrupt = false; +} + +struct Options { + bool verbose, batch, interactive, cont, fatal_timeouts, kmsg; + std::string testdir, outdir, workdir, heartbeat; + std::vector< std::string > flavours, filter, watch; + std::string flavour_envvar; + int timeout; + Options() : verbose( false ), batch( false ), interactive( false ), + cont( false ), fatal_timeouts( false ), kmsg( false ), + timeout( 60 ) {} +}; + +struct TestProcess +{ + std::string filename; + bool interactive; + int fd; + + void exec() { + assert( fd >= 0 ); + if ( !interactive ) { + int devnull = ::open( "/dev/null", O_RDONLY ); + if ( devnull >= 0 ) { /* gcc really doesn't like to not have stdin */ + dup2( devnull, STDIN_FILENO ); + close( devnull ); + } else + close( STDIN_FILENO ); + dup2( fd, STDOUT_FILENO ); + dup2( fd, STDERR_FILENO ); + close( fd ); + } + + setpgid( 0, 0 ); + + execlp( "bash", "bash", "-noprofile", "-norc", filename.c_str(), NULL ); + perror( "execlp" ); + _exit( 202 ); + } + + TestProcess( std::string file ) + : filename( file ), interactive( false ), fd( -1 ) + {} +}; + +struct TestCase { + TestProcess child; + std::string name, flavour; + IO io; + BufSink *iobuf; + + struct rusage usage; + int status; + bool timeout; + pid_t pid; + + time_t start, end, silent_start, last_update, last_heartbeat; + Options options; + + Journal *journal; + + std::string pretty() { + if ( options.batch ) + return flavour + ": " + name; + return "[" + flavour + "] " + name; + } + + std::string id() { + return flavour + ":" + name; + } + + void pipe() { + int fds[2]; + + if (socketpair( PF_UNIX, SOCK_STREAM, 0, fds )) { + perror("socketpair"); + exit(201); + } + + if (fcntl( fds[0], F_SETFL, O_NONBLOCK ) == -1) { + perror("fcntl on socket"); + exit(202); + } + + io.sources.push_back( new Source( fds[0] ) ); + child.fd = fds[1]; + child.interactive = options.interactive; + } + + bool monitor() { + end = time( 0 ); + + /* heartbeat */ + if ( end - last_heartbeat >= 20 && !options.heartbeat.empty() ) { + std::ofstream hb( options.heartbeat.c_str(), std::fstream::app ); + hb << "."; + hb.close(); + fsync_name( options.heartbeat ); + last_heartbeat = end; + } + + if ( wait4(pid, &status, WNOHANG, &usage) != 0 ) { + io.sync( true ); + return false; + } + + /* kill off tests after a minute of silence */ + if ( !options.interactive ) + if ( end - silent_start > options.timeout ) { + kill( pid, SIGINT ); + sleep( 5 ); /* wait a bit for a reaction */ + if ( waitpid( pid, &status, WNOHANG ) == 0 ) { + system( "echo t > /proc/sysrq-trigger 2> /dev/null" ); + kill( -pid, SIGKILL ); + waitpid( pid, &status, 0 ); + } + timeout = true; + io.sync( true ); + return false; + } + + struct timeval wait; + fd_set set; + + FD_ZERO( &set ); + int nfds = io.fd_set( &set ); + wait.tv_sec = 0; + wait.tv_usec = 500000; /* timeout 0.5s */ + + if ( !options.verbose && !options.interactive && !options.batch ) { + if ( end - last_update >= 1 ) { + progress( Update ) << tag( "running" ) << pretty() << " " + << end - start << std::flush; + last_update = end; + } + } + + if ( select( nfds, &set, NULL, NULL, &wait ) > 0 ) + silent_start = end; /* something happened */ + + io.sync( false ); + + return true; + } + + std::string timefmt( time_t t ) { + std::stringstream ss; + ss << t / 60 << ":" << std::setw( 2 ) << std::setfill( '0' ) << t % 60; + return ss.str(); + } + + std::string rusage() + { + std::stringstream ss; + time_t wall = end - start, user = usage.ru_utime.tv_sec, + system = usage.ru_stime.tv_sec; + size_t rss = usage.ru_maxrss / 1024, + inb = usage.ru_inblock / 100, + outb = usage.ru_oublock / 100; + + size_t inb_10 = inb % 10, outb_10 = outb % 10; + inb /= 10; outb /= 10; + + ss << timefmt( wall ) << " wall " << timefmt( user ) << " user " + << timefmt( system ) << " sys " << std::setw( 3 ) << rss << "M RSS | " + << "IOPS: " << std::setw( 5 ) << inb << "." << inb_10 << "K in " + << std::setw( 5 ) << outb << "." << outb_10 << "K out"; + return ss.str(); + } + + std::string tag( std::string n ) { + if ( options.batch ) + return "## "; + int pad = (12 - n.length()); + return "### " + std::string( pad, ' ' ) + n + ": "; + } + + std::string tag( Journal::R r ) { + std::stringstream s; + s << r; + return tag( s.str() ); + } + + enum P { First, Update, Last }; + + std::ostream &progress( P p = Last ) + { + static struct : std::streambuf {} buf; + static std::ostream null(&buf); + + if ( options.batch && p == First ) + return std::cout; + + if ( isatty( STDOUT_FILENO ) && !options.batch ) { + if ( p != First ) + return std::cout << "\r"; + return std::cout; + } + + if ( p == Last ) + return std::cout; + + return null; + } + + void parent() + { + ::close( child.fd ); + setupIO(); + + journal->started( id() ); + silent_start = start = time( 0 ); + + progress( First ) << tag( "running" ) << pretty() << std::flush; + if ( options.verbose || options.interactive ) + progress() << std::endl; + + while ( monitor() ); + + Journal::R r = Journal::UNKNOWN; + + if ( timeout ) { + r = Journal::TIMEOUT; + } else if ( WIFEXITED( status ) ) { + if ( WEXITSTATUS( status ) == 0 ) + r = Journal::PASSED; + else if ( WEXITSTATUS( status ) == 200 ) + r = Journal::SKIPPED; + else + r = Journal::FAILED; + } else if ( interrupt && WIFSIGNALED( status ) && WTERMSIG( status ) == SIGINT ) + r = Journal::INTERRUPTED; + else + r = Journal::FAILED; + + if ( r == Journal::PASSED && io.observer().warnings ) + r = Journal::WARNED; + + io.close(); + + if ( iobuf && ( r == Journal::FAILED || r == Journal::TIMEOUT ) ) + iobuf->dump( std::cout ); + + journal->done( id(), r ); + + if ( options.batch ) { + int spaces = std::max( 64 - int(pretty().length()), 0 ); + progress( Last ) << " " << std::string( spaces, '.' ) << " " << r << std::endl; + if ( r == Journal::PASSED ) + progress( First ) << " " << rusage() << std::endl; + } else + progress( Last ) << tag( r ) << pretty() << std::endl; + + io.clear(); + } + + void run() { + pipe(); + pid = kill_pid = fork(); + if (pid < 0) { + perror("Fork failed."); + exit(201); + } else if (pid == 0) { + io.close(); + chdir( options.workdir.c_str() ); + if ( !options.flavour_envvar.empty() ) + setenv( options.flavour_envvar.c_str(), flavour.c_str(), 1 ); + child.exec(); + } else { + parent(); + } + } + + void setupIO() { + iobuf = 0; + if ( options.verbose || options.interactive ) + io.sinks.push_back( new FdSink( 1 ) ); + else if ( !options.batch ) + io.sinks.push_back( iobuf = new BufSink() ); + + std::string n = id(); + std::replace( n.begin(), n.end(), '/', '_' ); + std::string fn = options.outdir + "/" + n + ".txt"; + io.sinks.push_back( new FileSink( fn ) ); + + for ( std::vector< std::string >::iterator i = options.watch.begin(); + i != options.watch.end(); ++i ) + io.sources.push_back( new FileSource( *i ) ); + if ( options.kmsg ) + io.sources.push_back( new KMsg ); + } + + TestCase( Journal &j, Options opt, std::string path, std::string name, std::string flavour ) + : child( path ), name( name ), flavour( flavour ), timeout( false ), + last_update( 0 ), last_heartbeat( 0 ), options( opt ), journal( &j ) + { + } +}; + +struct Main { + bool die; + time_t start; + + typedef std::vector< TestCase > Cases; + typedef std::vector< std::string > Flavours; + + Journal journal; + Options options; + Cases cases; + + void setup() { + Listing l = listdir( options.testdir, true ); + std::sort( l.begin(), l.end() ); + + for ( Flavours::iterator flav = options.flavours.begin(); + flav != options.flavours.end(); ++flav ) { + + for ( Listing::iterator i = l.begin(); i != l.end(); ++i ) { + if ( i->substr( i->length() - 3, i->length() ) != ".sh" ) + continue; + if ( i->substr( 0, 4 ) == "lib/" ) + continue; + bool filter = !options.filter.empty(); + + for ( std::vector< std::string >::iterator filt = options.filter.begin(); + filt != options.filter.end(); ++filt ) { + if ( i->find( *filt ) != std::string::npos ) + filter = false; + } + if ( filter ) + continue; + cases.push_back( TestCase( journal, options, options.testdir + *i, *i, *flav ) ); + cases.back().options = options; + } + } + + if ( options.cont ) + journal.read(); + else + ::unlink( journal.location.c_str() ); + } + + int run() { + setup(); + start = time( 0 ); + std::cerr << "running " << cases.size() << " tests" << std::endl; + + for ( Cases::iterator i = cases.begin(); i != cases.end(); ++i ) { + + if ( options.cont && journal.done( i->id() ) ) + continue; + + i->run(); + + if ( options.fatal_timeouts && journal.timeouts >= 2 ) { + journal.started( i->id() ); // retry the test on --continue + std::cerr << "E: Hit 2 timeouts in a row with --fatal-timeouts" << std::endl; + std::cerr << "Suspending (please restart the VM)." << std::endl; + sleep( 3600 ); + die = 1; + } + + if ( time(0) - start > 3 * 3600 ) { + std::cerr << "3 hours passed, giving up..." << std::endl; + die = 1; + } + + if ( die || fatal_signal ) + break; + } + + journal.banner(); + if ( die || fatal_signal ) + return 1; + + return journal.count( Journal::FAILED ) ? 1 : 0; + } + + Main( Options o ) : die( false ), journal( o.outdir ), options( o ) {} +}; + +namespace { + +void handler( int sig ) { + signal( sig, SIG_DFL ); /* die right away next time */ + if ( kill_pid > 0 ) + kill( -kill_pid, sig ); + fatal_signal = true; + if ( sig == SIGINT ) + interrupt = true; +} + +void setup_handlers() { + /* set up signal handlers */ + for ( int i = 0; i <= 32; ++i ) + switch (i) { + case SIGCHLD: case SIGWINCH: case SIGURG: + case SIGKILL: case SIGSTOP: break; + default: signal(i, handler); + } +} + +} + +/* TODO remove in favour of brick-commandline.h */ +struct Args { + typedef std::vector< std::string > V; + V args; + + Args( int argc, const char **argv ) { + for ( int i = 1; i < argc; ++ i ) + args.push_back( argv[ i ] ); + } + + bool has( std::string fl ) { + return std::find( args.begin(), args.end(), fl ) != args.end(); + } + + std::string opt( std::string fl ) { + V::iterator i = std::find( args.begin(), args.end(), fl ); + if ( i == args.end() || i + 1 == args.end() ) + return ""; + return *(i + 1); + } +}; + +namespace { + +bool hasenv( const char *name ) { + const char *v = getenv( name ); + if ( !v ) + return false; + if ( strlen( v ) == 0 || !strcmp( v, "0" ) ) + return false; + return true; +} + +template< typename C > +void split( std::string s, C &c ) { + std::stringstream ss( s ); + std::string item; + while ( std::getline( ss, item, ',' ) ) + c.push_back( item ); +} + +} + +int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVOUR" ) +{ + Args args( argc, argv ); + Options opt; + + opt.flavour_envvar = fl_envvar; + + if ( args.has( "--continue" ) ) + opt.cont = true; + + if ( args.has( "--only" ) ) + split( args.opt( "--only" ), opt.filter ); + else if ( hasenv( "T" ) ) + split( getenv( "T" ), opt.filter ); + + if ( args.has( "--fatal-timeouts" ) ) + opt.fatal_timeouts = true; + + if ( args.has( "--heartbeat" ) ) + opt.heartbeat = args.opt( "--heartbeat" ); + + if ( args.has( "--batch" ) || hasenv( "BATCH" ) ) { + opt.verbose = false; + opt.batch = true; + } + + if ( args.has( "--verbose" ) || hasenv( "VERBOSE" ) ) { + opt.batch = false; + opt.verbose = true; + } + + if ( args.has( "--interactive" ) || hasenv( "INTERACTIVE" ) ) { + opt.verbose = false; + opt.batch = false; + opt.interactive = true; + } + + if ( args.has( "--flavours" ) ) + split( args.opt( "--flavours" ), opt.flavours ); + else + opt.flavours.push_back( "vanilla" ); + + if ( args.has( "--watch" ) ) + split( args.opt( "--watch" ), opt.watch ); + + if ( args.has( "--timeout" ) ) + opt.timeout = atoi( args.opt( "--timeout" ).c_str() ); + + if ( args.has( "--kmsg" ) ) + opt.kmsg = true; + + opt.outdir = args.opt( "--outdir" ); + opt.testdir = args.opt( "--testdir" ); + opt.workdir = args.opt( "--workdir" ); + + if ( opt.testdir.empty() ) + opt.testdir = "/usr/share/lvm2-testsuite"; + + if ( opt.workdir.empty() ) + opt.workdir = opt.testdir; + + opt.testdir += "/"; + + setup_handlers(); + + Main main( opt ); + return main.run(); +} + +} +} + +#endif + +#ifdef BRICK_DEMO + +int main( int argc, const char **argv ) { + return brick::shelltest::run( argc, argv ); +} + +#endif + +// vim: syntax=cpp tabstop=4 shiftwidth=4 expandtab diff --git a/test/lib/flavour-ndev-cluster.sh b/test/lib/flavour-ndev-cluster.sh new file mode 100644 index 000000000..013b02dc8 --- /dev/null +++ b/test/lib/flavour-ndev-cluster.sh @@ -0,0 +1 @@ +LVM_TEST_LOCKING=3 diff --git a/test/lib/flavour-ndev-lvmetad.sh b/test/lib/flavour-ndev-lvmetad.sh new file mode 100644 index 000000000..6f8c2d4d5 --- /dev/null +++ b/test/lib/flavour-ndev-lvmetad.sh @@ -0,0 +1,2 @@ +LVM_TEST_LOCKING=1 +LVM_TEST_LVMETAD=1 diff --git a/test/lib/flavour-ndev-vanilla.sh b/test/lib/flavour-ndev-vanilla.sh new file mode 100644 index 000000000..b3f4ceef1 --- /dev/null +++ b/test/lib/flavour-ndev-vanilla.sh @@ -0,0 +1 @@ +LVM_TEST_LOCKING=1 diff --git a/test/lib/flavour-udev-cluster.sh b/test/lib/flavour-udev-cluster.sh new file mode 100644 index 000000000..7c3761607 --- /dev/null +++ b/test/lib/flavour-udev-cluster.sh @@ -0,0 +1,2 @@ +LVM_TEST_LOCKING=3 +LVM_TEST_DEVDIR=/dev diff --git a/test/lib/flavour-udev-lvmetad.sh b/test/lib/flavour-udev-lvmetad.sh new file mode 100644 index 000000000..e1dac52b7 --- /dev/null +++ b/test/lib/flavour-udev-lvmetad.sh @@ -0,0 +1,3 @@ +LVM_TEST_LOCKING=1 +LVM_TEST_LVMETAD=1 +LVM_TEST_DEVDIR=/dev diff --git a/test/lib/flavour-udev-vanilla.sh b/test/lib/flavour-udev-vanilla.sh new file mode 100644 index 000000000..09d023a6f --- /dev/null +++ b/test/lib/flavour-udev-vanilla.sh @@ -0,0 +1,2 @@ +LVM_TEST_LOCKING=1 +LVM_TEST_DEVDIR=/dev diff --git a/test/lib/inittest.sh b/test/lib/inittest.sh index 731cd7afd..5b3ad87d4 100644 --- a/test/lib/inittest.sh +++ b/test/lib/inittest.sh @@ -29,7 +29,8 @@ TESTOLDPWD=$(pwd) COMMON_PREFIX="LVMTEST" PREFIX="${COMMON_PREFIX}$$" -TESTDIR=$(mkdtemp "${LVM_TEST_DIR:-$TESTOLDPWD}" "$PREFIX.XXXXXXXXXX") || \ +if test -n "$LVM_TEST_DIR"; then LVM_TEST_DIR=$TMPDIR; fi +TESTDIR=$(mkdtemp "${LVM_TEST_DIR:-/tmp}" "$PREFIX.XXXXXXXXXX") || \ die "failed to create temporary directory in ${LVM_TEST_DIR:-$TESTOLDPWD}" RUNNING_DMEVENTD=$(pgrep dmeventd) || true @@ -39,19 +40,23 @@ test -n "$BASH" && trap 'set +vx; STACKTRACE; set -vx' ERR trap 'aux teardown' EXIT # don't forget to clean up cd "$TESTDIR" +mkdir lib + +# Setting up symlink from $i to $TESTDIR/lib +test -n "$abs_top_builddir" && \ + find "$abs_top_builddir/daemons/dmeventd/plugins/" -name '*.so' \ + -exec ln -s -t lib "{}" + +find "$TESTOLDPWD/lib" ! \( -name '*.sh' -o -name '*.[cdo]' \ + -o -name '*~' \) -exec ln -s -t lib "{}" + if test -n "$LVM_TEST_FLAVOUR"; then - touch flavour_overrides - env | grep ^${LVM_TEST_FLAVOUR} | while read var; do - (echo -n "export "; echo $var | sed -e s,^${LVM_TEST_FLAVOUR}_,,) >> flavour_overrides - done - . flavour_overrides + . lib/flavour-$LVM_TEST_FLAVOUR fi DM_DEFAULT_NAME_MANGLING_MODE=none DM_DEV_DIR="$TESTDIR/dev" LVM_SYSTEM_DIR="$TESTDIR/etc" -mkdir "$LVM_SYSTEM_DIR" "$TESTDIR/lib" "$DM_DEV_DIR" +mkdir "$LVM_SYSTEM_DIR" "$DM_DEV_DIR" if test -n "$LVM_TEST_DEVDIR" ; then DM_DEV_DIR=$LVM_TEST_DEVDIR else @@ -76,12 +81,6 @@ else echo "Selinux mode is not installed." fi -# Setting up symlink from $i to $TESTDIR/lib -find "$abs_top_builddir/daemons/dmeventd/plugins/" -name '*.so' \ - -exec ln -s -t lib "{}" + -find "$abs_top_builddir/test/lib" ! \( -name '*.sh' -o -name '*.[cdo]' \ - -o -name '*~' \) -exec ln -s -t lib "{}" + - # Set vars from utils now that we have TESTDIR/PREFIX/... prepare_test_vars diff --git a/test/lib/lvm-wrapper.sh b/test/lib/lvm-wrapper.sh index 082c6405b..8bc96a225 100644 --- a/test/lib/lvm-wrapper.sh +++ b/test/lib/lvm-wrapper.sh @@ -24,16 +24,24 @@ test -z "$LVM_GDB" || exec gdb --readnow --args "$abs_top_builddir/tools/lvm" $C # Multiple level of LVM_VALGRIND support # the higher level the more commands are traced if test -n "$LVM_VALGRIND"; then - RUN_VALGRIND="aux run_valgrind"; - case "$CMD" in - lvs|pvs|vgs|vgck|vgscan) - test "$LVM_VALGRIND" -gt 2 || unset RUN_VALGRIND ;; - pvcreate|pvremove|lvremove|vgcreate|vgremove) - test "$LVM_VALGRIND" -gt 1 || unset RUN_VALGRIND ;; - *) - test "$LVM_VALGRIND" -gt 0 || unset RUN_VALGRIND ;; - esac + RUN_DBG="${VALGRIND:-valgrind}"; fi +if test -n "$LVM_STRACE"; then + RUN_DBG="strace $LVM_STRACE -o strace.log" +fi + +case "$CMD" in + lvs|pvs|vgs|vgck|vgscan) + test ${LVM_DEBUG_LEVEL:-0} -lt 2 && RUN_DBG= ;; + pvcreate|pvremove|lvremove|vgcreate|vgremove) + test ${LVM_DEBUG_LEVEL:-0} -lt 1 && RUN_DBG= ;; +esac + # the exec is important, because otherwise fatal signals inside "not" go unnoticed -exec $RUN_VALGRIND "$abs_top_builddir/tools/lvm" $CMD "$@" +if test -n "$abs_top_builddir"; then + exec $RUN_DBG "$abs_top_builddir/tools/lvm" $CMD "$@" +else # we are testing the lvm on $PATH + PATH=`echo $PATH | sed -e s,[^:]*lvm2-testsuite[^:]*:,,g` + exec $RUN_DBG lvm $CMD "$@" +fi diff --git a/test/lib/runner.cpp b/test/lib/runner.cpp new file mode 100644 index 000000000..7c2bcb549 --- /dev/null +++ b/test/lib/runner.cpp @@ -0,0 +1,34 @@ +/* -*- C++ -*- copyright (c) 2014 Red Hat, Inc. + * + * This file is part of LVM2. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "brick-shelltest.h" + +int main(int argc, const char **argv) +{ + brick::shelltest::run( argc, argv, "LVM_TEST_FLAVOUR" ); +} + diff --git a/test/lib/utils.sh b/test/lib/utils.sh index b4cfdebda..2f7dc65b3 100644 --- a/test/lib/utils.sh +++ b/test/lib/utils.sh @@ -112,7 +112,7 @@ STACKTRACE() { test "${LVM_TEST_PARALLEL:-0}" -eq 1 -o -n "$RUNNING_DMEVENTD" -o -f LOCAL_DMEVENTD || { pgrep dmeventd &>/dev/null && \ - die "** During test dmeventd has been started!" + die "ERROR: The test started dmeventd unexpectedly." } # Get backtraces from coredumps @@ -129,6 +129,7 @@ STACKTRACE() { test -z "$LVM_TEST_NODEBUG" -a -f debug.log && { sed -e "s,^,## DEBUG: ,;s,$top_srcdir/\?,," < debug.log + test -e strace.log && sed -e "s,^,## STRACE: ,;s,$top_srcdir/\?,," < strace.log } test -f SKIP_THIS_TEST && exit 200 @@ -207,18 +208,21 @@ prepare_test_vars() { done } -# check if $abs_top_builddir was already set via 'lib/paths' -test -n "${abs_top_builddir+varset}" || . lib/paths || die "you must run make first" - -case "$PATH" in -*"$abs_top_builddir/test/lib"*) ;; -*) - PATH="$abs_top_builddir/test/lib":"$abs_top_builddir/test/api":$PATH - for i in `find $abs_top_builddir -name \*.so`; do - p=`dirname $i` - LD_LIBRARY_PATH="$p":$LD_LIBRARY_PATH - done - export PATH LD_LIBRARY_PATH ;; -esac +if test -z "${abs_top_builddir+varset}" && test -z "${installed_testsuite+varset}"; then + . lib/paths || die "something went wrong -- lib/paths is missing?" +fi + +if test -z "${installed_testsuite+varset}"; then + case "$PATH" in + *"$abs_top_builddir/test/lib"*) ;; + *) + PATH="$abs_top_builddir/test/lib":"$abs_top_builddir/test/api":$PATH + for i in `find $abs_top_builddir -name \*.so`; do + p=`dirname $i` + LD_LIBRARY_PATH="$p":$LD_LIBRARY_PATH + done + export PATH LD_LIBRARY_PATH ;; + esac +fi test -z "$PREFIX" || prepare_test_vars diff --git a/test/shell/000-basic.sh b/test/shell/000-basic.sh index 7ad4d9f05..027969e36 100644 --- a/test/shell/000-basic.sh +++ b/test/shell/000-basic.sh @@ -13,6 +13,8 @@ lvm version +test -n "$abs_top_builddir" || skip + v=$abs_top_builddir/lib/misc/lvm-version.h sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected diff --git a/test/shell/dmeventd-restart.sh b/test/shell/dmeventd-restart.sh index a94ede180..4344e8234 100644 --- a/test/shell/dmeventd-restart.sh +++ b/test/shell/dmeventd-restart.sh @@ -43,7 +43,10 @@ not pgrep dmeventd rm LOCAL_DMEVENTD # set dmeventd path -aux lvmconf "dmeventd/executable=\"$abs_top_builddir/test/lib/dmeventd\"" +if test -n "$abs_top_builddir"; then + aux lvmconf "dmeventd/executable=\"$abs_top_builddir/test/lib/dmeventd\"" +fi + lvchange --monitor y --verbose $vg/3way 2>&1 | tee lvchange.out pgrep dmeventd >LOCAL_DMEVENTD not grep 'already monitored' lvchange.out diff --git a/test/shell/lock-blocking.sh b/test/shell/lock-blocking.sh index e05fa5068..7c33067ec 100644 --- a/test/shell/lock-blocking.sh +++ b/test/shell/lock-blocking.sh @@ -20,7 +20,7 @@ vgcreate $vg "$dev1" "$dev2" # if wait_for_locks set, vgremove should wait for orphan lock # flock process should have exited by the time first vgremove completes -flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" & +flock -w 5 $TESTDIR/var/lock/lvm/P_orphans sleep 10 & while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done vgremove --config 'global { wait_for_locks = 1 }' $vg @@ -31,7 +31,7 @@ test ! -f $TESTDIR/var/lock/lvm/P_orphans # if wait_for_locks not set, vgremove should fail on non-blocking lock # we must wait for flock process at the end - vgremove won't wait vgcreate $vg "$dev1" "$dev2" -flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" & +flock -w 5 $TESTDIR/var/lock/lvm/P_orphans sleep 10 & while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done flock_pid=`jobs -p` diff --git a/test/shell/lvchange-syncaction-raid.sh b/test/shell/lvchange-syncaction-raid.sh index 18af83f78..bf75f8ab7 100644 --- a/test/shell/lvchange-syncaction-raid.sh +++ b/test/shell/lvchange-syncaction-raid.sh @@ -49,7 +49,7 @@ dmsetup info -c # For now it fails with: # device-mapper: message ioctl on failed: Device or resource busy # -lvchange --syncaction check $vg/$lv1 +should lvchange --syncaction check $vg/$lv1 aux enable_dev "$dev2" lvs -o+raid_mismatch_count -a $vg diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh index 07bafb950..ce5b34494 100644 --- a/test/shell/lvconvert-mirror-basic.sh +++ b/test/shell/lvconvert-mirror-basic.sh @@ -110,6 +110,8 @@ test_lvconvert() { fi } +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" aux prepare_pvs 5 5 vgcreate -s 32k $vg $(cat DEVICES) diff --git a/test/shell/lvconvert-mirror.sh b/test/shell/lvconvert-mirror.sh index d8f057a9b..6ba2ab2f0 100644 --- a/test/shell/lvconvert-mirror.sh +++ b/test/shell/lvconvert-mirror.sh @@ -11,6 +11,9 @@ . lib/inittest +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + aux prepare_pvs 5 10 # proper DEVRANGE needs to be set according to extent size DEVRANGE="0-32" diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh index bcf3874c6..8a84257f5 100644 --- a/test/shell/lvconvert-raid.sh +++ b/test/shell/lvconvert-raid.sh @@ -11,6 +11,9 @@ . lib/inittest +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + get_image_pvs() { local d local images diff --git a/test/shell/lvcreate-raid.sh b/test/shell/lvcreate-raid.sh index 6bbc3fe48..956ebb5a4 100644 --- a/test/shell/lvcreate-raid.sh +++ b/test/shell/lvcreate-raid.sh @@ -76,31 +76,31 @@ done # Create RAID using 100%FREE ############################ -# 6 PVs with 18.5m in each PV. +# 6 PVs with 19m in each PV. # 1 metadata LV = 1 extent = .5m -# 1 image = 36+37+37 extents = 55.00m = lv_size +# 1 image = 37+38+38 extents = 56.50m = lv_size lvcreate --type raid1 -m 1 -l 100%FREE -an -Zn -n raid1 $vg -check lv_field $vg/raid1 size "55.00m" +check lv_field $vg/raid1 size "56.50m" lvremove -ff $vg # 1 metadata LV = 1 extent -# 1 image = 36 extents -# 5 images = 180 extents = 90.00m = lv_size +# 1 image = 37 extents +# 5 images = 190 extents = 95.00m = lv_size lvcreate --type raid5 -i 5 -l 100%FREE -an -Zn -n raid5 $vg -should check lv_field $vg/raid5 size "90.00m" +should check lv_field $vg/raid5 size "95.00m" #FIXME: Currently allocates incorrectly at 87.50m lvremove -ff $vg -# 1 image = 36+37 extents -# 2 images = 146 extents = 73.00m = lv_size +# 1 image = 37+38 extents +# 2 images = 150 extents = 75.00m = lv_size lvcreate --type raid5 -i 2 -l 100%FREE -an -Zn -n raid5 $vg -check lv_field $vg/raid5 size "73.00m" +check lv_field $vg/raid5 size "75.00m" lvremove -ff $vg -# 1 image = 36 extents -# 4 images = 144 extents = 72.00m = lv_size +# 1 image = 37 extents +# 4 images = 148 extents = 74.00m = lv_size lvcreate --type raid6 -i 4 -l 100%FREE -an -Zn -n raid6 $vg -should check lv_field $vg/raid6 size "72.00m" +should check lv_field $vg/raid6 size "74.00m" #FIXME: Currnently allocates incorrectly at 70.00m lvremove -ff $vg @@ -111,9 +111,9 @@ EAT_SIZE=$(get lv_field $vg/eat_space size) # Using 100% free should take the rest of dev1 and equal from dev2 # 1 meta takes 1 extent -# 1 image = 18 extents = 9.00m = lv_size +# 1 image = 19 extents = 9.50m = lv_size lvcreate --type raid1 -m 1 -l 100%FREE -an -Zn -n raid1 $vg "$dev1" "$dev2" -check lv_field $vg/raid1 size "9.00m" +check lv_field $vg/raid1 size "9.50m" # Ensure image size is the same as the RAID1 size check lv_field $vg/raid1 size $(get lv_field $vg/raid1_rimage_0 size -a) # Amount remaining in dev2 should equal the amount taken by 'lv' in dev1 @@ -122,10 +122,10 @@ lvremove -ff $vg/raid1 # Using 100% free should take the rest of dev1 and equal amount from the rest # 1 meta takes 1 extent -# 1 image = 18 extents = 9.00m -# 5 images = 90 extents = 45.00m = lv_size +# 1 image = 19 extents = 9.50m +# 5 images = 95 extents = 47.50m = lv_size lvcreate --type raid5 -i 5 -l 100%FREE -an -Zn -n raid5 $vg -check lv_field $vg/raid5 size "45.00m" +check lv_field $vg/raid5 size "47.50m" # Amount remaining in dev6 should equal the amount taken by 'lv' in dev1 check pv_field "$dev6" pv_free "$EAT_SIZE" lvremove -ff $vg/raid5 @@ -133,26 +133,26 @@ lvremove -ff $vg/raid5 # Using 100% free should take the rest of dev1, an equal amount # from 2 more devs, and all extents from 3 additional devs # 1 meta takes 1 extent -# 1 image = 18+37 extents -# 2 images = 110 extents = 55.00m = lv_size +# 1 image = 19+39 extents +# 2 images = 114 extents = 57.00m = lv_size lvcreate --type raid5 -i 2 -l 100%FREE -an -Zn -n raid5 $vg -check lv_field $vg/raid5 size "55.00m" +check lv_field $vg/raid5 size "57.00m" lvremove -ff $vg/raid5 # Let's do some stripe tests too # Using 100% free should take the rest of dev1 and an equal amount from rest -# 1 image = 19 extents -# 6 images = 114 extents = 57.00m = lv_size +# 1 image = 20 extents +# 6 images = 120 extents = 60.00m = lv_size lvcreate -i 6 -l 100%FREE -an -Zn -n stripe $vg -check lv_field $vg/stripe size "57.00m" +check lv_field $vg/stripe size "60.00m" lvremove -ff $vg/stripe # Using 100% free should take the rest of dev1, an equal amount from # one more dev, and all of the remaining 4 -# 1 image = 19+37+37 extents -# 2 images = 186 extents = 93.00m = lv_size +# 1 image = 20+38+38 extents +# 2 images = 192 extents = 96.00m = lv_size lvcreate -i 2 -l 100%FREE -an -Zn -n stripe $vg -check lv_field $vg/stripe size "93.00m" +check lv_field $vg/stripe size "96.00m" lvremove -ff $vg # end of use of '$vg/eat_space' diff --git a/test/shell/lvcreate-raid10.sh b/test/shell/lvcreate-raid10.sh index e334bd14a..5f22a2d40 100644 --- a/test/shell/lvcreate-raid10.sh +++ b/test/shell/lvcreate-raid10.sh @@ -50,11 +50,11 @@ aux wait_for_sync $vg $lv2 lvremove -ff $vg # Test 100%FREE option -# 37 extents / device -# 1 image = 36 extents (1 for meta) -# 3 images = 108 extents = 54.00m +# 38 extents / device +# 1 image = 37 extents (1 for meta) +# 3 images = 111 extents = 55.50m lvcreate --type raid10 -i 3 -l 100%FREE -an -Zn -n raid10 $vg -check lv_field $vg/raid10 size "54.00m" +check lv_field $vg/raid10 size "55.50m" lvremove -ff $vg # Create RAID (implicit stripe count based on PV count) diff --git a/test/shell/lvextend-snapshot-dmeventd.sh b/test/shell/lvextend-snapshot-dmeventd.sh index 3d9ce1f26..448df9645 100644 --- a/test/shell/lvextend-snapshot-dmeventd.sh +++ b/test/shell/lvextend-snapshot-dmeventd.sh @@ -26,7 +26,7 @@ percent_() { wait_for_change_() { # dmeventd only checks every 10 seconds :( - for i in $(seq 1 15) ; do + for i in $(seq 1 25) ; do test "$(percent_)" != "$1" && return sleep 1 done diff --git a/test/shell/mirror-vgreduce-removemissing.sh b/test/shell/mirror-vgreduce-removemissing.sh index fd7169659..88913696b 100644 --- a/test/shell/mirror-vgreduce-removemissing.sh +++ b/test/shell/mirror-vgreduce-removemissing.sh @@ -14,6 +14,9 @@ test_description="ensure that 'vgreduce --removemissing' works on mirrored LV" . lib/inittest +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + lv_is_on_ () { local lv=$vg/$1 diff --git a/test/shell/process-each-lv.sh b/test/shell/process-each-lv.sh index 0260951ca..355e92edf 100644 --- a/test/shell/process-each-lv.sh +++ b/test/shell/process-each-lv.sh @@ -13,6 +13,9 @@ test_description='Exercise toollib process_each_lv' . lib/inittest +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + aux prepare_devs 10 # diff --git a/test/shell/pvmove-basic.sh b/test/shell/pvmove-basic.sh index c326dc3d1..e5add05d0 100644 --- a/test/shell/pvmove-basic.sh +++ b/test/shell/pvmove-basic.sh @@ -16,6 +16,9 @@ test_description="ensure that pvmove works with basic options" which md5sum || skip +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + # --------------------------------------------------------------------- # Utilities @@ -355,4 +358,4 @@ else fi lvremove -ff $vg -done
\ No newline at end of file +done diff --git a/test/shell/pvmove-restart.sh b/test/shell/pvmove-restart.sh index effa43daf..b4a28938f 100644 --- a/test/shell/pvmove-restart.sh +++ b/test/shell/pvmove-restart.sh @@ -40,8 +40,7 @@ wait # Simulate reboot - forcibly remove related devices dmsetup table -dmsetup remove $vg-$lv1 -dmsetup remove "$DM_DEV_DIR/mapper/$vg-pvmove0" +dmsetup ls --exec echo | egrep '$vg-$lv1|$vg-pvmove0' | xargs -r -n 1 dmsetup remove # Check we really have pvmove volume check lv_attr_bit type $vg/pvmove0 "p" diff --git a/test/shell/vgsplit-operation.sh b/test/shell/vgsplit-operation.sh index 8081b3821..6b478e802 100644 --- a/test/shell/vgsplit-operation.sh +++ b/test/shell/vgsplit-operation.sh @@ -13,6 +13,9 @@ . lib/inittest +# disable lvmetad logging as it bogs down test systems +test -e LOCAL_LVMETAD && aux prepare_lvmetad "" + COMM() { LAST_TEST="$@" } |