Merge ~ahasenack/ubuntu/+source/samba:groovy-samba-dep8-uring-old-kernel into ubuntu/+source/samba:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: 124bdc164f3e78e61abdcd44f2e9f42afb176a97
Merged at revision: 124bdc164f3e78e61abdcd44f2e9f42afb176a97
Proposed branch: ~ahasenack/ubuntu/+source/samba:groovy-samba-dep8-uring-old-kernel
Merge into: ubuntu/+source/samba:ubuntu/devel
Diff against target: 89 lines (+37/-2)
4 files modified
debian/changelog (+7/-0)
debian/tests/cifs-share-access-uring (+7/-1)
debian/tests/smbclient-share-access-uring (+7/-1)
debian/tests/util (+16/-0)
Reviewer Review Type Date Requested Status
Lucas Kanashiro (community) Approve
Canonical Server Core Reviewers Pending
Review via email: mp+389127@code.launchpad.net

Description of the change

Skip uring test if the running kernel is too old.

This happens in our testers for armhf, which runs inside a lxd container on a bionic host. The bionic kernel does not have support for uring, and since the lxd container sees the host kernel, even though the container itself is groovy, the test fails.

Bileto ticket: https://bileto.ubuntu.com/#/ticket/4193

If you go to the armhf test, and search for "kernel", you will see it's 4.15.something. Scroll down to the bottom and you will see the uring tests skipped. The cifs ones because it's lxd and not a vm, and the smbclient uring one because of the old kernel.

To post a comment you must log in.
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Bileto is green. i386 is the usual red, and gvfs on s390x always needs a couple of retries.

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I am on it.

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

I added an inline comment with a suggestion to the check_kernel_version function.

review: Needs Information
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Replied

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Hm, looks like my 6.0.2 example doesn't pass

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

How about:

    # uring is supported starting with kernel 5.1.x
    if [ ${k_major} -lt 5 ]; then
        return 1
    elif [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then
       return 0
    elif [ ${k_major} -ge 6 ]; then
       return 0
    else
        return 1
    fi

Example test script:
#!/bin/bash

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} -lt 5 ]; then
        return 1
    elif [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then
       return 0
    elif [ ${k_major} -ge 6 ]; then
       return 0
    else
        return 1
    fi
}

for k_ver in 5.10.0 5.4.0 5.1.0 4.10.0 4.4.0 6.0.2; do
    result=0
    echo -n "Checking kernel ${k_ver}... "
    check_kernel_version ${k_ver} || result=$?
    if [ ${result} -ne 0 ]; then
        echo "FAIL"
    else
        echo "OK"
    fi
done

$ ./check-kernel.sh
Checking kernel 5.10.0... OK
Checking kernel 5.4.0... OK
Checking kernel 5.1.0... OK
Checking kernel 4.10.0... FAIL
Checking kernel 4.4.0... FAIL
Checking kernel 6.0.2... OK

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

In your latest implementation the first if statement is still needed? I did this small change to your test script and I got the same result:

- if [ ${k_major} -lt 5 ]; then
- return 1
- elif [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then
+ if [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then

$ ./check-kernel.sh
Checking kernel 5.10.0... OK
Checking kernel 5.4.0... OK
Checking kernel 5.1.0... OK
Checking kernel 4.10.0... FAIL
Checking kernel 4.4.0... FAIL
Checking kernel 6.0.2... OK

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I added 5.0.0 to the test script to be sure:
#!/bin/bash

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
}

for k_ver in 5.0.0 5.10.0 5.4.0 5.1.0 4.10.0 4.4.0 6.0.2 5.2.0; do
    result=0
    echo -n "Checking kernel ${k_ver}... "
    check_kernel_version ${k_ver} || result=$?
    if [ ${result} -ne 0 ]; then
        echo "FAIL"
    else
        echo "OK"
    fi
done

$ ./check-kernel.sh
Checking kernel 5.0.0... FAIL
Checking kernel 5.10.0... OK
Checking kernel 5.4.0... OK
Checking kernel 5.1.0... OK
Checking kernel 4.10.0... FAIL
Checking kernel 4.4.0... FAIL
Checking kernel 6.0.2... OK
Checking kernel 5.2.0... OK

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

That's the expected behavior, right? 5.0.0 does not support uring according to your comment in the code, >= 5.1.0 is what we want.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Yes, sorry, I meant to say it works :)

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Pushed your suggestion

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thanks Andreas! LGTM, +1.

Do not forget to drop the '~ppa1' from the version string ;-)

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Good call :)

Squashed and force pushed

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Tagging and uploading 124bdc164f3e78e61abdcd44f2e9f42afb176a97

$ git push pkg upload/2%4.12.5+dfsg-3ubuntu3
Enumerating objects: 18, done.
Counting objects: 100% (18/18), done.
Delta compression using up to 4 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (12/12), 1.78 KiB | 365.00 KiB/s, done.
Total 12 (delta 9), reused 0 (delta 0)
remote: Checking connectivity: 12, done.
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/samba
 * [new tag] upload/2%4.12.5+dfsg-3ubuntu3 -> upload/2%4.12.5+dfsg-3ubuntu3

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

$ dput ubuntu ../samba_4.12.5+dfsg-3ubuntu3_source.changes
Checking signature on .changes
gpg: ../samba_4.12.5+dfsg-3ubuntu3_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../samba_4.12.5+dfsg-3ubuntu3.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading samba_4.12.5+dfsg-3ubuntu3.dsc: done.
  Uploading samba_4.12.5+dfsg-3ubuntu3.debian.tar.xz: done.
  Uploading samba_4.12.5+dfsg-3ubuntu3_source.buildinfo: done.
  Uploading samba_4.12.5+dfsg-3ubuntu3_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 406edda..fd28297 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+samba (2:4.12.5+dfsg-3ubuntu3) groovy; urgency=medium
7+
8+ * d/t/{util, smbclient-share-access-uring, cifs-share-access-uring}:
9+ guard uring tests with a kernel version check and skip if it's too old
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Tue, 11 Aug 2020 11:00:35 -0300
12+
13 samba (2:4.12.5+dfsg-3ubuntu2) groovy; urgency=medium
14
15 * d/t/smbclient-anonymous-share-list: add set -x and set -e
16diff --git a/debian/tests/cifs-share-access-uring b/debian/tests/cifs-share-access-uring
17index 6bbd3e1..22253ca 100644
18--- a/debian/tests/cifs-share-access-uring
19+++ b/debian/tests/cifs-share-access-uring
20@@ -3,13 +3,19 @@
21 set -x
22 set -e
23
24+. debian/tests/util
25+
26 ARCH=$(dpkg --print-architecture)
27 if [ "$ARCH" = "i386" ]; then
28 echo "liburing not available on $ARCH, skipping test"
29 exit 77
30 fi
31
32-. debian/tests/util
33+k_ver=$(uname -r | cut -d - -f 1)
34+if ! check_kernel_version ${k_ver}; then
35+ echo "uring not available in kernel version ${k_ver}, skipping test"
36+ exit 77
37+fi
38
39 username="smbtest$$"
40 password="$$"
41diff --git a/debian/tests/smbclient-share-access-uring b/debian/tests/smbclient-share-access-uring
42index e6dc017..e7915c3 100644
43--- a/debian/tests/smbclient-share-access-uring
44+++ b/debian/tests/smbclient-share-access-uring
45@@ -3,13 +3,19 @@
46 set -x
47 set -e
48
49+. debian/tests/util
50+
51 ARCH=$(dpkg --print-architecture)
52 if [ "$ARCH" = "i386" ]; then
53 echo "liburing not available on $ARCH, skipping test"
54 exit 77
55 fi
56
57-. debian/tests/util
58+k_ver=$(uname -r | cut -d - -f 1)
59+if ! check_kernel_version ${k_ver}; then
60+ echo "uring not available in kernel version ${k_ver}, skipping test"
61+ exit 77
62+fi
63
64 username="smbtest$$"
65 password="$$"
66diff --git a/debian/tests/util b/debian/tests/util
67index 8c5d452..47d58b9 100644
68--- a/debian/tests/util
69+++ b/debian/tests/util
70@@ -47,3 +47,19 @@ populate_share() {
71 chown -R "${usergroup}:${usergroup}" "${sharepath}"
72 }
73
74+
75+# $1: kernel version in the form major.minor.patch
76+check_kernel_version() {
77+ local k_ver=$1
78+ local k_major=$(echo ${k_ver} | cut -d . -f 1)
79+ local k_minor=$(echo ${k_ver} | cut -d . -f 2)
80+
81+ # uring is supported starting with kernel 5.1.x
82+ if [ ${k_major} -eq 5 ] && [ ${k_minor} -ge 1 ]; then
83+ return 0
84+ elif [ ${k_major} -ge 6 ]; then
85+ return 0
86+ else
87+ return 1
88+ fi
89+}

Subscribers

People subscribed via source and target branches