diff options
author | André Draszik <git@andred.net> | 2019-10-16 10:18:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-10-19 23:18:33 +0100 |
commit | 077c3bbf2f6997bc1f4677f4d414a7a324360340 (patch) | |
tree | f3c72956da448fd40f69ab48c295b9f131655452 | |
parent | 8073884454ff08c74a1dfffa2c56cf9bd0fa3769 (diff) | |
download | poky-077c3bbf2f6997bc1f4677f4d414a7a324360340.tar.gz |
oeqa/runtime/df: don't fail on long device names
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% /
(From OE-Core rev: 8c23c1476d0c64b9bc8806db03414fa914c1e658)
Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/runtime/cases/df.py | 2 |
1 files changed, 1 insertions, 1 deletions
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): | |||
11 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 11 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
12 | @OEHasPackage(['coreutils', 'busybox']) | 12 | @OEHasPackage(['coreutils', 'busybox']) |
13 | def test_df(self): | 13 | def test_df(self): |
14 | cmd = "df / | sed -n '2p' | awk '{print $4}'" | 14 | cmd = "df -P / | sed -n '2p' | awk '{print $4}'" |
15 | (status,output) = self.target.run(cmd) | 15 | (status,output) = self.target.run(cmd) |
16 | msg = 'Not enough space on image. Current size is %s' % output | 16 | msg = 'Not enough space on image. Current size is %s' % output |
17 | self.assertTrue(int(output)>5120, msg=msg) | 17 | self.assertTrue(int(output)>5120, msg=msg) |