linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [RFC PATCH 00/24] f2fs-tools: add testcases
@ 2024-10-29 12:09 Sheng Yong via Linux-f2fs-devel
  2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 01/24] f2fs-tools: add option N to answer no for all questions Sheng Yong via Linux-f2fs-devel
                   ` (23 more replies)
  0 siblings, 24 replies; 27+ messages in thread
From: Sheng Yong via Linux-f2fs-devel @ 2024-10-29 12:09 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-f2fs-devel

Hi, all

This patchset tries to add an auto testsuit for f2fs-tools (fsck only
for now).

The basic idea of these testcases are:
 1. create f2fs image
 2. corrupt the image by inject specific fields
 3. fsck fixes the image
 4. verify fsck output with expected message

Some helper scripts are provided:
 * test_config.in: is used to derive basic configurations of all
                   testcases.
 * runtests.in: is used to derive `runtests' which is used to run
                testcases.
 * filter.sed: removes unnecessary messages and cleanup arbitrary
               values.
 * helpers: provides helper functions

The usage of `runtests':
 * run all testcases:
     runtests
 * run one testcase:
     runtests <testcase directory path>
 * cleanup previous results:
     runtests clean

Some testcase requires root permission to mount the image and create
files.

Each testcase should have a sub-directory, where three files are needed:
 * README: describe information of the testcase
 * script: testcase itself
 * expect.in: is used to derive expected output message
an optional file is:
 * img.tar.gz: if some scenario is too complex to create by script, the
               gz file could be prepared in advance, and the operations
               of how to create the image should be described in README

New files are generated in the testcase directory after test:
 * log: output in detail
 * expect: derived from expect.in
 * out: output that will be compared with expect
 * PASS: testcase is passed
 * FAIL: testcase is failed, in which differ of out and expect is saved

The name of testcase directory has some optional prefix:
 * f_: fsck testcase
 * m_: mkfs testcase
But there are only fsck testcases for now.

To run testcases, it's better to compile fsck.f2fs as statically linked
executable, or `make install' installs tools and libraries. Otherwise,
libtool compiles f2fs-tools in debug mode and create a wrapper script
to locate elf executable and libraries. However, dump.f2fs and inject.f2fs
cannot be used in the wrapper way.

PATCH 1,2: change dump.f2fs 
PATCH 3: overwrite invalid cp with backup cp
PATCH 4~7: allow inject.f2fs to corrupt more fields
PATCH 8: add helper scripts for test
PATCH 9~end: add testcases

Sheng Yong (24):
  f2fs-tools: add option N to answer no for all questions
  dump.f2fs: print checkpoint crc
  fsck.f2fs: fix invalidate checkpoint
  inject.f2fs: add members in inject_cp
  inject.f2fs: add member `feature' in inject_sb
  inject.f2fs: add members in inject_node
  inject.f2fs: add member `filename' in inject_dentry
  tests: prepare helper scripts for testcases
  tests: add fsck testcase of fixing bad super magic
  tests: add fsck testcase of fixing errors recorded in sb
  tests: add fsck testcase of fixing cp crc
  tests: add fsck testcase of fixing nat entry with invalid ino
  tests: add fsck testcase of fixing nat entry with invalid blkaddr
  tests: add fsck testcase of fixing sit entry type
  tests: add fsck testcase of fixing sit entry vblocks
  tests: add fsck testcase of fixing sit entry valid_map
  tests: add fsck testcase of fixing sum entry nid
  tests: add fsck testcase of fixing sum footer type
  tests: add fsck testcase of fixing sum entry ofs_in_node
  tests: add fsck testcase of fixing invalid i_addr
  tests: add fsck testcase of fixing dentry hash code
  tests: add fsck testcase of fixing lost dots
  tests: add fsck testcase of fixing duplicated dots
  tests: add fsck testcase of fixing loop fsync dnodes

 .gitignore                            |  13 ++
 Makefile.am                           |   2 +-
 configure.ac                          |   1 +
 fsck/dump.c                           |   3 +
 fsck/f2fs.h                           |   6 +
 fsck/fsck.c                           |   2 +-
 fsck/fsck.h                           |   3 +-
 fsck/inject.c                         | 207 ++++++++++++++++++++++++--
 fsck/inject.h                         |   1 +
 fsck/main.c                           |  14 +-
 fsck/mount.c                          |  32 +++-
 include/f2fs_fs.h                     |   1 +
 man/inject.f2fs.8                     |  37 ++++-
 tests/Makefile.am                     |  28 ++++
 tests/f_cp_bad_crc/README             |   5 +
 tests/f_cp_bad_crc/expect.in          |  22 +++
 tests/f_cp_bad_crc/script             |  46 ++++++
 tests/f_dentry_bad_hash/README        |   8 +
 tests/f_dentry_bad_hash/expect.in     |  62 ++++++++
 tests/f_dentry_bad_hash/script        |  71 +++++++++
 tests/f_dentry_dup_dots/README        |  11 ++
 tests/f_dentry_dup_dots/expect.in     | 150 +++++++++++++++++++
 tests/f_dentry_dup_dots/script        |  58 ++++++++
 tests/f_dentry_lost_dots/README       |   7 +
 tests/f_dentry_lost_dots/expect.in    |  74 +++++++++
 tests/f_dentry_lost_dots/script       |  46 ++++++
 tests/f_inode_bad_iaddr/README        |   6 +
 tests/f_inode_bad_iaddr/expect.in     |  38 +++++
 tests/f_inode_bad_iaddr/script        |  58 ++++++++
 tests/f_loop_fsync_dnodes/README      |  39 +++++
 tests/f_loop_fsync_dnodes/expect.in   |  40 +++++
 tests/f_loop_fsync_dnodes/imgs.tar.gz | Bin 0 -> 173228 bytes
 tests/f_loop_fsync_dnodes/script      |  16 ++
 tests/f_nat_bad_blkaddr/README        |   4 +
 tests/f_nat_bad_blkaddr/expect.in     |  39 +++++
 tests/f_nat_bad_blkaddr/script        |  35 +++++
 tests/f_nat_bad_ino/README            |   4 +
 tests/f_nat_bad_ino/expect.in         |  39 +++++
 tests/f_nat_bad_ino/script            |  39 +++++
 tests/f_sb_bad_magic/README           |   3 +
 tests/f_sb_bad_magic/expect.in        |  40 +++++
 tests/f_sb_bad_magic/script           |  16 ++
 tests/f_sb_errors/README              |   5 +
 tests/f_sb_errors/expect.in           |  59 ++++++++
 tests/f_sb_errors/script              |  23 +++
 tests/f_sit_bad_type/README           |   5 +
 tests/f_sit_bad_type/expect.in        |  34 +++++
 tests/f_sit_bad_type/script           |  45 ++++++
 tests/f_sit_bad_valid_map/README      |   5 +
 tests/f_sit_bad_valid_map/expect.in   |  35 +++++
 tests/f_sit_bad_valid_map/script      |  50 +++++++
 tests/f_sit_bad_vblocks/README        |   5 +
 tests/f_sit_bad_vblocks/expect.in     |  34 +++++
 tests/f_sit_bad_vblocks/script        |  45 ++++++
 tests/f_ssa_bad_nid/README            |   5 +
 tests/f_ssa_bad_nid/expect.in         |  34 +++++
 tests/f_ssa_bad_nid/script            |  44 ++++++
 tests/f_ssa_bad_ofs_in_node/README    |   5 +
 tests/f_ssa_bad_ofs_in_node/expect.in |  34 +++++
 tests/f_ssa_bad_ofs_in_node/script    |  44 ++++++
 tests/f_ssa_bad_type/README           |   5 +
 tests/f_ssa_bad_type/expect.in        |  34 +++++
 tests/f_ssa_bad_type/script           |  39 +++++
 tests/filter.sed                      |  60 ++++++++
 tests/helpers                         | 157 +++++++++++++++++++
 tests/runtests.in                     |  46 ++++++
 tests/test_config.in                  |  47 ++++++
 67 files changed, 2196 insertions(+), 29 deletions(-)
 create mode 100644 tests/Makefile.am
 create mode 100644 tests/f_cp_bad_crc/README
 create mode 100644 tests/f_cp_bad_crc/expect.in
 create mode 100644 tests/f_cp_bad_crc/script
 create mode 100644 tests/f_dentry_bad_hash/README
 create mode 100644 tests/f_dentry_bad_hash/expect.in
 create mode 100644 tests/f_dentry_bad_hash/script
 create mode 100644 tests/f_dentry_dup_dots/README
 create mode 100644 tests/f_dentry_dup_dots/expect.in
 create mode 100644 tests/f_dentry_dup_dots/script
 create mode 100644 tests/f_dentry_lost_dots/README
 create mode 100644 tests/f_dentry_lost_dots/expect.in
 create mode 100644 tests/f_dentry_lost_dots/script
 create mode 100644 tests/f_inode_bad_iaddr/README
 create mode 100644 tests/f_inode_bad_iaddr/expect.in
 create mode 100644 tests/f_inode_bad_iaddr/script
 create mode 100644 tests/f_loop_fsync_dnodes/README
 create mode 100644 tests/f_loop_fsync_dnodes/expect.in
 create mode 100644 tests/f_loop_fsync_dnodes/imgs.tar.gz
 create mode 100644 tests/f_loop_fsync_dnodes/script
 create mode 100644 tests/f_nat_bad_blkaddr/README
 create mode 100644 tests/f_nat_bad_blkaddr/expect.in
 create mode 100644 tests/f_nat_bad_blkaddr/script
 create mode 100644 tests/f_nat_bad_ino/README
 create mode 100644 tests/f_nat_bad_ino/expect.in
 create mode 100644 tests/f_nat_bad_ino/script
 create mode 100644 tests/f_sb_bad_magic/README
 create mode 100644 tests/f_sb_bad_magic/expect.in
 create mode 100644 tests/f_sb_bad_magic/script
 create mode 100644 tests/f_sb_errors/README
 create mode 100644 tests/f_sb_errors/expect.in
 create mode 100644 tests/f_sb_errors/script
 create mode 100644 tests/f_sit_bad_type/README
 create mode 100644 tests/f_sit_bad_type/expect.in
 create mode 100644 tests/f_sit_bad_type/script
 create mode 100644 tests/f_sit_bad_valid_map/README
 create mode 100644 tests/f_sit_bad_valid_map/expect.in
 create mode 100644 tests/f_sit_bad_valid_map/script
 create mode 100644 tests/f_sit_bad_vblocks/README
 create mode 100644 tests/f_sit_bad_vblocks/expect.in
 create mode 100644 tests/f_sit_bad_vblocks/script
 create mode 100644 tests/f_ssa_bad_nid/README
 create mode 100644 tests/f_ssa_bad_nid/expect.in
 create mode 100644 tests/f_ssa_bad_nid/script
 create mode 100644 tests/f_ssa_bad_ofs_in_node/README
 create mode 100644 tests/f_ssa_bad_ofs_in_node/expect.in
 create mode 100644 tests/f_ssa_bad_ofs_in_node/script
 create mode 100644 tests/f_ssa_bad_type/README
 create mode 100644 tests/f_ssa_bad_type/expect.in
 create mode 100644 tests/f_ssa_bad_type/script
 create mode 100644 tests/filter.sed
 create mode 100644 tests/helpers
 create mode 100644 tests/runtests.in
 create mode 100644 tests/test_config.in

-- 
2.40.1



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2024-11-08  6:51 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 12:09 [f2fs-dev] [RFC PATCH 00/24] f2fs-tools: add testcases Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 01/24] f2fs-tools: add option N to answer no for all questions Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 02/24] dump.f2fs: print checkpoint crc Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 03/24] fsck.f2fs: fix invalidate checkpoint Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 04/24] inject.f2fs: add members in inject_cp Sheng Yong via Linux-f2fs-devel
2024-11-08  2:09   ` Chao Yu via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 05/24] inject.f2fs: add member `feature' in inject_sb Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 06/24] inject.f2fs: add members in inject_node Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 07/24] inject.f2fs: add member `filename' in inject_dentry Sheng Yong via Linux-f2fs-devel
2024-11-08  6:51   ` Chao Yu via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 08/24] tests: prepare helper scripts for testcases Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 09/24] tests: add fsck testcase of fixing bad super magic Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 10/24] tests: add fsck testcase of fixing errors recorded in sb Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 11/24] tests: add fsck testcase of fixing cp crc Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 12/24] tests: add fsck testcase of fixing nat entry with invalid ino Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 13/24] tests: add fsck testcase of fixing nat entry with invalid blkaddr Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 14/24] tests: add fsck testcase of fixing sit entry type Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 15/24] tests: add fsck testcase of fixing sit entry vblocks Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 16/24] tests: add fsck testcase of fixing sit entry valid_map Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 17/24] tests: add fsck testcase of fixing sum entry nid Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 18/24] tests: add fsck testcase of fixing sum footer type Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 19/24] tests: add fsck testcase of fixing sum entry ofs_in_node Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 20/24] tests: add fsck testcase of fixing invalid i_addr Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 21/24] tests: add fsck testcase of fixing dentry hash code Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 22/24] tests: add fsck testcase of fixing lost dots Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 23/24] tests: add fsck testcase of fixing duplicated dots Sheng Yong via Linux-f2fs-devel
2024-10-29 12:09 ` [f2fs-dev] [RFC PATCH 24/24] tests: add fsck testcase of fixing loop fsync dnodes Sheng Yong via Linux-f2fs-devel

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).