* [PATCH] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory
@ 2019-12-02 11:54 damenly.su
2019-12-02 12:35 ` [PATCH v2] " damenly.su
0 siblings, 1 reply; 4+ messages in thread
From: damenly.su @ 2019-12-02 11:54 UTC (permalink / raw)
To: linux-btrfs; +Cc: Damenly_Su
From: Su Yue <Damenly_Su@gmx.com>
Ran misc-tests/038 in /root/btrfs-progs:
======================================================================
make test-misc TEST=038\*
[TEST] misc-tests.sh
[TEST/misc] 038-backup-root-corruption
./test.sh: line 33: [: bytenr=65536,: integer expression expected
Backup slot 2 is not in use
test failed for case 038-backup-root-corruption
make: *** [Makefile:401: test-misc] Error 1
======================================================================
It's caused by the wrong line filtered by
$(dump_super | grep root | head -n1 | awk '{print $2}').
The $(dump-super | grep root) outputs
======================================================================
superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
root 30605312
chunk_root_generation 5
root_level 0
chunk_root 22036480
chunk_root_level 0
log_root 0
log_root_transid 0
log_root_level 0
root_dir 6
backup_roots[4]:
======================================================================
Here
"superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
selected but not the line "root 30605312".
Restricting the awk rule can fix it.
Fixes: 78a3831d46ec ("btrfs-progs: tests: Test backup root retention logic")
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
tests/misc-tests/038-backup-root-corruption/test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/misc-tests/038-backup-root-corruption/test.sh b/tests/misc-tests/038-backup-root-corruption/test.sh
index f15d0bba..e5979c76 100755
--- a/tests/misc-tests/038-backup-root-corruption/test.sh
+++ b/tests/misc-tests/038-backup-root-corruption/test.sh
@@ -23,7 +23,7 @@ dump_super() {
# Ensure currently active backup slot is the expected one (slot 3)
backup2_root_ptr=$(dump_super | grep -A1 "backup 2" | grep backup_tree_root | awk '{print $2}')
-main_root_ptr=$(dump_super | grep root | head -n1 | awk '{print $2}')
+main_root_ptr=$(dump_super | grep root | awk '^/root\t/{print $2}')
[ "$backup2_root_ptr" -eq "$main_root_ptr" ] || _fail "Backup slot 2 is not in use"
--
2.24.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory
2019-12-02 11:54 [PATCH] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory damenly.su
@ 2019-12-02 12:35 ` damenly.su
2019-12-02 13:08 ` Nikolay Borisov
2020-01-02 17:19 ` David Sterba
0 siblings, 2 replies; 4+ messages in thread
From: damenly.su @ 2019-12-02 12:35 UTC (permalink / raw)
To: linux-btrfs; +Cc: Damenly_Su
From: Su Yue <Damenly_Su@gmx.com>
Ran misc-tests/038 in /root/btrfs-progs:
======================================================================
make test-misc TEST=038\*
[TEST] misc-tests.sh
[TEST/misc] 038-backup-root-corruption
./test.sh: line 33: [: bytenr=65536,: integer expression expected
Backup slot 2 is not in use
test failed for case 038-backup-root-corruption
make: *** [Makefile:401: test-misc] Error 1
======================================================================
It's caused by the wrong line filtered by
$(dump_super | grep root | head -n1 | awk '{print $2}').
The $(dump-super | grep root) outputs
======================================================================
superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
root 30605312
chunk_root_generation 5
root_level 0
chunk_root 22036480
chunk_root_level 0
log_root 0
log_root_transid 0
log_root_level 0
root_dir 6
backup_roots[4]:
======================================================================
Here
"superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
selected but not the line "root 30605312".
Restricting the awk rule can fix it.
Fixes: 78a3831d46ec ("btrfs-progs: tests: Test backup root retention logic")
Signed-off-by: Su Yue <Damenly_Su@gmx.com>
---
Changelog:
v2:
The version 1 is with problematic rule. And remove grep.
---
tests/misc-tests/038-backup-root-corruption/test.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/misc-tests/038-backup-root-corruption/test.sh b/tests/misc-tests/038-backup-root-corruption/test.sh
index f15d0bbac291..1b3704169a88 100755
--- a/tests/misc-tests/038-backup-root-corruption/test.sh
+++ b/tests/misc-tests/038-backup-root-corruption/test.sh
@@ -23,7 +23,7 @@ dump_super() {
# Ensure currently active backup slot is the expected one (slot 3)
backup2_root_ptr=$(dump_super | grep -A1 "backup 2" | grep backup_tree_root | awk '{print $2}')
-main_root_ptr=$(dump_super | grep root | head -n1 | awk '{print $2}')
+main_root_ptr=$(dump_super | awk '/^root\t/{print $2}')
[ "$backup2_root_ptr" -eq "$main_root_ptr" ] || _fail "Backup slot 2 is not in use"
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory
2019-12-02 12:35 ` [PATCH v2] " damenly.su
@ 2019-12-02 13:08 ` Nikolay Borisov
2020-01-02 17:19 ` David Sterba
1 sibling, 0 replies; 4+ messages in thread
From: Nikolay Borisov @ 2019-12-02 13:08 UTC (permalink / raw)
To: damenly.su, linux-btrfs; +Cc: Damenly_Su
On 2.12.19 г. 14:35 ч., damenly.su@gmail.com wrote:
> From: Su Yue <Damenly_Su@gmx.com>
>
> Ran misc-tests/038 in /root/btrfs-progs:
> ======================================================================
> make test-misc TEST=038\*
> [TEST] misc-tests.sh
> [TEST/misc] 038-backup-root-corruption
> ./test.sh: line 33: [: bytenr=65536,: integer expression expected
> Backup slot 2 is not in use
> test failed for case 038-backup-root-corruption
> make: *** [Makefile:401: test-misc] Error 1
> ======================================================================
>
> It's caused by the wrong line filtered by
> $(dump_super | grep root | head -n1 | awk '{print $2}').
>
> The $(dump-super | grep root) outputs
> ======================================================================
> superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
> root 30605312
> chunk_root_generation 5
> root_level 0
> chunk_root 22036480
> chunk_root_level 0
> log_root 0
> log_root_transid 0
> log_root_level 0
> root_dir 6
> backup_roots[4]:
> ======================================================================
>
> Here
> "superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
> selected but not the line "root 30605312".
>
> Restricting the awk rule can fix it.
>
> Fixes: 78a3831d46ec ("btrfs-progs: tests: Test backup root retention logic")
> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> Changelog:
> v2:
> The version 1 is with problematic rule. And remove grep.
> ---
> tests/misc-tests/038-backup-root-corruption/test.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/misc-tests/038-backup-root-corruption/test.sh b/tests/misc-tests/038-backup-root-corruption/test.sh
> index f15d0bbac291..1b3704169a88 100755
> --- a/tests/misc-tests/038-backup-root-corruption/test.sh
> +++ b/tests/misc-tests/038-backup-root-corruption/test.sh
> @@ -23,7 +23,7 @@ dump_super() {
> # Ensure currently active backup slot is the expected one (slot 3)
> backup2_root_ptr=$(dump_super | grep -A1 "backup 2" | grep backup_tree_root | awk '{print $2}')
>
> -main_root_ptr=$(dump_super | grep root | head -n1 | awk '{print $2}')
> +main_root_ptr=$(dump_super | awk '/^root\t/{print $2}')
>
> [ "$backup2_root_ptr" -eq "$main_root_ptr" ] || _fail "Backup slot 2 is not in use"
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory
2019-12-02 12:35 ` [PATCH v2] " damenly.su
2019-12-02 13:08 ` Nikolay Borisov
@ 2020-01-02 17:19 ` David Sterba
1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2020-01-02 17:19 UTC (permalink / raw)
To: damenly.su; +Cc: linux-btrfs, Damenly_Su
On Mon, Dec 02, 2019 at 08:35:23PM +0800, damenly.su@gmail.com wrote:
> From: Su Yue <Damenly_Su@gmx.com>
>
> Ran misc-tests/038 in /root/btrfs-progs:
> ======================================================================
> make test-misc TEST=038\*
> [TEST] misc-tests.sh
> [TEST/misc] 038-backup-root-corruption
> ./test.sh: line 33: [: bytenr=65536,: integer expression expected
> Backup slot 2 is not in use
> test failed for case 038-backup-root-corruption
> make: *** [Makefile:401: test-misc] Error 1
> ======================================================================
>
> It's caused by the wrong line filtered by
> $(dump_super | grep root | head -n1 | awk '{print $2}').
>
> The $(dump-super | grep root) outputs
> ======================================================================
> superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img
> root 30605312
> chunk_root_generation 5
> root_level 0
> chunk_root 22036480
> chunk_root_level 0
> log_root 0
> log_root_transid 0
> log_root_level 0
> root_dir 6
> backup_roots[4]:
> ======================================================================
>
> Here
> "superblock: bytenr=65536, device=/root/btrfs-progs/tests/test.img" is
> selected but not the line "root 30605312".
>
> Restricting the awk rule can fix it.
>
> Fixes: 78a3831d46ec ("btrfs-progs: tests: Test backup root retention logic")
> Signed-off-by: Su Yue <Damenly_Su@gmx.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-02 17:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 11:54 [PATCH] btrfs-progs: misc-tests/038: fix wrong field filtered under root directory damenly.su
2019-12-02 12:35 ` [PATCH v2] " damenly.su
2019-12-02 13:08 ` Nikolay Borisov
2020-01-02 17:19 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).