1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

test: Fix handling of envvars in the runner.

This commit is contained in:
Petr Rockai 2014-06-27 01:03:08 +02:00
parent 0bd2a9b7b1
commit f3bf89ebcc

View File

@ -391,6 +391,15 @@ struct Args {
} }
}; };
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;
}
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
Args args( argc, argv ); Args args( argc, argv );
@ -399,17 +408,17 @@ int main(int argc, char **argv)
if ( args.has( "--continue" ) ) if ( args.has( "--continue" ) )
opt.cont = true; opt.cont = true;
if ( args.has( "--quiet" ) || getenv( "QUIET" ) ) { if ( args.has( "--quiet" ) || hasenv( "QUIET" ) ) {
opt.verbose = false; opt.verbose = false;
opt.quiet = true; opt.quiet = true;
} }
if ( args.has( "--verbose" ) || getenv( "VERBOSE" ) ) { if ( args.has( "--verbose" ) || hasenv( "VERBOSE" ) ) {
opt.quiet = false; opt.quiet = false;
opt.verbose = true; opt.verbose = true;
} }
if ( args.has( "--interactive" ) || getenv( "INTERACTIVE" ) ) { if ( args.has( "--interactive" ) || hasenv( "INTERACTIVE" ) ) {
opt.verbose = false; opt.verbose = false;
opt.quiet = false; opt.quiet = false;
opt.interactive = true; opt.interactive = true;