All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] some fincore fixes
@ 2017-04-06  7:56 Ruediger Meier
  2017-04-06  7:56 ` [PATCH 1/5] tests: remove fincore SMALLER_THAN_PAGESIZE tests Ruediger Meier
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This patch-set tries to make the fincore tests more reliable on non-x86
systems and some non-default file systems. It discoverd one bug in
fincore itself.

Ruediger Meier (5):
  tests: remove fincore SMALLER_THAN_PAGESIZE tests
  tests: fix fincore/count for PAGE_SIZE != 4096
  fincore: fix multiplication overflow
  tests: handle dd errors in fincore/count
  tests: fincore/count, skip unsupported FS

 misc-utils/fincore.c                |  2 +-
 tests/expected/fincore/count        | 61 --------------------------------
 tests/expected/fincore/count.4096   | 55 +++++++++++++++++++++++++++++
 tests/expected/fincore/count.65536  | 55 +++++++++++++++++++++++++++++
 tests/expected/fincore/count.nosize | 55 +++++++++++++++++++++++++++++
 tests/ts/fincore/count              | 70 ++++++++++++++++++++++++++-----------
 6 files changed, 215 insertions(+), 83 deletions(-)
 delete mode 100644 tests/expected/fincore/count
 create mode 100644 tests/expected/fincore/count.4096
 create mode 100644 tests/expected/fincore/count.65536
 create mode 100644 tests/expected/fincore/count.nosize

-- 
1.8.5.6


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

* [PATCH 1/5] tests: remove fincore SMALLER_THAN_PAGESIZE tests
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
@ 2017-04-06  7:56 ` Ruediger Meier
  2017-04-06  7:56 ` [PATCH 2/5] tests: fix fincore/count for PAGE_SIZE != 4096 Ruediger Meier
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

These tests failed for example on ext4 with a non-default
blocksize 1024. In this case it seems that the kernel only
caches a full page if we read at least PAGE_SIZE -BLOCK_SIZE +1.

Both tests also failed on NFS allthough block size seems to be
1M there.

We still keep the test for PAGE_SIZE-1 which seems to work more
reliable.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/expected/fincore/count | 6 ------
 tests/ts/fincore/count       | 8 --------
 2 files changed, 14 deletions(-)

diff --git a/tests/expected/fincore/count b/tests/expected/fincore/count
index d5ce062..4665136 100644
--- a/tests/expected/fincore/count
+++ b/tests/expected/fincore/count
@@ -3,16 +3,12 @@ fincore: failed to open: no_such_file: No such file or directory
 return value: 1
     0    0 i_EMPTY_FILE
 return value: 0
-    1  2048 i_SMALLER_THAN_PAGESIZE__incore_
-return value: 0
     1  4095 i_PAGESIZE_-1__incore_
 return value: 0
     1  4096 i_JUST_PAGESIZE_incore_
 return value: 0
     0  4096 i_JUST_PAGESIZE_directio_
 return value: 0
-    2  4097 i_PAGESIZE_+_1__incore_
-return value: 0
     2  8192 i_TWO_PAGES_incore_
 return value: 0
     0  8192 i_TWO_PAGES_directio_
@@ -41,11 +37,9 @@ return value: 0
 fincore: failed to open: no_such_file: No such file or directory
 PAGES      SIZE FILE
     0         0 i_EMPTY_FILE
-    1      2048 i_SMALLER_THAN_PAGESIZE__incore_
     1      4095 i_PAGESIZE_-1__incore_
     1      4096 i_JUST_PAGESIZE_incore_
     0      4096 i_JUST_PAGESIZE_directio_
-    2      4097 i_PAGESIZE_+_1__incore_
     2      8192 i_TWO_PAGES_incore_
     0      8192 i_TWO_PAGES_directio_
     1      8192 i_TWO_PAGES_mixed_directio_incore_
diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index 87e25a8..8f23fec 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -92,10 +92,6 @@ input=
 } >> $TS_OUTPUT 2>&1
 
 {
-    run_dd_test "SMALLER THAN PAGESIZE (incore)" $(( PAGE_SIZE / 2 ))
-} >> $TS_OUTPUT 2>&1
-
-{
     run_dd_test "PAGESIZE -1 (incore)" $(( PAGE_SIZE - 1 ))
 } >> $TS_OUTPUT 2>&1
 
@@ -108,10 +104,6 @@ input=
 } >> $TS_OUTPUT 2>&1
 
 {
-    run_dd_test "PAGESIZE + 1 (incore)" $(( PAGE_SIZE + 1 ))
-} >> $TS_OUTPUT 2>&1
-
-{
     run_dd_test "TWO PAGES(incore)" $(( 2 * PAGE_SIZE ))
 } >> $TS_OUTPUT 2>&1
 
-- 
1.8.5.6


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

* [PATCH 2/5] tests: fix fincore/count for PAGE_SIZE != 4096
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
  2017-04-06  7:56 ` [PATCH 1/5] tests: remove fincore SMALLER_THAN_PAGESIZE tests Ruediger Meier
@ 2017-04-06  7:56 ` Ruediger Meier
  2017-04-06  7:56 ` [PATCH 3/5] fincore: fix multiplication overflow Ruediger Meier
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/expected/fincore/count        | 55 -------------------------------------
 tests/expected/fincore/count.4096   | 55 +++++++++++++++++++++++++++++++++++++
 tests/expected/fincore/count.65536  | 55 +++++++++++++++++++++++++++++++++++++
 tests/expected/fincore/count.nosize | 55 +++++++++++++++++++++++++++++++++++++
 tests/ts/fincore/count              | 18 +++++++++---
 5 files changed, 179 insertions(+), 59 deletions(-)
 delete mode 100644 tests/expected/fincore/count
 create mode 100644 tests/expected/fincore/count.4096
 create mode 100644 tests/expected/fincore/count.65536
 create mode 100644 tests/expected/fincore/count.nosize

diff --git a/tests/expected/fincore/count b/tests/expected/fincore/count
deleted file mode 100644
index 4665136..0000000
--- a/tests/expected/fincore/count
+++ /dev/null
@@ -1,55 +0,0 @@
-[ NO EXCITING FILE ]
-fincore: failed to open: no_such_file: No such file or directory
-return value: 1
-    0    0 i_EMPTY_FILE
-return value: 0
-    1  4095 i_PAGESIZE_-1__incore_
-return value: 0
-    1  4096 i_JUST_PAGESIZE_incore_
-return value: 0
-    0  4096 i_JUST_PAGESIZE_directio_
-return value: 0
-    2  8192 i_TWO_PAGES_incore_
-return value: 0
-    0  8192 i_TWO_PAGES_directio_
-return value: 0
-    1  8192 i_TWO_PAGES_mixed_directio_incore_
-return value: 0
-    1  8192 i_TWO_PAGES_mixed_incore_directio_
-return value: 0
-    2 134213632 i_WINDOW_SIZE_incore-sparse-incore_
-return value: 0
-    0 134213632 i_WINDOW_SIZE_directio-sparse-directio_
-return value: 0
-    1 134213632 i_WINDOW_SIZE_incore-sparse-directio_
-return value: 0
-    1 134213632 i_WINDOW_SIZE_directio-sparse-incore_
-return value: 0
-    2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
-return value: 0
-    0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
-return value: 0
-    1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
-return value: 0
-    1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
-return value: 0
-[ MULTIPLE FILES ]
-fincore: failed to open: no_such_file: No such file or directory
-PAGES      SIZE FILE
-    0         0 i_EMPTY_FILE
-    1      4095 i_PAGESIZE_-1__incore_
-    1      4096 i_JUST_PAGESIZE_incore_
-    0      4096 i_JUST_PAGESIZE_directio_
-    2      8192 i_TWO_PAGES_incore_
-    0      8192 i_TWO_PAGES_directio_
-    1      8192 i_TWO_PAGES_mixed_directio_incore_
-    1      8192 i_TWO_PAGES_mixed_incore_directio_
-    2 134213632 i_WINDOW_SIZE_incore-sparse-incore_
-    0 134213632 i_WINDOW_SIZE_directio-sparse-directio_
-    1 134213632 i_WINDOW_SIZE_incore-sparse-directio_
-    1 134213632 i_WINDOW_SIZE_directio-sparse-incore_
-    2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
-    0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
-    1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
-    1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
-return value: 1
diff --git a/tests/expected/fincore/count.4096 b/tests/expected/fincore/count.4096
new file mode 100644
index 0000000..4665136
--- /dev/null
+++ b/tests/expected/fincore/count.4096
@@ -0,0 +1,55 @@
+[ NO EXCITING FILE ]
+fincore: failed to open: no_such_file: No such file or directory
+return value: 1
+    0    0 i_EMPTY_FILE
+return value: 0
+    1  4095 i_PAGESIZE_-1__incore_
+return value: 0
+    1  4096 i_JUST_PAGESIZE_incore_
+return value: 0
+    0  4096 i_JUST_PAGESIZE_directio_
+return value: 0
+    2  8192 i_TWO_PAGES_incore_
+return value: 0
+    0  8192 i_TWO_PAGES_directio_
+return value: 0
+    1  8192 i_TWO_PAGES_mixed_directio_incore_
+return value: 0
+    1  8192 i_TWO_PAGES_mixed_incore_directio_
+return value: 0
+    2 134213632 i_WINDOW_SIZE_incore-sparse-incore_
+return value: 0
+    0 134213632 i_WINDOW_SIZE_directio-sparse-directio_
+return value: 0
+    1 134213632 i_WINDOW_SIZE_incore-sparse-directio_
+return value: 0
+    1 134213632 i_WINDOW_SIZE_directio-sparse-incore_
+return value: 0
+    2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+return value: 0
+    0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+return value: 0
+    1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+return value: 0
+    1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 0
+[ MULTIPLE FILES ]
+fincore: failed to open: no_such_file: No such file or directory
+PAGES      SIZE FILE
+    0         0 i_EMPTY_FILE
+    1      4095 i_PAGESIZE_-1__incore_
+    1      4096 i_JUST_PAGESIZE_incore_
+    0      4096 i_JUST_PAGESIZE_directio_
+    2      8192 i_TWO_PAGES_incore_
+    0      8192 i_TWO_PAGES_directio_
+    1      8192 i_TWO_PAGES_mixed_directio_incore_
+    1      8192 i_TWO_PAGES_mixed_incore_directio_
+    2 134213632 i_WINDOW_SIZE_incore-sparse-incore_
+    0 134213632 i_WINDOW_SIZE_directio-sparse-directio_
+    1 134213632 i_WINDOW_SIZE_incore-sparse-directio_
+    1 134213632 i_WINDOW_SIZE_directio-sparse-incore_
+    2 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+    0 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+    1 134217728 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+    1 134217728 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 1
diff --git a/tests/expected/fincore/count.65536 b/tests/expected/fincore/count.65536
new file mode 100644
index 0000000..0a9fab4
--- /dev/null
+++ b/tests/expected/fincore/count.65536
@@ -0,0 +1,55 @@
+[ NO EXCITING FILE ]
+fincore: failed to open: no_such_file: No such file or directory
+return value: 1
+    0    0 i_EMPTY_FILE
+return value: 0
+    1 65535 i_PAGESIZE_-1__incore_
+return value: 0
+    1 65536 i_JUST_PAGESIZE_incore_
+return value: 0
+    0 65536 i_JUST_PAGESIZE_directio_
+return value: 0
+    2 131072 i_TWO_PAGES_incore_
+return value: 0
+    0 131072 i_TWO_PAGES_directio_
+return value: 0
+    1 131072 i_TWO_PAGES_mixed_directio_incore_
+return value: 0
+    1 131072 i_TWO_PAGES_mixed_incore_directio_
+return value: 0
+    2 2147418112 i_WINDOW_SIZE_incore-sparse-incore_
+return value: 0
+    0 2147418112 i_WINDOW_SIZE_directio-sparse-directio_
+return value: 0
+    1 2147418112 i_WINDOW_SIZE_incore-sparse-directio_
+return value: 0
+    1 2147418112 i_WINDOW_SIZE_directio-sparse-incore_
+return value: 0
+    2 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+return value: 0
+    0 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+return value: 0
+    1 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+return value: 0
+    1 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 0
+[ MULTIPLE FILES ]
+fincore: failed to open: no_such_file: No such file or directory
+PAGES       SIZE FILE
+    0          0 i_EMPTY_FILE
+    1      65535 i_PAGESIZE_-1__incore_
+    1      65536 i_JUST_PAGESIZE_incore_
+    0      65536 i_JUST_PAGESIZE_directio_
+    2     131072 i_TWO_PAGES_incore_
+    0     131072 i_TWO_PAGES_directio_
+    1     131072 i_TWO_PAGES_mixed_directio_incore_
+    1     131072 i_TWO_PAGES_mixed_incore_directio_
+    2 2147418112 i_WINDOW_SIZE_incore-sparse-incore_
+    0 2147418112 i_WINDOW_SIZE_directio-sparse-directio_
+    1 2147418112 i_WINDOW_SIZE_incore-sparse-directio_
+    1 2147418112 i_WINDOW_SIZE_directio-sparse-incore_
+    2 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+    0 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+    1 2147483648 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+    1 2147483648 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 1
diff --git a/tests/expected/fincore/count.nosize b/tests/expected/fincore/count.nosize
new file mode 100644
index 0000000..d570445
--- /dev/null
+++ b/tests/expected/fincore/count.nosize
@@ -0,0 +1,55 @@
+[ NO EXCITING FILE ]
+fincore: failed to open: no_such_file: No such file or directory
+return value: 1
+    0 i_EMPTY_FILE
+return value: 0
+    1 i_PAGESIZE_-1__incore_
+return value: 0
+    1 i_JUST_PAGESIZE_incore_
+return value: 0
+    0 i_JUST_PAGESIZE_directio_
+return value: 0
+    2 i_TWO_PAGES_incore_
+return value: 0
+    0 i_TWO_PAGES_directio_
+return value: 0
+    1 i_TWO_PAGES_mixed_directio_incore_
+return value: 0
+    1 i_TWO_PAGES_mixed_incore_directio_
+return value: 0
+    2 i_WINDOW_SIZE_incore-sparse-incore_
+return value: 0
+    0 i_WINDOW_SIZE_directio-sparse-directio_
+return value: 0
+    1 i_WINDOW_SIZE_incore-sparse-directio_
+return value: 0
+    1 i_WINDOW_SIZE_directio-sparse-incore_
+return value: 0
+    2 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+return value: 0
+    0 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+return value: 0
+    1 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+return value: 0
+    1 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 0
+[ MULTIPLE FILES ]
+fincore: failed to open: no_such_file: No such file or directory
+PAGES FILE
+    0 i_EMPTY_FILE
+    1 i_PAGESIZE_-1__incore_
+    1 i_JUST_PAGESIZE_incore_
+    0 i_JUST_PAGESIZE_directio_
+    2 i_TWO_PAGES_incore_
+    0 i_TWO_PAGES_directio_
+    1 i_TWO_PAGES_mixed_directio_incore_
+    1 i_TWO_PAGES_mixed_incore_directio_
+    2 i_WINDOW_SIZE_incore-sparse-incore_
+    0 i_WINDOW_SIZE_directio-sparse-directio_
+    1 i_WINDOW_SIZE_incore-sparse-directio_
+    1 i_WINDOW_SIZE_directio-sparse-incore_
+    2 i_WINDOW_SIZE_+_1_page_incore-sparse-incore_
+    0 i_WINDOW_SIZE_+_1_page_directio-sparse-directio_
+    1 i_WINDOW_SIZE_+_1_page_incore-sparse-directio_
+    1 i_WINDOW_SIZE_+_1_page_directio-sparse-incore_
+return value: 1
diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index 8f23fec..be81552 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -32,7 +32,7 @@ function run_dd_test
 	$DD if=/dev/zero of=$input count=1 bs=$bs $flags &> /dev/null
     fi
 
-    $TS_CMD_FINCORE --output PAGES,SIZE,FILE  --bytes --noheadings $input
+    $TS_CMD_FINCORE --output $COLUMNS  --bytes --noheadings $input
 
     footer "$?"
 }
@@ -51,7 +51,7 @@ function run_dd_dd_test
     $DD if=/dev/zero of=$input count=1 bs=$bs $flags0 &> /dev/null
     $DD if=/dev/zero of=$input count=1 bs=$bs $flags1 &> /dev/null
 
-    $TS_CMD_FINCORE --output PAGES,SIZE,FILE --bytes --noheadings $input
+    $TS_CMD_FINCORE --output $COLUMNS --bytes --noheadings $input
 
     footer "$?"
 }
@@ -65,6 +65,16 @@ ts_init "$*"
 PAGE_SIZE=$($TS_HELPER_SYSINFO pagesize)
 WINDOW_SIZE=$(( 32 * 1024 * PAGE_SIZE ))
 
+# we use PAGE_SIZE dependent output for a few systems
+if test -f "$TS_EXPECTED.$PAGE_SIZE"; then
+	TS_EXPECTED+=".$PAGE_SIZE"
+	COLUMNS="PAGES,SIZE,FILE"
+else
+	TS_EXPECTED+=".nosize"
+	COLUMNS="PAGES,FILE"
+fi
+
+
 # seems unsupported by some dd(1) version
 #DD_FLAGS="status=none"
 
@@ -83,7 +93,7 @@ input=
     INPUT="${INPUT} ${input}"
 
     header "NO EXCITING FILE"
-    $TS_CMD_FINCORE --output PAGES,SIZE,FILE --bytes --noheadings $input
+    $TS_CMD_FINCORE --output $COLUMNS --bytes --noheadings $input
     footer "$?"
 } >> $TS_OUTPUT 2>&1
 
@@ -181,7 +191,7 @@ input=
 
 {
     header "MULTIPLE FILES"
-    $TS_CMD_FINCORE --output PAGES,SIZE,FILE --bytes $INPUT
+    $TS_CMD_FINCORE --output $COLUMNS --bytes $INPUT
     footer "$?"
 } >> $TS_OUTPUT 2>&1
 
-- 
1.8.5.6


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

* [PATCH 3/5] fincore: fix multiplication overflow
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
  2017-04-06  7:56 ` [PATCH 1/5] tests: remove fincore SMALLER_THAN_PAGESIZE tests Ruediger Meier
  2017-04-06  7:56 ` [PATCH 2/5] tests: fix fincore/count for PAGE_SIZE != 4096 Ruediger Meier
@ 2017-04-06  7:56 ` Ruediger Meier
  2017-04-06  7:56 ` [PATCH 4/5] tests: handle dd errors in fincore/count Ruediger Meier
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

This failed on ppc64 with page size 64k.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 misc-utils/fincore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/misc-utils/fincore.c b/misc-utils/fincore.c
index b867c2d..425f1bf 100644
--- a/misc-utils/fincore.c
+++ b/misc-utils/fincore.c
@@ -188,7 +188,7 @@ static int fincore_fd (struct fincore_control *ctl,
 		       off_t file_size,
 		       off_t *count_incore)
 {
-	size_t window_size = N_PAGES_IN_WINDOW * ctl->pagesize;
+	size_t window_size = (size_t)N_PAGES_IN_WINDOW * ctl->pagesize;
 	off_t  file_offset;
 	void  *window = NULL;
 	int rc = 0;
-- 
1.8.5.6


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

* [PATCH 4/5] tests: handle dd errors in fincore/count
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
                   ` (2 preceding siblings ...)
  2017-04-06  7:56 ` [PATCH 3/5] fincore: fix multiplication overflow Ruediger Meier
@ 2017-04-06  7:56 ` Ruediger Meier
  2017-04-06  7:56 ` [PATCH 5/5] tests: fincore/count, skip unsupported FS Ruediger Meier
  2017-04-06 10:43 ` [PATCH 0/5] some fincore fixes Karel Zak
  5 siblings, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

On dd error the test will fail earlier and the test diff will be
more useful.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/ts/fincore/count | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index be81552..fd50ff8 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -17,6 +17,20 @@ function make_input_name
     echo ${prefix}$(sed -e "s/[^-+a-zA-Z0-9_]/_/g"<<<"$header")
 }
 
+function _dd
+{
+	local msg
+	local ret=0
+
+	msg=$(dd "$@" 2>&1)
+	ret=$?
+	if [ $ret != 0 ]; then
+		echo "failed: dd $@" >&2
+		echo "$msg" >&2
+	fi
+	return $ret
+}
+
 function run_dd_test
 {
     header=$1
@@ -25,11 +39,12 @@ function run_dd_test
 
     input=$(make_input_name "$header")
     INPUT="${INPUT} ${input}"
+	rm -f "$input"
 
     if [ "$bs" = 0 ]; then
-	touch $input
+		touch $input
     else
-	$DD if=/dev/zero of=$input count=1 bs=$bs $flags &> /dev/null
+		_dd if=/dev/zero of=$input count=1 bs=$bs $flags || return
     fi
 
     $TS_CMD_FINCORE --output $COLUMNS  --bytes --noheadings $input
@@ -47,9 +62,10 @@ function run_dd_dd_test
 
     input=$(make_input_name "$header")
     INPUT="${INPUT} ${input}"
+	rm -f "$input"
 
-    $DD if=/dev/zero of=$input count=1 bs=$bs $flags0 &> /dev/null
-    $DD if=/dev/zero of=$input count=1 bs=$bs $flags1 &> /dev/null
+    _dd if=/dev/zero of=$input count=1 bs=$bs $flags0 || return
+    _dd if=/dev/zero of=$input count=1 bs=$bs $flags1 || return
 
     $TS_CMD_FINCORE --output $COLUMNS --bytes --noheadings $input
 
@@ -75,13 +91,6 @@ else
 fi
 
 
-# seems unsupported by some dd(1) version
-#DD_FLAGS="status=none"
-
-DD_FLAGS=
-DD="dd $DD_FLAGS"
-
-
 ts_check_test_command "$TS_CMD_FINCORE"
 ts_cd "$TS_OUTDIR"
 
-- 
1.8.5.6


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

* [PATCH 5/5] tests: fincore/count, skip unsupported FS
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
                   ` (3 preceding siblings ...)
  2017-04-06  7:56 ` [PATCH 4/5] tests: handle dd errors in fincore/count Ruediger Meier
@ 2017-04-06  7:56 ` Ruediger Meier
  2017-04-06 10:43 ` [PATCH 0/5] some fincore fixes Karel Zak
  5 siblings, 0 replies; 7+ messages in thread
From: Ruediger Meier @ 2017-04-06  7:56 UTC (permalink / raw)
  To: util-linux; +Cc: Masatake YAMATO

From: Ruediger Meier <ruediger.meier@ga-group.nl>

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
---
 tests/ts/fincore/count | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/ts/fincore/count b/tests/ts/fincore/count
index fd50ff8..ac58850 100755
--- a/tests/ts/fincore/count
+++ b/tests/ts/fincore/count
@@ -31,6 +31,21 @@ function _dd
 	return $ret
 }
 
+function check_dd_fs_feat
+{
+	local testf="$TS_OUTDIR/ddtest"
+	rm -f "$testf"
+	touch "$testf"
+
+	# NFS seems to fail for direct AND append
+	_dd if=/dev/zero of="$testf" bs=1K count=2 oflag=direct,append &>/dev/null \
+		|| ts_skip "unsupported: dd oflag=direct,append"
+
+	# TODO: Should we check for sparse file support?
+
+	rm -f "$testf"
+}
+
 function run_dd_test
 {
     header=$1
@@ -94,6 +109,8 @@ fi
 ts_check_test_command "$TS_CMD_FINCORE"
 ts_cd "$TS_OUTDIR"
 
+check_dd_fs_feat
+
 INPUT=
 input=
 
-- 
1.8.5.6


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

* Re: [PATCH 0/5] some fincore fixes
  2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
                   ` (4 preceding siblings ...)
  2017-04-06  7:56 ` [PATCH 5/5] tests: fincore/count, skip unsupported FS Ruediger Meier
@ 2017-04-06 10:43 ` Karel Zak
  5 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2017-04-06 10:43 UTC (permalink / raw)
  To: Ruediger Meier; +Cc: util-linux, Masatake YAMATO

On Thu, Apr 06, 2017 at 09:56:00AM +0200, Ruediger Meier wrote:
> This patch-set tries to make the fincore tests more reliable on non-x86
> systems and some non-default file systems. It discoverd one bug in
> fincore itself.

Applied, thanks.

> Ruediger Meier (5):
>   tests: remove fincore SMALLER_THAN_PAGESIZE tests
>   tests: fix fincore/count for PAGE_SIZE != 4096
>   fincore: fix multiplication overflow

I have removed "int" from the code at all for the sizes.

>   tests: handle dd errors in fincore/count
>   tests: fincore/count, skip unsupported FS

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

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

end of thread, other threads:[~2017-04-06 10:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06  7:56 [PATCH 0/5] some fincore fixes Ruediger Meier
2017-04-06  7:56 ` [PATCH 1/5] tests: remove fincore SMALLER_THAN_PAGESIZE tests Ruediger Meier
2017-04-06  7:56 ` [PATCH 2/5] tests: fix fincore/count for PAGE_SIZE != 4096 Ruediger Meier
2017-04-06  7:56 ` [PATCH 3/5] fincore: fix multiplication overflow Ruediger Meier
2017-04-06  7:56 ` [PATCH 4/5] tests: handle dd errors in fincore/count Ruediger Meier
2017-04-06  7:56 ` [PATCH 5/5] tests: fincore/count, skip unsupported FS Ruediger Meier
2017-04-06 10:43 ` [PATCH 0/5] some fincore fixes Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.