]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: The teardown function should just return
authorAndreas Schneider <asn@samba.org>
Tue, 8 Aug 2017 10:05:24 +0000 (12:05 +0200)
committerKarolin Seeger <kseeger@samba.org>
Mon, 28 Aug 2017 13:19:58 +0000 (15:19 +0200)
The teardown functions should not return on error but finish cleaning
up!

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12984

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit c90069b26424752b15922de9cb796c431d2f3e08)

Autobuild-User(v4-7-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-7-test): Mon Aug 28 15:19:58 CEST 2017 on sn-devel-144

source4/torture/rpc/spoolss.c

index 2f60383e0e60b64f98669cedbe20aeb018f6768e..d4f69698d96f2f746ba37ce7bd86409e2a91266a 100644 (file)
@@ -8576,6 +8576,7 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context *
        struct dcerpc_pipe *p = t->spoolss_pipe;
        struct dcerpc_binding_handle *b = NULL;
        const char *server_name_slash;
+       bool ok = true;
 
        if (p == NULL) {
                return true;
@@ -8587,36 +8588,52 @@ static bool torture_rpc_spoolss_printer_teardown_common(struct torture_context *
        if (!t->wellknown) {
                const char *printer_name = t->info2.printername;
 
-               torture_assert(tctx,
+               torture_assert_goto(tctx,
                        test_DeletePrinter(tctx, b, &t->handle),
+                       ok,
+                       remove_driver,
                        "failed to delete printer");
 
-               torture_assert(tctx,
+               torture_assert_goto(tctx,
                        test_EnumPrinters_findname(tctx, b, PRINTER_ENUM_LOCAL, 1,
                                                   printer_name, &found),
+                       ok,
+                       remove_driver,
                        "failed to enumerate printers");
 
-               torture_assert(tctx, !found, "deleted printer still there");
+               torture_assert_goto(tctx,
+                       !found,
+                       ok,
+                       remove_driver,
+                       "deleted printer still there");
        }
 
 
+remove_driver:
        if (t->added_driver) {
-               torture_assert(tctx,
-                       remove_printer_driver(tctx, dcerpc_server_name(p), &t->driver),
-                       "failed to remove printer driver");
+               ok = remove_printer_driver(tctx,
+                                          dcerpc_server_name(p),
+                                          &t->driver);
+               if (!ok) {
+                       torture_warning(tctx,
+                                       "failed to remove printer driver\n");
+               }
 
-               torture_assert(tctx,
-                       test_DeletePrinterDriverEx_exp(tctx, b,
-                                                      server_name_slash,
-                                                      t->driver.info8.driver_name,
-                                                      t->driver.info8.architecture,
-                                                      DPD_DELETE_ALL_FILES,
-                                                      t->driver.info8.version,
-                                                      WERR_OK),
-                       "failed to delete printer driver via spoolss");
+               ok = test_DeletePrinterDriverEx_exp(tctx, b,
+                                                   server_name_slash,
+                                                   t->driver.info8.driver_name,
+                                                   t->driver.info8.architecture,
+                                                   DPD_DELETE_ALL_FILES,
+                                                   t->driver.info8.version,
+                                                   WERR_OK);
+               if (!ok) {
+                       torture_warning(tctx,
+                                       "failed to delete printer driver via "
+                                       "spoolss\n");
+               }
        }
 
-       return true;
+       return ok;
 }
 
 static bool torture_rpc_spoolss_printer_teardown(struct torture_context *tctx, void *data)