public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] device-drivers/zram: add kernel version check
@ 2015-05-07  2:54 Xiaoguang Wang
  2015-05-18  5:57 ` [LTP] [PATCH v2] " Xiaoguang Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Xiaoguang Wang @ 2015-05-07  2:54 UTC (permalink / raw)
  To: ltp-list

zram device attributes max_comp_streams and comp_algorithm are introduced
since kernel v3.15, and mem_limit is introduced since kernel v3.18, we
need to add these check.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 testcases/kernel/device-drivers/zram/zram_lib.sh | 32 +++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/device-drivers/zram/zram_lib.sh b/testcases/kernel/device-drivers/zram/zram_lib.sh
index e41d8c7..d3e62e0 100755
--- a/testcases/kernel/device-drivers/zram/zram_lib.sh
+++ b/testcases/kernel/device-drivers/zram/zram_lib.sh
@@ -62,7 +62,15 @@ zram_load()
 
 zram_max_streams()
 {
-	tst_resm TINFO "set max_comp_streams to zram device(s)"
+	tst_kvercmp 3 15 0
+	if [ $? -eq 0 ]; then
+		tst_resm TCONF "device attribute max_comp_streams is"\
+			"introduced since kernel v3.15, the running kernel"\
+			"does not support it"
+		return
+	else
+		tst_resm TINFO "set max_comp_streams to zram device(s)"
+	fi
 
 	local i=0
 	for max_s in $zram_max_streams; do
@@ -83,7 +91,16 @@ zram_max_streams()
 
 zram_compress_alg()
 {
-	tst_resm TINFO "test that we can set compression algorithm"
+	tst_kvercmp 3 15 0
+	if [ $? -eq 0 ]; then
+		tst_resm TCONF "device attribute comp_algorithm is"\
+			"introduced since kernel v3.15, the running kernel"\
+			"does not support it"
+		return
+	else
+		tst_resm TINFO "test that we can set compression algorithm"
+	fi
+
 	local algs=$(cat /sys/block/zram0/comp_algorithm)
 	tst_resm TINFO "supported algs: $algs"
 	local i=0
@@ -116,7 +133,16 @@ zram_set_disksizes()
 
 zram_set_memlimit()
 {
-	tst_resm TINFO "set memory limit to zram device(s)"
+	tst_kvercmp 3 18 0
+	if [ $? -eq 0 ]; then
+		tst_resm TCONF "device attribute mem_limit is"\
+			"introduced since kernel v3.18, the running kernel"\
+			"does not support it"
+		return
+	else
+		tst_resm TINFO "set memory limit to zram device(s)"
+	fi
+
 	local i=0
 	for ds in $zram_mem_limits; do
 		local sys_path="/sys/block/zram${i}/mem_limit"
-- 
1.8.3.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-19  0:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-07  2:54 [LTP] [PATCH] device-drivers/zram: add kernel version check Xiaoguang Wang
2015-05-18  5:57 ` [LTP] [PATCH v2] " Xiaoguang Wang
2015-05-18  6:25   ` Wanlong Gao
2015-05-19  0:47     ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox