diff options
author | Andrew Bartlett <abartlet@samba.org> | 2012-05-18 15:43:31 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2012-05-18 09:35:13 +0200 |
commit | 45082a88c7aaaa928ca36003ade071aafe4de54d (patch) | |
tree | 2800e5aaff2da77f5156e12a8bba5e765e794e35 /source4/torture/basic | |
parent | 8c52d1b8ac7d56eb728e4cc4ed2a560365d374b5 (diff) | |
download | samba-45082a88c7aaaa928ca36003ade071aafe4de54d.tar.gz samba-45082a88c7aaaa928ca36003ade071aafe4de54d.tar.bz2 samba-45082a88c7aaaa928ca36003ade071aafe4de54d.zip |
s4-torture: Improve torture test boilerplate, use torture_assert()
This ensures that if this fails, it is reported as a subunit error correctly.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri May 18 09:35:13 CEST 2012 on sn-devel-104
Diffstat (limited to 'source4/torture/basic')
-rw-r--r-- | source4/torture/basic/delaywrite.c | 64 | ||||
-rw-r--r-- | source4/torture/basic/disconnect.c | 4 | ||||
-rw-r--r-- | source4/torture/basic/locking.c | 4 |
3 files changed, 18 insertions, 54 deletions
diff --git a/source4/torture/basic/delaywrite.c b/source4/torture/basic/delaywrite.c index 939827ec3c..15482d8bc0 100644 --- a/source4/torture/basic/delaywrite.c +++ b/source4/torture/basic/delaywrite.c @@ -54,9 +54,7 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl torture_comment(tctx, "\nRunning test_delayed_write_update\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -148,9 +146,7 @@ static bool test_delayed_write_update1(struct torture_context *tctx, struct smbc torture_comment(tctx, "\nRunning test_delayed_write_update1\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -339,9 +335,7 @@ static bool test_delayed_write_update1a(struct torture_context *tctx, struct smb torture_comment(tctx, "\nRunning test_delayed_write_update1a\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -521,9 +515,7 @@ static bool test_delayed_write_update1b(struct torture_context *tctx, struct smb torture_comment(tctx, "\nRunning test_delayed_write_update1b\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -696,9 +688,7 @@ static bool test_delayed_write_update1c(struct torture_context *tctx, struct smb torture_comment(tctx, "\nRunning test_delayed_write_update1c\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -878,9 +868,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc torture_comment(tctx, "\nRunning test_delayed_write_update2\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -1237,9 +1225,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s torture_comment(tctx, "\nRunning test_finfo_after_write\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); if (fnum1 == -1) { @@ -1511,9 +1497,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update3\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -1665,9 +1649,7 @@ static bool test_delayed_write_update3a(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update3a\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -1878,9 +1860,7 @@ static bool test_delayed_write_update3b(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update3b\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -2044,9 +2024,7 @@ static bool test_delayed_write_update3c(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update3c\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -2254,9 +2232,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update4\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -2413,9 +2389,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update5\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -2575,9 +2549,7 @@ static bool test_delayed_write_update5b(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update5b\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -2743,9 +2715,7 @@ static bool test_delayed_write_update6(struct torture_context *tctx, torture_comment(tctx, "\nRunning test_delayed_write_update6\n"); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); again: torture_comment(tctx, "Open the file handle\n"); fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); @@ -3001,9 +2971,7 @@ static bool test_delayed_write_update7(struct torture_context *tctx, struct smbc ZERO_STRUCT(finfo3); ZERO_STRUCT(open_parms); - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); /* Create the file. */ fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE); diff --git a/source4/torture/basic/disconnect.c b/source4/torture/basic/disconnect.c index 17fbc61d2f..7fb87d81fc 100644 --- a/source4/torture/basic/disconnect.c +++ b/source4/torture/basic/disconnect.c @@ -151,9 +151,7 @@ bool torture_disconnect(struct torture_context *torture) return false; } - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(torture, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); for (i=0;i<torture_numops;i++) { ret &= test_disconnect_lock(cli, mem_ctx); diff --git a/source4/torture/basic/locking.c b/source4/torture/basic/locking.c index 1c0a94e591..98def5c09c 100644 --- a/source4/torture/basic/locking.c +++ b/source4/torture/basic/locking.c @@ -646,9 +646,7 @@ static bool torture_locktest6(struct torture_context *tctx, int fnum; NTSTATUS status; - if (!torture_setup_dir(cli, BASEDIR)) { - return false; - } + torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup up test directory: " BASEDIR); for (i=0;i<1;i++) { torture_comment(tctx, "Testing %s\n", fname[i]); |