The branch, master has been updated
       via  f6d3e1117ff smbtorture: use torture_assert_ntstatus_equal_goto() in 
CHECK_STATUS() in unlink.c
       via  3a32246bf25 smbtorture: move hardlink test in test_ntrename() to 
its own test
       via  83bca29e9df smbtorture: remove more allocation size checks
      from  23ddfd3b03e lib/util: Include grp.h for setgroups during autoconf

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f6d3e1117ff28cbca29ea2b91167b2fda1d6bd64
Author: Ralph Boehme <[email protected]>
Date:   Sat Nov 2 16:49:41 2024 +0200

    smbtorture: use torture_assert_ntstatus_equal_goto() in CHECK_STATUS() in 
unlink.c
    
    fixup
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>
    
    Autobuild-User(master): Anoop C S <[email protected]>
    Autobuild-Date(master): Mon Nov 11 14:01:18 UTC 2024 on atb-devel-224

commit 3a32246bf251f0b765da70d6eab293fb89d733f5
Author: Ralph Boehme <[email protected]>
Date:   Fri Nov 8 14:13:28 2024 +0100

    smbtorture: move hardlink test in test_ntrename() to its own test
    
    Some filesystems may not support hardlinks.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

commit 83bca29e9dfc7f7f3e70067de1118ef5971e9646
Author: Ralph Boehme <[email protected]>
Date:   Fri Nov 8 13:09:15 2024 +0100

    smbtorture: remove more allocation size checks
    
    If the requested allocation size was 0, the resulting allocation size may be
    larger due to xattrs and other filesystem dependent factors.
    
    Cf commits fba4b290856faaf17305103efc65f6383ea4f61c and
    55b2f247f9ba56516efba52481418966a777343e.
    
    Signed-off-by: Ralph Boehme <[email protected]>
    Reviewed-by: Anoop C S <[email protected]>

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/raw/open.c   |  5 ---
 source4/torture/raw/rename.c | 96 +++++++++++++++++++++++++++++---------------
 source4/torture/raw/unlink.c |  9 +----
 3 files changed, 65 insertions(+), 45 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index f4eeb4e8c6e..69b698d5ea0 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -835,7 +835,6 @@ static bool test_ntcreatex(struct torture_context *tctx, 
struct smbcli_state *cl
        CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
        CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
                  FILE_ATTRIBUTE_DIRECTORY);
-       CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
        CHECK_ALL_INFO(io.ntcreatex.out.size, size);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.is_directory, 1);
@@ -1107,7 +1106,6 @@ static bool test_nttrans_create(struct torture_context 
*tctx, struct smbcli_stat
        CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
        CHECK_VAL(io.ntcreatex.out.attrib & ~FILE_ATTRIBUTE_NONINDEXED,
                  FILE_ATTRIBUTE_DIRECTORY);
-       CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
        CHECK_ALL_INFO(io.ntcreatex.out.size, size);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.is_directory, 1);
@@ -2161,7 +2159,6 @@ static bool test_ntcreatex_supersede(struct 
torture_context *tctx, struct smbcli
        CHECK_NTTIME(io.ntcreatex.out.write_time, write_time);
        CHECK_NTTIME(io.ntcreatex.out.change_time, change_time);
        CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
-       CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
        CHECK_ALL_INFO(io.ntcreatex.out.size, size);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
@@ -2189,7 +2186,6 @@ static bool test_ntcreatex_supersede(struct 
torture_context *tctx, struct smbcli
        CHECK_NTTIME(io.ntcreatex.out.write_time, write_time);
        CHECK_NTTIME(io.ntcreatex.out.change_time, change_time);
        CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
-       CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
        CHECK_VAL(io.ntcreatex.out.size, 512);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
@@ -2213,7 +2209,6 @@ static bool test_ntcreatex_supersede(struct 
torture_context *tctx, struct smbcli
        CHECK_NTTIME(io.ntcreatex.out.create_time, create_time);
        CHECK_NTTIME(io.ntcreatex.out.access_time, access_time);
        CHECK_ALL_INFO(io.ntcreatex.out.attrib, attrib);
-       CHECK_ALL_INFO(io.ntcreatex.out.alloc_size, alloc_size);
        CHECK_ALL_INFO(io.ntcreatex.out.is_directory, directory);
        CHECK_VAL(io.ntcreatex.out.file_type, FILE_TYPE_DISK);
 done:
diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 16945615587..92b4d1e7838 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -303,39 +303,6 @@ static bool test_ntrename(struct torture_context *tctx,
 
        torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
 
-       torture_comment(tctx, "Checking hard link\n");
-       io.ntrename.in.old_name = fname1;
-       io.ntrename.in.new_name = fname2;
-       io.ntrename.in.attrib = 0;
-       io.ntrename.in.flags = RENAME_FLAG_HARD_LINK;
-       status = smb_raw_rename(cli->tree, &io);
-       CHECK_STATUS(status, NT_STATUS_OK);
-
-       torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_SYSTEM);
-
-       finfo.generic.level = RAW_FILEINFO_ALL_INFO;
-       finfo.generic.in.file.path = fname2;
-       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
-       CHECK_STATUS(status, NT_STATUS_OK);
-       CHECK_VALUE(finfo.all_info.out.nlink, 2);
-       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
-
-       finfo.generic.in.file.path = fname1;
-       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
-       CHECK_STATUS(status, NT_STATUS_OK);
-       CHECK_VALUE(finfo.all_info.out.nlink, 2);
-       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
-
-       torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
-
-       smbcli_unlink(cli->tree, fname2);
-
-       finfo.generic.in.file.path = fname1;
-       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
-       CHECK_STATUS(status, NT_STATUS_OK);
-       CHECK_VALUE(finfo.all_info.out.nlink, 1);
-       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
-
        torture_comment(tctx, "Checking copy\n");
        io.ntrename.in.old_name = fname1;
        io.ntrename.in.new_name = fname2;
@@ -500,6 +467,68 @@ done:
        return ret;
 }
 
+/*
+  test SMBntrename ops
+*/
+static bool test_nthardlink(struct torture_context *tctx,
+                           struct smbcli_state *cli)
+{
+       union smb_rename io = {};
+       NTSTATUS status;
+       bool ret = true;
+       int fnum;
+       const char *fname1 = BASEDIR "\\test1.txt";
+       const char *fname2 = BASEDIR "\\test2.txt";
+       union smb_fileinfo finfo = {};
+
+       torture_comment(tctx, "Testing SMBnthardlink\n");
+
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR), "Failed to setup 
up test directory: " BASEDIR);
+
+       fnum = create_complex_file(cli, tctx, fname1);
+       status = smbcli_close(cli->tree, fnum);
+       CHECK_STATUS(status, NT_STATUS_OK);
+
+       torture_comment(tctx, "Checking hard link\n");
+       io.generic.level = RAW_RENAME_NTRENAME;
+       io.ntrename.in.old_name = fname1;
+       io.ntrename.in.new_name = fname2;
+       io.ntrename.in.attrib = 0;
+       io.ntrename.in.flags = RENAME_FLAG_HARD_LINK;
+       status = smb_raw_rename(cli->tree, &io);
+       CHECK_STATUS(status, NT_STATUS_OK);
+
+       torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_SYSTEM);
+
+       finfo.generic.level = RAW_FILEINFO_ALL_INFO;
+       finfo.generic.in.file.path = fname2;
+       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VALUE(finfo.all_info.out.nlink, 2);
+       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
+
+       finfo.generic.in.file.path = fname1;
+       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VALUE(finfo.all_info.out.nlink, 2);
+       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_SYSTEM);
+
+       torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
+
+       smbcli_unlink(cli->tree, fname2);
+
+       finfo.generic.in.file.path = fname1;
+       status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VALUE(finfo.all_info.out.nlink, 1);
+       CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
+
+done:
+       smb_raw_exit(cli->session);
+       smbcli_deltree(cli->tree, BASEDIR);
+       return ret;
+}
+
 /*
   test dir rename.
 */
@@ -685,6 +714,7 @@ struct torture_suite *torture_raw_rename(TALLOC_CTX 
*mem_ctx)
        torture_suite_add_2smb_test(suite, "trans2rename", test_trans2rename);
        torture_suite_add_1smb_test(suite, "nttransrename", test_nttransrename);
        torture_suite_add_1smb_test(suite, "ntrename", test_ntrename);
+       torture_suite_add_1smb_test(suite, "nthardlink", test_nthardlink);
        torture_suite_add_1smb_test(suite, "osxrename", test_osxrename);
        torture_suite_add_1smb_test(suite, "directory rename", test_dir_rename);
 
diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c
index 061ebe0e041..77cbb4acb61 100644
--- a/source4/torture/raw/unlink.c
+++ b/source4/torture/raw/unlink.c
@@ -26,13 +26,8 @@
 #include "torture/util.h"
 #include "torture/raw/proto.h"
 
-#define CHECK_STATUS(status, correct) do { \
-       if (!NT_STATUS_EQUAL(status, correct)) { \
-               printf("(%s) Incorrect status %s - should be %s\n", \
-                      __location__, nt_errstr(status), nt_errstr(correct)); \
-               ret = false; \
-               goto done; \
-       }} while (0)
+#define CHECK_STATUS(status, correct) \
+       torture_assert_ntstatus_equal_goto(tctx, status, correct, ret, done, 
__location__)
 
 #define BASEDIR "\\testunlink"
 


-- 
Samba Shared Repository

Reply via email to