1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-09-26 01:44:19 +03:00

Compare commits

...

5 Commits

Author SHA1 Message Date
Marian Csontos
591b360187 test: Help, default and relative paths in runner
Add help message.
Handle relative paths first.
Use `.` for OUTDIR instead of `/` if empty.
2015-07-17 16:55:08 +02:00
Marian Csontos
2945341047 test: Fix hardcoded /usr/share in testsuite 2015-07-17 15:47:38 +02:00
Marian Csontos
8c6c261b6d debug: Make the debug message less scary. 2015-07-17 15:47:38 +02:00
Marian Csontos
3d696a4417 test: Print stacks for all threads
May be useful in case of deadlocks...
2015-07-17 15:47:38 +02:00
Marian Csontos
550c1847e5 log: Empty LVM_LOG_FILE_EPOCH handling
When env.variable is set to empty getenv returns pointer to empty
string.

In tests it is expected this will produce undecorated debug.log instead
of debug.log__*
2015-07-17 15:47:38 +02:00
9 changed files with 149 additions and 28 deletions

View File

@@ -1,5 +1,6 @@
Version 2.02.126 -
================================
Change handling empty LVM_LOG_FILE_EPOCH.
Fix alloc segfault when extending LV with fewer stripes than in first seg.
Fix handling of cache policy name.
Set cache policy before with the first lvm2 cache pool metadata commit.

14
configure vendored
View File

@@ -649,6 +649,7 @@ UDEV_SYNC
UDEV_RULES
UDEV_PC
THIN
TESTSUITE_DATA
TESTING
STATIC_LINK
STATICDIR
@@ -7351,6 +7352,9 @@ $as_echo "$ac_cv_flag_HAVE_FULL_RELRO" >&6; }
################################################################################
if test "$prefix" = NONE; then
datarootdir=${ac_default_prefix}/share
fi
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking file owner" >&5
@@ -10812,6 +10816,16 @@ $as_echo "yes" >&6; }
fi
fi
################################################################################
TESTSUITE_DATA='${datarootdir}/lvm2-testsuite'
# double eval needed ${datarootdir} -> ${prefix}/share -> real path
cat >>confdefs.h <<_ACEOF
#define TESTSUITE_DATA "$(eval echo $(eval echo $TESTSUITE_DATA))"
_ACEOF
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable valgrind awareness of pools" >&5
$as_echo_n "checking whether to enable valgrind awareness of pools... " >&6; }

View File

@@ -174,6 +174,9 @@ AC_SUBST(HAVE_FULL_RELRO)
################################################################################
dnl -- Prefix is /usr by default, the exec_prefix default is setup later
AC_PREFIX_DEFAULT(/usr)
if test "$prefix" = NONE; then
datarootdir=${ac_default_prefix}/share
fi
################################################################################
dnl -- Setup the ownership of the files
@@ -1061,6 +1064,13 @@ if test "$TESTING" = yes; then
PKG_CHECK_MODULES(CUNIT, cunit >= 2.0)
fi
################################################################################
dnl -- Set LVM2 testsuite data
TESTSUITE_DATA='${datarootdir}/lvm2-testsuite'
# double eval needed ${datarootdir} -> ${prefix}/share -> real path
AC_DEFINE_UNQUOTED(TESTSUITE_DATA, ["$(eval echo $(eval echo $TESTSUITE_DATA))"], [Path to testsuite data])
################################################################################
dnl -- Enable valgrind awareness of memory pools
AC_MSG_CHECKING(whether to enable valgrind awareness of pools)
@@ -1971,6 +1981,7 @@ AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
AC_SUBST(STATIC_LINK)
AC_SUBST(TESTING)
AC_SUBST(TESTSUITE_DATA)
AC_SUBST(THIN)
AC_SUBST(THIN_CHECK_CMD)
AC_SUBST(THIN_DUMP_CMD)

View File

@@ -74,7 +74,7 @@ void init_log_file(const char *log_file, int append)
int i = 0;
_log_file_path[0] = '\0';
if ((env = getenv("LVM_LOG_FILE_EPOCH"))) {
if ((env = getenv("LVM_LOG_FILE_EPOCH")) && env[0]) {
while (isalpha(env[i]) && i < 32) /* Up to 32 alphas */
i++;
if (env[i]) {

View File

@@ -632,6 +632,9 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Path to testsuite data */
#undef TESTSUITE_DATA
/* The path to 'thin_check', if available. */
#undef THIN_CHECK_CMD

View File

@@ -539,8 +539,8 @@ Path to the socket used to communicate with lvmpolld..
.TP
.B LVM_LOG_FILE_EPOCH
A string of up to 32 letters appended to the log filename and
followed by the process ID and a timestamp. When set, each process logs to a
separate file.
followed by the process ID and a timestamp. When set and non empty, each
process logs to a separate file.
.TP
.B LVM_EXPECTED_EXIT_STATUS
The status anticipated when the process exits. Use ">N" to match any

View File

@@ -79,6 +79,8 @@
#include <unistd.h>
#endif
#include "configure.h"
#ifndef BRICK_SHELLTEST_H
#define BRICK_SHELLTEST_H
@@ -1088,6 +1090,7 @@ struct Args {
return std::find( args.begin(), args.end(), fl ) != args.end();
}
// TODO: This does not handle `--option=VALUE`:
std::string opt( std::string fl ) {
V::iterator i = std::find( args.begin(), args.end(), fl );
if ( i == args.end() || i + 1 == args.end() )
@@ -1117,11 +1120,88 @@ void split( std::string s, C &c ) {
}
const char *DEF_FLAVOURS="ndev-vanilla";
std::string resolve_path(std::string a_path, const char *default_path=".")
{
char temp[PATH_MAX];
const char *p;
p = a_path.empty() ? default_path : a_path.c_str();
if ( !realpath( p, temp ) )
throw syserr( "Failed to resolve path", p );
return temp;
}
static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVOUR" )
{
Args args( argc, argv );
Options opt;
if ( args.has( "--help" ) ) {
std::cout <<
" lvm2-testsuite - Run a lvm2 testsuite.\n\n"
"lvm2-testsuite"
"\n\t"
" [--flavours FLAVOURS]"
" [--only TESTS]"
"\n\t"
" [--outdir OUTDIR]"
" [--testdir TESTDIR]"
" [--workdir WORKDIR]"
"\n\t"
" [--batch|--verbose|--interactive]"
"\n\t"
" [--fatal-timeouts]"
" [--continue]"
" [--heartbeat]"
" [--watch WATCH]"
" [--timeout TIMEOUT]"
" [--nokmsg]\n\n"
/* TODO: list of flavours:
"lvm2-testsuite"
"\n\t"
" --list-flavours [--testdir TESTDIR]"
*/
"\n\n"
"OPTIONS:\n\n"
// TODO: looks like this could be worth a man page...
"Filters:\n"
" --flavours FLAVOURS\n\t\t- comma separated list of flavours to run.\n\t\t For the list of flavours see `$TESTDIR/lib/flavour-*`.\n\t\t Default: \"" << DEF_FLAVOURS << "\".\n"
" --only TESTS\t- comma separated list of tests to run. Default: All tests.\n"
"\n"
"Directories:\n"
" --testdir TESTDIR\n\t\t- directory where tests reside. Default: \"" TESTSUITE_DATA "\".\n"
" --workdir WORKDIR\n\t\t- directory to change to when running tests.\n\t\t This is directory containing testing libs. Default: TESTDIR.\n"
" --outdir OUTDIR\n\t\t- directory where all the output files should go. Default: \".\".\n"
"\n"
"Formatting:\n"
" --batch\t- Brief format for automated runs.\n"
" --verbose\t- More verbose format for automated runs displaying progress on stdout.\n"
" --interactive\t- Verbose format for interactive runs.\n"
"\n"
"Other:\n"
" --fatal-timeouts\n\t\t- exit after encountering 2 timeouts in a row.\n"
" --continue\t- If set append to journal. Otherwise it will be overwritten.\n"
" --heartbeat HEARTBEAT\n\t\t- Name of file to update periodicaly while running.\n"
" --watch WATCH\t- Comma separated list of files to watch and print.\n"
" --timeout TIMEOUT\n\t\t- Period of silence in seconds considered a timeout. Default: 180.\n"
" --nokmsg\t- Do not try to read kernel messages.\n"
"\n\n"
"ENV.VARIABLES:\n\n"
" T\t\t- see --only\n"
" INTERACTIVE\t- see --interactive\n"
" VERBOSE\t- see --verbose\n"
" BATCH\t\t- see --batch\n"
" LVM_TEST_CAN_CLOBBER_DMESG\n\t\t- when set and non-empty tests are allowed to flush\n\t\t kmsg in an attempt to read it."
"\n\n"
"FORMATS:\n\n"
"When multiple formats are specified interactive overrides verbose\n"
"which overrides batch. Command line options override environment\n"
"variables.\n\n"
;
return 0;
}
opt.flavour_envvar = fl_envvar;
if ( args.has( "--continue" ) )
@@ -1138,26 +1218,44 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO
if ( args.has( "--heartbeat" ) )
opt.heartbeat = args.opt( "--heartbeat" );
if ( args.has( "--batch" ) || hasenv( "BATCH" ) ) {
opt.verbose = false;
opt.batch = true;
}
if ( args.has( "--batch" ) || args.has( "--verbose" ) || args.has( "--interactive" ) ) {
if ( args.has( "--batch" ) ) {
opt.verbose = false;
opt.batch = true;
}
if ( args.has( "--verbose" ) || hasenv( "VERBOSE" ) ) {
opt.batch = false;
opt.verbose = true;
}
if ( args.has( "--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( "--interactive" ) ) {
opt.verbose = false;
opt.batch = false;
opt.interactive = true;
}
} else {
if ( hasenv( "BATCH" ) ) {
opt.verbose = false;
opt.batch = true;
}
if ( hasenv( "VERBOSE" ) ) {
opt.batch = false;
opt.verbose = true;
}
if ( 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" );
split( DEF_FLAVOURS, opt.flavours );
if ( args.has( "--watch" ) )
split( args.opt( "--watch" ), opt.watch );
@@ -1168,17 +1266,9 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO
if ( args.has( "--nokmsg" ) )
opt.kmsg = false;
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 += "/";
opt.testdir = resolve_path( args.opt( "--testdir" ), TESTSUITE_DATA ) + "/";
opt.workdir = resolve_path( args.opt( "--workdir" ), opt.testdir.c_str() );
opt.outdir = resolve_path( args.opt( "--outdir" ), "." );
setup_handlers();

View File

@@ -126,6 +126,8 @@ STACKTRACE() {
if which gdb &>/dev/null; then
echo bt full > gdb_commands.txt
echo l >> gdb_commands.txt
echo thread apply all bt full >> gdb_commands.txt
echo thread apply all l >> gdb_commands.txt
echo quit >> gdb_commands.txt
for core in $(ls core* 2>/dev/null); do
bin=$(gdb -batch -c "$core" 2>&1 | grep "generated by" | \

View File

@@ -1548,7 +1548,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
goto_out;
_apply_settings(cmd);
if (cmd->degraded_activation)
log_debug("DEGRADED MODE. Incomplete RAID LVs will be processed.");
log_debug("Processing of incomplete RAID LVs enabled.");
if (!get_activation_monitoring_mode(cmd, &monitoring))
goto_out;