All of lore.kernel.org
 help / color / mirror / Atom feed
From: "André Draszik" <git@andred.net>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 3/6] oeqa/runtime/df: don't fail on long device names
Date: Wed, 16 Oct 2019 10:18:22 +0100	[thread overview]
Message-ID: <20191016091825.1910-4-git@andred.net> (raw)
In-Reply-To: <20191016091825.1910-1-git@andred.net>

When device names are long (more than 20 characters), the
df test will fail with an exception:
    self.assertTrue(int(output)>5120, msg=msg)
    ValueError: invalid literal for int() with base 10: ''
at least when busybox is in use.

The reason is that busybox breaks the line in that case:
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/disk/by-partuuid/8e991e5a-cebd-4f88-9494-c9db4f30cb02
                           1998672     87024   1790408   5% /
and the code tries to extract the fourth field from the
second line, which is empty of course.

df can be told not to break lines, though, using the -P
flag, which turns on the POSIX output format, and is
supported by busybox df and coreutils df:
    Filesystem           1024-blocks    Used Available Capacity Mounted on
    /dev/disk/by-partuuid/8e991e5a-cebd-4f88-9494-c9db4f30cb02   1998672     87024   1790408   5% /

Signed-off-by: André Draszik <git@andred.net>
---
 meta/lib/oeqa/runtime/cases/df.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/runtime/cases/df.py b/meta/lib/oeqa/runtime/cases/df.py
index d8d79f32ea..89fd0fb901 100644
--- a/meta/lib/oeqa/runtime/cases/df.py
+++ b/meta/lib/oeqa/runtime/cases/df.py
@@ -11,7 +11,7 @@ class DfTest(OERuntimeTestCase):
     @OETestDepends(['ssh.SSHTest.test_ssh'])
     @OEHasPackage(['coreutils', 'busybox'])
     def test_df(self):
-        cmd = "df / | sed -n '2p' | awk '{print $4}'"
+        cmd = "df -P / | sed -n '2p' | awk '{print $4}'"
         (status,output) = self.target.run(cmd)
         msg = 'Not enough space on image. Current size is %s' % output
         self.assertTrue(int(output)>5120, msg=msg)
-- 
2.23.0.rc1



  parent reply	other threads:[~2019-10-16  9:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  9:18 [PATCH 0/6] various oeqa fixes André Draszik
2019-10-16  9:18 ` [PATCH 1/6] testimage.bbclass: support hardware-controlled targets André Draszik
2019-10-16  9:18 ` [PATCH 2/6] testimage.bbclass: enable ssh agent forwarding André Draszik
2019-10-16  9:18 ` André Draszik [this message]
2019-10-16  9:18 ` [PATCH 4/6] oeqa/core/decorator: add skipIfFeature André Draszik
2019-10-16  9:18 ` [PATCH 5/6] oeqa/runtime/opkg: skip install on read-only-rootfs André Draszik
2019-10-16  9:18 ` [PATCH 6/6] oeqa/runtime/systemd: skip unit enable/disable " André Draszik
2019-10-17  9:28   ` [PATCH v2] " André Draszik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191016091825.1910-4-git@andred.net \
    --to=git@andred.net \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.