[LTP] [PATCH] zram/zram_lib.sh: fix local variable assignment

Cyril Hrubis chrubis@suse.cz
Tue Jul 2 12:14:13 CEST 2019


Hi!
> The compression algorithm was stored into a local variable "algs",
> however the variable name "zram_algs" was used in the for loop later.
>
> Unify them with "zram_algs", and use sed to get rid of the square
> brackets that indicates the compression algorithm currently in use.
>     $ cat /sys/block/zram0/comp_algorithm
>     [lzo] lz4 lz4hc 842 zstd

The test that calls the zram_compress_alg() function defines the
zram_algs variable and the length must match the number of created
devices in zram_load otherwise the test would fail to write to
non-existing sys_path in case that there is more than 4 algorithms.

I guess that deeper changes to the test would be needed in order to be
able to support testing all available compression algorithms.

> Also, the /bin/sh was symbolically link to dash in Ubuntu.
> This is making the one-liner local variable assignment not working [1]:
>     /opt/ltp/testcases/bin/zram01.sh: 102: local: 842: bad variable name
> 
> Break it into two lines to solve this issue.
> 
> [1] https://wiki.ubuntu.com/DashAsBinSh#local

This change is obviously correct, can you please send a patch only with
this change so that it can be commited? Then we can figure something
out about the compression algorithms.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list