mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
tests: runner better handle help messages
Postpone check for root uuid so we can print help message.
This commit is contained in:
parent
cf6cbfb7f7
commit
dfa74465e9
@ -177,7 +177,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static void _fsync_name( std::string n )
|
||||
static void _fsync_name( const std::string &n )
|
||||
{
|
||||
int fd = open( n.c_str(), O_WRONLY );
|
||||
if ( fd >= 0 ) {
|
||||
@ -1400,7 +1400,7 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO
|
||||
Options opt;
|
||||
const char *env;
|
||||
|
||||
if ( args.has( "--help" ) ) {
|
||||
if ( args.has( "--help" ) || args.has( "-h" ) || args.has( "-?" ) ) {
|
||||
std::cout <<
|
||||
" lvm2-testsuite - Run a lvm2 testsuite.\n\n"
|
||||
"lvm2-testsuite"
|
||||
@ -1538,6 +1538,11 @@ static int run( int argc, const char **argv, std::string fl_envvar = "TEST_FLAVO
|
||||
opt.workdir = resolve_path( args.opt( "--workdir" ), opt.testdir.c_str() );
|
||||
opt.outdir = resolve_path( args.opt( "--outdir" ), "." );
|
||||
|
||||
if (getuid() != 0) {
|
||||
std::cout << "Skipping tests, root is required, current UID: " << getuid() << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
setup_handlers();
|
||||
|
||||
Main main( opt );
|
||||
|
@ -29,12 +29,6 @@
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
|
||||
if (getuid() != 0) {
|
||||
std::cout << "Skipping tests, root is required, current UID: " << getuid() << "\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
try {
|
||||
return brick::shelltest::run( argc, argv, "LVM_TEST_FLAVOUR" );
|
||||
} catch (std::exception const& e) {
|
||||
|
Loading…
Reference in New Issue
Block a user