[OE-core] [PATCH] oeqa/selftest/wic: add test case for sparse images

Joshua Lock joshua.lock at collabora.co.uk
Thu Dec 17 16:52:22 UTC 2015


On 17/12/15 16:21, Burton, Ross wrote:
>
> On 17 December 2015 at 16:09, Joshua Lock <joshua.lock at collabora.co.uk
> <mailto:joshua.lock at collabora.co.uk>> wrote:
>
>     +        used = int(runCmd("du %s | awk '{print $1}'" % path).output)
>     +        apparent = int(runCmd("du --apparent-size %s | awk '{print
>     $1}'" % path).output)
>
>
> Surely os.stat() can do this instead?

Of course it can — st_blocks is the "number of 512-byte blocks allocated 
for file" we can multiply st_blocks by 512 to get the on-disk size 
(whilst st_size is the apparent size).

https://docs.python.org/2/library/os.html#os.stat

I'll create a v2.

Joshua




More information about the Openembedded-core mailing list