Re: [PATCH v2] selftests/zram: Adding zram tests

2015-08-18 Thread Naresh Kamboju
Hi Shuah Khan,

On 18 August 2015 at 03:14, Shuah Khan  wrote:
> On 08/17/2015 02:39 PM, naresh.kamb...@linaro.org wrote:
>> From: Naresh Kamboju 
>
> Are you using git send-email to send this patch? Not sure why
> I see this From and the one below.


I do use git send-email to send this patch.
From: Naresh is generated from git send-patch.

>
>>
>> zram.sh: sanity check of CONFIG_ZRAM and run zram01.sh and zram02.sh
>> zram01.sh: creates general purpose ram disks with different filesystems
>> zram02.sh: creates block device for swap
>> zram_lib.sh: create library with initialization/cleanup functions
>> README: ZRAM introduction and Kconfig required.
>> Makefile: To run zram tests
>
> Could please write a proper commit message instead of list of files
> and description.

Done and sent v3 patch.

>
>>
>> From: Alexey Kodanev 
>
> Same comment here.

The original author of this patch is "Alexey Kodanev". who submitted
patch on LTP.
I have updated and modified to fit into selftests.
That is the reason for adding From: Alexey Kodanev again in commit message.
However, I have added him in CC for v3 patch set.

Best regards
Naresh Kamboju

>
>> CC: Shuah Khan 
>> CC: Tyler Baker 
>> CC: Milosz Wasilewski 
>> Signed-off-by: Naresh Kamboju 
>> Signed-off-by: Alexey Kodanev 
>> ---
>>  tools/testing/selftests/Makefile |   1 +
>>  tools/testing/selftests/zram/Makefile|  12 ++
>>  tools/testing/selftests/zram/README  |  40 ++
>>  tools/testing/selftests/zram/zram.sh |  22 +++
>>  tools/testing/selftests/zram/zram01.sh   |  98 ++
>>  tools/testing/selftests/zram/zram02.sh   |  53 
>>  tools/testing/selftests/zram/zram_lib.sh | 222 
>> +++
>>  7 files changed, 448 insertions(+)
>>  create mode 100644 tools/testing/selftests/zram/Makefile
>>  create mode 100644 tools/testing/selftests/zram/README
>>  create mode 100755 tools/testing/selftests/zram/zram.sh
>>  create mode 100755 tools/testing/selftests/zram/zram01.sh
>>  create mode 100755 tools/testing/selftests/zram/zram02.sh
>>  create mode 100755 tools/testing/selftests/zram/zram_lib.sh
>>
>> diff --git a/tools/testing/selftests/Makefile 
>> b/tools/testing/selftests/Makefile
>> index 24ae9e8..9763dd9 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -22,6 +22,7 @@ endif
>>  TARGETS += user
>>  TARGETS += vm
>>  TARGETS += x86
>> +TARGETS += zram
>>  #Please keep the TARGETS list alphabetically sorted
>>  # Run "make quicktest=1 run_tests" or
>>  # "make quicktest=1 kselftest from top level Makefile
>> diff --git a/tools/testing/selftests/zram/Makefile 
>> b/tools/testing/selftests/zram/Makefile
>> new file mode 100644
>> index 000..ec45513
>> --- /dev/null
>> +++ b/tools/testing/selftests/zram/Makefile
>> @@ -0,0 +1,12 @@
>> +all:
>> +
>> +TEST_PROGS := zram.sh
>> +TEST_FILES := zram01.sh zram02.sh zram_lib.sh
>> +
>> +include ../lib.mk
>> +
>> +run_tests:
>> + @/bin/bash ./zram.sh
>> +
>> +clean:
>> + $(RM) err.log
>> diff --git a/tools/testing/selftests/zram/README 
>> b/tools/testing/selftests/zram/README
>> new file mode 100644
>> index 000..eb17917
>> --- /dev/null
>> +++ b/tools/testing/selftests/zram/README
>> @@ -0,0 +1,40 @@
>> +zram: Compressed RAM based block devices
>> +
>> +* Introduction
>> +
>> +The zram module creates RAM based block devices named /dev/zram
>> +( = 0, 1, ...). Pages written to these disks are compressed and stored
>> +in memory itself. These disks allow very fast I/O and compression provides
>> +good amounts of memory savings. Some of the usecases include /tmp storage,
>> +use as swap disks, various caches under /var and maybe many more :)
>> +
>> +Statistics for individual zram devices are exported through sysfs nodes at
>> +/sys/block/zram/
>> +
>> +Kconfig required:
>> +CONFIG_ZRAM=y
>> +CONFIG_ZRAM_LZ4_COMPRESS=y
>> +CONFIG_ZPOOL=y
>> +CONFIG_ZSMALLOC=y
>> +
>> +ZRAM Testcases
>> +--
>> +zram_lib.sh: create library with initialization/cleanup functions
>> +zram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
>> +
>> +Two functional tests: zram01 and zram02:
>> +zram01.sh: creates general purpose ram disks with ext4 filesystems
>> +zram02.sh: creates block device for swap
>> +
>> +Commands required for testing:
>> + - bc
>> + - dd
>> + - free
>> + - awk
>> + - mkswap
>> + - swapon
>> + - swapoff
>> + - mkfs/ mkfs.ext4
>> +
>> +For more information please refer:
>> +kernel-source-tree/Documentation/blockdev/zram.txt
>> diff --git a/tools/testing/selftests/zram/zram.sh 
>> b/tools/testing/selftests/zram/zram.sh
>> new file mode 100755
>> index 000..be219fd
>> --- /dev/null
>> +++ b/tools/testing/selftests/zram/zram.sh
>> @@ -0,0 +1,22 @@
>> +#!/bin/bash
>> +TCID="zram.sh"
>> +
>> +run_zram () {
>> +echo ""
>> +echo "running zram tests"
>> +echo ""
>> +./zram01.sh
>> +./zram02.sh
>> +}
>> +

Re: [PATCH v2] selftests/zram: Adding zram tests

2015-08-17 Thread Shuah Khan
On 08/17/2015 02:39 PM, naresh.kamb...@linaro.org wrote:
> From: Naresh Kamboju 

Are you using git send-email to send this patch? Not sure why
I see this From and the one below.

> 
> zram.sh: sanity check of CONFIG_ZRAM and run zram01.sh and zram02.sh
> zram01.sh: creates general purpose ram disks with different filesystems
> zram02.sh: creates block device for swap
> zram_lib.sh: create library with initialization/cleanup functions
> README: ZRAM introduction and Kconfig required.
> Makefile: To run zram tests

Could please write a proper commit message instead of list of files
and description.

> 
> From: Alexey Kodanev 

Same comment here.

> CC: Shuah Khan 
> CC: Tyler Baker 
> CC: Milosz Wasilewski 
> Signed-off-by: Naresh Kamboju 
> Signed-off-by: Alexey Kodanev 
> ---
>  tools/testing/selftests/Makefile |   1 +
>  tools/testing/selftests/zram/Makefile|  12 ++
>  tools/testing/selftests/zram/README  |  40 ++
>  tools/testing/selftests/zram/zram.sh |  22 +++
>  tools/testing/selftests/zram/zram01.sh   |  98 ++
>  tools/testing/selftests/zram/zram02.sh   |  53 
>  tools/testing/selftests/zram/zram_lib.sh | 222 
> +++
>  7 files changed, 448 insertions(+)
>  create mode 100644 tools/testing/selftests/zram/Makefile
>  create mode 100644 tools/testing/selftests/zram/README
>  create mode 100755 tools/testing/selftests/zram/zram.sh
>  create mode 100755 tools/testing/selftests/zram/zram01.sh
>  create mode 100755 tools/testing/selftests/zram/zram02.sh
>  create mode 100755 tools/testing/selftests/zram/zram_lib.sh
> 
> diff --git a/tools/testing/selftests/Makefile 
> b/tools/testing/selftests/Makefile
> index 24ae9e8..9763dd9 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -22,6 +22,7 @@ endif
>  TARGETS += user
>  TARGETS += vm
>  TARGETS += x86
> +TARGETS += zram
>  #Please keep the TARGETS list alphabetically sorted
>  # Run "make quicktest=1 run_tests" or
>  # "make quicktest=1 kselftest from top level Makefile
> diff --git a/tools/testing/selftests/zram/Makefile 
> b/tools/testing/selftests/zram/Makefile
> new file mode 100644
> index 000..ec45513
> --- /dev/null
> +++ b/tools/testing/selftests/zram/Makefile
> @@ -0,0 +1,12 @@
> +all:
> +
> +TEST_PROGS := zram.sh
> +TEST_FILES := zram01.sh zram02.sh zram_lib.sh
> +
> +include ../lib.mk
> +
> +run_tests:
> + @/bin/bash ./zram.sh
> +
> +clean:
> + $(RM) err.log
> diff --git a/tools/testing/selftests/zram/README 
> b/tools/testing/selftests/zram/README
> new file mode 100644
> index 000..eb17917
> --- /dev/null
> +++ b/tools/testing/selftests/zram/README
> @@ -0,0 +1,40 @@
> +zram: Compressed RAM based block devices
> +
> +* Introduction
> +
> +The zram module creates RAM based block devices named /dev/zram
> +( = 0, 1, ...). Pages written to these disks are compressed and stored
> +in memory itself. These disks allow very fast I/O and compression provides
> +good amounts of memory savings. Some of the usecases include /tmp storage,
> +use as swap disks, various caches under /var and maybe many more :)
> +
> +Statistics for individual zram devices are exported through sysfs nodes at
> +/sys/block/zram/
> +
> +Kconfig required:
> +CONFIG_ZRAM=y
> +CONFIG_ZRAM_LZ4_COMPRESS=y
> +CONFIG_ZPOOL=y
> +CONFIG_ZSMALLOC=y
> +
> +ZRAM Testcases
> +--
> +zram_lib.sh: create library with initialization/cleanup functions
> +zram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
> +
> +Two functional tests: zram01 and zram02:
> +zram01.sh: creates general purpose ram disks with ext4 filesystems
> +zram02.sh: creates block device for swap
> +
> +Commands required for testing:
> + - bc
> + - dd
> + - free
> + - awk
> + - mkswap
> + - swapon
> + - swapoff
> + - mkfs/ mkfs.ext4
> +
> +For more information please refer:
> +kernel-source-tree/Documentation/blockdev/zram.txt
> diff --git a/tools/testing/selftests/zram/zram.sh 
> b/tools/testing/selftests/zram/zram.sh
> new file mode 100755
> index 000..be219fd
> --- /dev/null
> +++ b/tools/testing/selftests/zram/zram.sh
> @@ -0,0 +1,22 @@
> +#!/bin/bash
> +TCID="zram.sh"
> +
> +run_zram () {
> +echo ""
> +echo "running zram tests"
> +echo ""
> +./zram01.sh
> +./zram02.sh
> +}
> +
> +# check zram module exists
> +MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
> +if [ -f $MODULE_PATH ]; then
> + run_zram
> +elif [ -b /dev/zram0 ]; then
> + run_zram
> +else
> + echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
> + echo "$TCID : CONFIG_ZRAM is not set"
> + exit 1
> +fi
> diff --git a/tools/testing/selftests/zram/zram01.sh 
> b/tools/testing/selftests/zram/zram01.sh
> new file mode 100755
> index 000..2a2475d
> --- /dev/null
> +++ b/tools/testing/selftests/zram/zram01.sh
> @@ -0,0 +1,98 @@
> +#!/bin/bash
> +# Copyright (c) 20

[PATCH v2] selftests/zram: Adding zram tests

2015-08-17 Thread naresh . kamboju
From: Naresh Kamboju 

zram.sh: sanity check of CONFIG_ZRAM and run zram01.sh and zram02.sh
zram01.sh: creates general purpose ram disks with different filesystems
zram02.sh: creates block device for swap
zram_lib.sh: create library with initialization/cleanup functions
README: ZRAM introduction and Kconfig required.
Makefile: To run zram tests

From: Alexey Kodanev 
CC: Shuah Khan 
CC: Tyler Baker 
CC: Milosz Wasilewski 
Signed-off-by: Naresh Kamboju 
Signed-off-by: Alexey Kodanev 
---
 tools/testing/selftests/Makefile |   1 +
 tools/testing/selftests/zram/Makefile|  12 ++
 tools/testing/selftests/zram/README  |  40 ++
 tools/testing/selftests/zram/zram.sh |  22 +++
 tools/testing/selftests/zram/zram01.sh   |  98 ++
 tools/testing/selftests/zram/zram02.sh   |  53 
 tools/testing/selftests/zram/zram_lib.sh | 222 +++
 7 files changed, 448 insertions(+)
 create mode 100644 tools/testing/selftests/zram/Makefile
 create mode 100644 tools/testing/selftests/zram/README
 create mode 100755 tools/testing/selftests/zram/zram.sh
 create mode 100755 tools/testing/selftests/zram/zram01.sh
 create mode 100755 tools/testing/selftests/zram/zram02.sh
 create mode 100755 tools/testing/selftests/zram/zram_lib.sh

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 24ae9e8..9763dd9 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -22,6 +22,7 @@ endif
 TARGETS += user
 TARGETS += vm
 TARGETS += x86
+TARGETS += zram
 #Please keep the TARGETS list alphabetically sorted
 # Run "make quicktest=1 run_tests" or
 # "make quicktest=1 kselftest from top level Makefile
diff --git a/tools/testing/selftests/zram/Makefile 
b/tools/testing/selftests/zram/Makefile
new file mode 100644
index 000..ec45513
--- /dev/null
+++ b/tools/testing/selftests/zram/Makefile
@@ -0,0 +1,12 @@
+all:
+
+TEST_PROGS := zram.sh
+TEST_FILES := zram01.sh zram02.sh zram_lib.sh
+
+include ../lib.mk
+
+run_tests:
+   @/bin/bash ./zram.sh
+
+clean:
+   $(RM) err.log
diff --git a/tools/testing/selftests/zram/README 
b/tools/testing/selftests/zram/README
new file mode 100644
index 000..eb17917
--- /dev/null
+++ b/tools/testing/selftests/zram/README
@@ -0,0 +1,40 @@
+zram: Compressed RAM based block devices
+
+* Introduction
+
+The zram module creates RAM based block devices named /dev/zram
+( = 0, 1, ...). Pages written to these disks are compressed and stored
+in memory itself. These disks allow very fast I/O and compression provides
+good amounts of memory savings. Some of the usecases include /tmp storage,
+use as swap disks, various caches under /var and maybe many more :)
+
+Statistics for individual zram devices are exported through sysfs nodes at
+/sys/block/zram/
+
+Kconfig required:
+CONFIG_ZRAM=y
+CONFIG_ZRAM_LZ4_COMPRESS=y
+CONFIG_ZPOOL=y
+CONFIG_ZSMALLOC=y
+
+ZRAM Testcases
+--
+zram_lib.sh: create library with initialization/cleanup functions
+zram.sh: For sanity check of CONFIG_ZRAM and to run zram01 and zram02
+
+Two functional tests: zram01 and zram02:
+zram01.sh: creates general purpose ram disks with ext4 filesystems
+zram02.sh: creates block device for swap
+
+Commands required for testing:
+ - bc
+ - dd
+ - free
+ - awk
+ - mkswap
+ - swapon
+ - swapoff
+ - mkfs/ mkfs.ext4
+
+For more information please refer:
+kernel-source-tree/Documentation/blockdev/zram.txt
diff --git a/tools/testing/selftests/zram/zram.sh 
b/tools/testing/selftests/zram/zram.sh
new file mode 100755
index 000..be219fd
--- /dev/null
+++ b/tools/testing/selftests/zram/zram.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+TCID="zram.sh"
+
+run_zram () {
+echo ""
+echo "running zram tests"
+echo ""
+./zram01.sh
+./zram02.sh
+}
+
+# check zram module exists
+MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
+if [ -f $MODULE_PATH ]; then
+   run_zram
+elif [ -b /dev/zram0 ]; then
+   run_zram
+else
+   echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
+   echo "$TCID : CONFIG_ZRAM is not set"
+   exit 1
+fi
diff --git a/tools/testing/selftests/zram/zram01.sh 
b/tools/testing/selftests/zram/zram01.sh
new file mode 100755
index 000..2a2475d
--- /dev/null
+++ b/tools/testing/selftests/zram/zram01.sh
@@ -0,0 +1,98 @@
+#!/bin/bash
+# Copyright (c) 2015 Oracle and/or its affiliates. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more d