s4:smbtorture do not leave output directory around
authorChristian Ambach <christian.ambach@de.ibm.com>
Fri, 18 Feb 2011 14:02:35 +0000 (15:02 +0100)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 21 Feb 2011 10:35:30 +0000 (11:35 +0100)
calling smbtorture with no or invalid arguments left the temporary
output directory around
this patches removes the dead-end exit from usage and makes the
logic go on until the final cleanup state is reached

output directory will still be left around when test times out
or testcases itself force an exit

also make sure that the directory itself is deleted, not just
the objects in it

Signed-off-by: Matthias Dieter Wallnöfer <mdw@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org>
Autobuild-Date: Mon Feb 21 11:35:30 CET 2011 on sn-devel-104

lib/torture/torture.c
source4/torture/smbtorture.c

index a12ce657ba288c6e6db5b9c167bf4613133215c6..a0b35bfe7ca7baf540841904ab809d7fd33f7099 100644 (file)
@@ -138,6 +138,7 @@ static int local_deltree(const char *path)
                }
        }
        closedir(dir);
+       rmdir(path);
        return ret;
 }
 
index cfa8b0f87db2a2df8f9b6471371bd3cd57d4c96a..62cf0abfb7072786deeccc6e6cac38b51d14d215 100644 (file)
@@ -285,7 +285,7 @@ void torture_print_testsuites(bool structured)
        }
 }
 
-_NORETURN_ static void usage(poptContext pc)
+static void usage(poptContext pc)
 {
        poptPrintUsage(pc, stdout, 0);
        printf("\n");
@@ -341,7 +341,6 @@ _NORETURN_ static void usage(poptContext pc)
 
        print_structured_testsuite_list();
 
-       exit(1);
 }
 
 _NORETURN_ static void max_runtime_handler(int sig)
@@ -702,19 +701,17 @@ int main(int argc,char *argv[])
                if (argc_new < 3) {
                        printf("You must specify a test to run, or 'ALL'\n");
                        usage(pc);
-                       exit(1);
-               }
-
+                       torture->results->returncode = 1;
+               } else if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
                /* Take the target name or binding. */
-               if (!torture_parse_target(cmdline_lp_ctx, argv_new[1])) {
                        usage(pc);
-                       exit(1);
-               }
-
-               for (i=2;i<argc_new;i++) {
-                       if (!torture_run_named_tests(torture, argv_new[i],
-                                   (const char **)restricted)) {
-                               correct = false;
+                       torture->results->returncode = 1;
+               } else {
+                       for (i=2;i<argc_new;i++) {
+                               if (!torture_run_named_tests(torture, argv_new[i],
+                                           (const char **)restricted)) {
+                                       correct = false;
+                               }
                        }
                }
        }