[Pkg-samba-maint] [Git][samba-team/samba][master] 8 commits: * d/t/smbclient-anonymous-share-list: add set -x and set -e

Mathieu Parent gitlab at salsa.debian.org
Tue Dec 15 21:16:49 GMT 2020



Mathieu Parent pushed to branch master at Debian Samba Team / samba


Commits:
e11f81ff by Andreas Hasenack at 2020-08-13T09:26:18-03:00
  * d/t/smbclient-anonymous-share-list: add set -x and set -e

- - - - -
1d624ebd by Andreas Hasenack at 2020-08-13T09:26:18-03:00
  * Factor out common DEP8 test code into d/t/util and change the tests
    to source from it:
    - d/t/util: added
    - d/t/cifs-share-access, d/t/smbclient-share-access: source from
      util, use random share name and add set -x and set -u
    - d/t/smbclient-authenticated-share-list: source from util and add
      set -x and set -u

- - - - -
b5d8c5c8 by Andreas Hasenack at 2020-08-13T09:26:18-03:00
  * d/control: enable the liburing vfs module, except on i386 where
    liburing is not available

- - - - -
15630fc2 by Andreas Hasenack at 2020-08-13T09:27:12-03:00
  * Add new DEP8 tests for the uring vfs module:
    - d/t/control: add smbclient-share-access-uring and
      cifs-share-access-uring tests
    - d/t/smbclient-share-access-uring: new test
    - d/t/cifs-share-access-uring: new test

- - - - -
46804852 by Andreas Hasenack at 2020-08-21T11:40:58-03:00
  * d/control: remove i386 exclusion for liburing-dev in debian

- - - - -
f087754e by Andreas Hasenack at 2020-08-21T11:42:51-03:00
  * d/t/cifs-share-access-uring: remove i386 restriction

- - - - -
70abe001 by Andreas Hasenack at 2020-08-21T11:43:15-03:00
  * d/t/smbclient-share-access-uring: remove i386 restriction

- - - - -
f86f10a9 by Mathieu Parent at 2020-12-15T21:16:38+00:00
Merge branch 'debian-dep8-uring' into 'master'

vfs_io_uring and dep8

See merge request samba-team/samba!49
- - - - -


9 changed files:

- debian/control
- debian/tests/cifs-share-access
- + debian/tests/cifs-share-access-uring
- debian/tests/control
- debian/tests/smbclient-anonymous-share-list
- debian/tests/smbclient-authenticated-share-list
- debian/tests/smbclient-share-access
- + debian/tests/smbclient-share-access-uring
- + debian/tests/util


Changes:

=====================================
debian/control
=====================================
@@ -46,6 +46,7 @@ Build-Depends: bison,
                libtasn1-bin,
                libtdb-dev (>= 1.4.3~),
                libtevent-dev (>= 0.10.2~),
+               liburing-dev,
                perl,
                pkg-config,
                po-debconf,


=====================================
debian/tests/cifs-share-access
=====================================
@@ -1,34 +1,23 @@
-#!/bin/sh -x
+#!/bin/sh
 
-if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then
-    echo "Adding [homes] share"
-    cat >> /etc/samba/smb.conf <<EOFEOF
-[homes]
-  valid users = %S
-  read only = no
-  guest ok = no
-EOFEOF
-    systemctl reload smbd.service
-else
-    echo "No need to add [homes] share, continuing."
-fi
+set -x
+set -e
+
+. debian/tests/util
 
 username="smbtest$$"
 password="$$"
-echo "Creating a local test user called ${username}"
-useradd -m "$username"
-echo "Setting samba password for the ${username} user"
-echo "${password}\n${password}" | smbpasswd -s -a ${username}
-userhome=$(eval echo ~$username)
+add_user "${username}" "${password}"
+
+myshare="myshare$$"
+add_share "${myshare}"
+
 echo "Creating file with random data and computing its md5"
-dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data
-chown ${username}:${username} ${userhome}/data
-cd ${userhome}
-md5sum data > data.md5
+populate_share "${myshare}" "${username}"
 
-echo "Mounting //localhost/${username} via CIFS"
+echo "Mounting //localhost/${myshare} via CIFS"
 temp_mount=$(mktemp -d)
-mount -t cifs //localhost/${username} "$temp_mount" -o user=${username},username=${username},password=${password}
+mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
 
 echo "Verifying MD5 via cifs"
 cd "$temp_mount"


=====================================
debian/tests/cifs-share-access-uring
=====================================
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+set -x
+set -e
+
+. debian/tests/util
+
+k_ver=$(uname -r | cut -d - -f 1)
+if ! check_kernel_version ${k_ver}; then
+    echo "uring not available in kernel version ${k_ver}, skipping test"
+    exit 77
+fi
+
+username="smbtest$$"
+password="$$"
+add_user "${username}" "${password}"
+
+myshare="myshare$$"
+add_share "${myshare}" io_uring
+
+echo "Creating file with random data and computing its md5"
+populate_share "${myshare}" "${username}"
+
+echo "Mounting //localhost/${myshare} via CIFS"
+temp_mount=$(mktemp -d)
+mount -t cifs //localhost/"${myshare}" "$temp_mount" -o user="${username}",username="${username}",password="${password}"
+
+echo "Verifying MD5 via cifs"
+cd "$temp_mount"
+md5sum -c data.md5
+result=$?
+cd -
+umount "$temp_mount"
+rmdir "$temp_mount"
+exit "$result"


=====================================
debian/tests/control
=====================================
@@ -2,6 +2,10 @@ Tests: cifs-share-access
 Depends: samba, coreutils, systemd, cifs-utils, passwd
 Restrictions: needs-root, allow-stderr, isolation-machine
 
+Tests: cifs-share-access-uring
+Depends: samba, samba-vfs-modules, coreutils, systemd, cifs-utils, passwd
+Restrictions: needs-root, allow-stderr, isolation-machine, skippable
+
 Tests: python-smoke
 Depends: python3-samba
 
@@ -16,3 +20,7 @@ Restrictions: needs-root, allow-stderr, isolation-container
 Tests: smbclient-share-access
 Depends: samba, smbclient, coreutils, systemd, passwd
 Restrictions: needs-root, allow-stderr, isolation-container
+
+Tests: smbclient-share-access-uring
+Depends: samba, samba-vfs-modules, smbclient, coreutils, systemd, passwd
+Restrictions: needs-root, allow-stderr, isolation-container, skippable


=====================================
debian/tests/smbclient-anonymous-share-list
=====================================
@@ -1,3 +1,6 @@
-#!/bin/sh -x
+#!/bin/sh
+
+set -x
+set -e
 
 smbclient -N -L localhost


=====================================
debian/tests/smbclient-authenticated-share-list
=====================================
@@ -1,17 +1,18 @@
-#!/bin/sh -x
+#!/bin/sh
+
+set -x
+set -e
+
+. debian/tests/util
 
 username="smbtest$$"
 password="$$"
 
-echo "Creating a local test user called ${username}"
-useradd -m "$username"
-
-echo "Setting samba password for the ${username} user"
-echo "${password}\n${password}" | smbpasswd -s -a ${username}
+add_user "${username}" "${password}"
 
 echo "Testing with incorrect password: must fail"
-smbclient -L localhost -U ${username}%wrongpass && exit 1
+smbclient -L localhost -U "${username}"%wrongpass && exit 1
 
 echo "Testing with correct password: must work"
-smbclient -L localhost -U ${username}%${password}
+smbclient -L localhost -U "${username}"%"${password}"
 


=====================================
debian/tests/smbclient-share-access
=====================================
@@ -1,34 +1,23 @@
-#!/bin/sh -x
+#!/bin/sh
 
-if ! testparm -s 2>&1 | grep -qE "^\[homes\]"; then
-    echo "Adding [homes] share"
-    cat >> /etc/samba/smb.conf <<EOFEOF
-[homes]
-  valid users = %S
-  read only = no
-  guest ok = no
-EOFEOF
-    systemctl reload smbd.service
-else
-    echo "No need to add [homes] share, continuing."
-fi
+set -x
+set -e
+
+. debian/tests/util
 
 username="smbtest$$"
 password="$$"
-echo "Creating a local test user called ${username}"
-useradd -m "$username"
-echo "Setting samba password for the ${username} user"
-echo "${password}\n${password}" | smbpasswd -s -a ${username}
-userhome=$(eval echo ~$username)
+add_user "${username}" "${password}"
+
+myshare="myshare$$"
+add_share "${myshare}"
+
 echo "Creating file with random data and computing its md5"
-dd if=/dev/urandom bs=1 count=128 2>/dev/null | base64 > ${userhome}/data
-chown ${username}:${username} ${userhome}/data
-cd ${userhome}
-md5sum data > data.md5
+populate_share "${myshare}" "${username}"
 
 rm -f downloaded-data
 echo "Downloading file and comparing its md5"
-smbclient //localhost/${username} -U ${username}%${password} -c "get data downloaded-data"
+smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
 
 mv -f downloaded-data data
 md5sum -c data.md5


=====================================
debian/tests/smbclient-share-access-uring
=====================================
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -x
+set -e
+
+. debian/tests/util
+
+k_ver=$(uname -r | cut -d - -f 1)
+if ! check_kernel_version ${k_ver}; then
+    echo "uring not available in kernel version ${k_ver}, skipping test"
+    exit 77
+fi
+
+username="smbtest$$"
+password="$$"
+add_user "${username}" "${password}"
+
+myshare="myshare$$"
+add_share "${myshare}" io_uring
+
+echo "Creating file with random data and computing its md5"
+populate_share "${myshare}" "${username}"
+
+rm -f downloaded-data
+echo "Downloading file and comparing its md5"
+smbclient //localhost/"${myshare}" -U "${username}"%"${password}" -c "get data downloaded-data"
+
+mv -f downloaded-data data
+md5sum -c data.md5


=====================================
debian/tests/util
=====================================
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# $1: share name
+# $2: comma separated list of vfs_objects to use, if any
+add_share() {
+    local share="$1"
+    local vfs="$2"
+    if ! testparm -s 2>&1 | grep -E "^\[${share}\]"; then
+        echo "Adding [${share}] share"
+        cat >> /etc/samba/smb.conf <<EOFEOF
+[${share}]
+  read only = no
+  guest ok = no
+  path = /${share}
+EOFEOF
+        if [ -n "${vfs}" ]; then
+            echo "vfs objects = ${vfs}" >> /etc/samba/smb.conf
+        fi
+        systemctl restart smbd.service
+    else
+        echo "Share [${share}] already exists, continuing"
+    fi
+}
+
+# $1: username
+# $2: password
+add_user() {
+    local username="$1"
+    local password="$2"
+
+    echo "Creating a local and samba user called ${username}"
+    useradd -m "${username}"
+    echo "Setting samba password for the ${username} user"
+    echo "${password}\n${password}" | smbpasswd -s -a ${username}
+}
+
+# $1: share name
+populate_share() {
+    local sharename="$1"
+    local usergroup="$2"
+    local sharepath="/${sharename}"
+
+    mkdir -p "${sharepath}"
+    dd if=/dev/urandom bs=4096 count=1000 2>/dev/null | base64 > "${sharepath}/data"
+    cd "${sharepath}"
+    md5sum data > data.md5
+    chown -R "${usergroup}:${usergroup}" "${sharepath}"
+}
+
+
+# $1: kernel version in the form major.minor.patch
+check_kernel_version() {
+    local k_ver=$1
+    local k_major=$(echo ${k_ver} | cut -d . -f 1)
+    local k_minor=$(echo ${k_ver} | cut -d . -f 2)
+
+    # uring is supported starting with kernel 5.1.x
+    if [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then
+       return 0
+    elif [ ${k_major} -ge 6 ]; then
+       return 0
+    else
+        return 1
+    fi
+}



View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/0414859a7b754d1b34f841a6ad7af93740d45a81...f86f10a940596e36551d8c0da15089bb9603a731

-- 
View it on GitLab: https://salsa.debian.org/samba-team/samba/-/compare/0414859a7b754d1b34f841a6ad7af93740d45a81...f86f10a940596e36551d8c0da15089bb9603a731
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-samba-maint/attachments/20201215/05daa642/attachment-0001.html>


More information about the Pkg-samba-maint mailing list