summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAge
* btrfs-progs: reorganize extent_buffer and fix alignment of dataDavid Sterba2016-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reported by UBSAN, the checksum code tries to access unaligned data that come from the extent_buffer. struct extent_buffer { struct cache_extent cache_node; /* 0 48 */ u64 start; /* 48 8 */ u64 dev_bytenr; /* 56 8 */ /* --- cacheline 1 boundary (64 bytes) --- */ u32 len; /* 64 4 */ /* XXX 4 bytes hole, try to pack */ struct extent_io_tree * tree; /* 72 8 */ struct list_head lru; /* 80 16 */ struct list_head recow; /* 96 16 */ int refs; /* 112 4 */ u32 flags; /* 116 4 */ int fd; /* 120 4 */ char data[0]; /* 124 0 */ /* size: 128, cachelines: 2, members: 11 */ /* sum members: 120, holes: 1, sum holes: 4 */ /* padding: 4 */ }; Add explicit alignment to data. Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=156471 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 021-partially-dropped-snapshot-caseWang Xiaoguang2016-09-21
| | | | | Signed-off-by: Wang Xiaoguang <wangxg.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed images for bad block group offsetDavid Sterba2016-09-21
| | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: run check with various options on the fuzzed imagesDavid Sterba2016-09-21
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzz test to try btrfs-image on all imagesDavid Sterba2016-09-21
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: rename test 001 to mention checkDavid Sterba2016-09-21
| | | | | | Make it more clear that the test does 'btrfs check'. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed image for a bad backrefDavid Sterba2016-09-21
| | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: post btrfs-convert verify permissions and ACLsLakshmipathi.G2016-09-21
| | | | | Signed-off-by: Lakshmipathi.G <Lakshmipathi.G@giis.co.in> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed image for heap overflow while checking chunk ↵David Sterba2016-09-05
| | | | | | | items Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed image for invalid chunk sectorsizeDavid Sterba2016-09-05
| | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed image for invalid sys_array and stripe_lenDavid Sterba2016-09-05
| | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fuzzed image for invalid sub_stripe valueDavid Sterba2016-09-05
| | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 015-dump-super-garbageDavid Sterba2016-09-05
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests README: fuzzed imagesDavid Sterba2016-09-05
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fuzz-test: Add test case for unaligned extent itemQu Wenruo2016-09-05
| | | | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ added bko-NNN- prefix to the files ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fuzz-test: Add test case for invalid drop levelQu Wenruo2016-09-05
| | | | | | | Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ added bko-NNN- prefix to the files ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fuzz-test: Add image for unaligned tree block ptrQu Wenruo2016-09-05
| | | | | | | | | | Add test case image for unaligned tree block ptr. It should lead to BUG_ON in free_extent_buffer(). Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ added bko-NNN- prefix to the files ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fuzz-test: Add image for wrong chunk item in root treeQu Wenruo2016-09-05
| | | | | | | | | | | | | | Reported by Lukas and the same image from him. DATA_RELOC tree's key type is modifed to CHUNK_ITEM, causing btrfsck interpret it as CHUNK_ITEM and cause 0 num_stripes. Add the image to fuzz-test. Reported-by: Lukas Lueg <lukas.lueg@gmail.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> [ added bko-NNN- prefix to the files ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-test: Check if the ext2_save/image is read onlyQu Wenruo2016-08-19
| | | | | | | | | | | | | | | Old convert codes uses both 0400 permission and INODE_READONLY flag to make the converted ext2 image readonly. While new convert treat the inode just as normal inode, with no special inode flag and uses 0600 permission. This makes user able to modify converted image unintentionally and make rollback fails. This test case will test the regression. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 007-unsupported-block-sizesDavid Sterba2016-07-15
| | | | | | Check if block sizes smaller than 4k expectedly fail to convert. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 006-image-on-missing-device: fix btrfs tool pathLuis Henriques2016-07-13
| | | | | | | | | | | | | | | | If btrfs isn't in the path, this test will fail with: [TEST/misc] 006-image-on-missing-device failed: btrfs fi show /dev/loop0 test failed for case 006-image-on-missing-device Makefile:226: recipe for target 'test-misc' failed make: *** [test-misc] Error 1 Fix the test script by adding $TOP to the path. Signed-off-by: Luis Henriques <henrix@camandro.org> [ updated to full command names ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: use /bin/bash for scriptsDavid Sterba2016-07-04
| | | | | | Since we use 'source' in scripts, let's use bash everywhere. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-test: Add test case for discontinuous hole extentQu Wenruo2016-07-04
| | | | | | | | | | | | | For ext* fs containing a large hole(larger than 128M), btrfs-convert will only insert one 128M hole extent and skip the remaining. This leads to discontinuous file extents. Add test case for it, and since it's a pinpoint regression test case, no combination of convert options nor checksum verification. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 001-simple-unmounted: fix test failure due to bashismLuis Henriques2016-07-04
| | | | | | | | | | | | | | | | | | The usage of 'source' is a bashism, and '.' should be used instead. This is causing fuzz-tests/001-simple-unmounted to fail in systems where /bin/sh isn't bash: [TEST/fuzz] 001-simple-unmounted ./test.sh: 5: ./test.sh: source: not found ./test.sh: 7: ./test.sh: setup_root_helper: not found ./test.sh: 8: ./test.sh: check_prereq: not found ./test.sh: 18: ./test.sh: check_all_images: not found Since most (all?) tests actually use /bin/bash, change this test to use bash too. Signed-off-by: Luis Henriques <henrix@camandro.org> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix filesytem type creation for convert testsDavid Sterba2016-06-22
| | | | | | | | The extN filesystem type was lost when the separate tests were created and we've been testing only ext2. The tests pass for ext3 and ext4 though. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 005-delete-all-rollbackDavid Sterba2016-06-22
| | | | | | Test if a rollback works after deleing all files from btrfs. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: update READMEDavid Sterba2016-06-22
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add test consoleDavid Sterba2016-06-22
| | | | | | | | Add a wrapper that sets up environment the same way a test would use it. Use it for quick prototyping or testing, the commands and output is logged. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: print shorter test name in the outputDavid Sterba2016-06-22
| | | | | | | The full path is printed, we're interested in the last path component only. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: split convert_testDavid Sterba2016-06-22
| | | | | | | Split the big function to several helpers so we can use them separately. Add comments and do minor tweaks. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 003-fi-resize-argsDavid Sterba2016-06-17
| | | | | | Check various resize option combinations. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 004-ext2-backup-superblock-ranges, use common helpers ↵David Sterba2016-06-03
| | | | | | for image loop Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: 004-ext2-backup-superblock-ranges, drop unnecessary root ↵David Sterba2016-06-03
| | | | | | | | | | privs We really use root only for mount/umount and access to the ext2_saved image (that has 0600). Also switch to common variable so we can use helpers. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: unify test driversDavid Sterba2016-06-03
| | | | | | Remove unnecessary code, add exports to all common variables. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert: set common variablesDavid Sterba2016-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: clean up the test driver of convert testsDavid Sterba2016-06-03
| | | | | | Everything is now in separate tests, and TEST=mask now works. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert: separate ext4 testsDavid Sterba2016-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert: separate ext3 testsDavid Sterba2016-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert: separate ext2 testsDavid Sterba2016-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: move convert helpers to a separate fileDavid Sterba2016-06-03
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-tests: Add test case for backup superblock migrationQu Wenruo2016-06-03
| | | | | | | | | | | | | | | | | | | | | | New convert introduced simpler chunk/extent allocation algorithm, at the cost of complex backup superblock migration codes. Use specially built ext2 images to test if btrfs-convert can convert and rollback images without problem. All these special ext2 image have blocks/holes across 2nd btrfs backup superblock. The naming of test image is like the following: |<------superblock migration range----->| 64M 64M + 64K |-Data--|-Data--|/Hole//|-Data--|/Hole//|-Data--|--Data--| = drdhdhdrd These test cases should check all typical layouts and make sure new convert works. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-tests: Add support for custom test scriptsQu Wenruo2016-06-03
| | | | | | | | | | | | | Add support for custom convert test scripts, just like fsck tests. Instead of generic convert tests, we need more specifically created images for new convert tests. This patch provide the needed infrastructure for later convert test cases. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-tests: Add test for backup superblock migrationQu Wenruo2016-06-01
| | | | | | | | | | | | | | New convert framework uses new and simpler chunk layout, while the cost is the more complex superblock range migration logical, compared to old convert. Enhance the convert test script to create file which will takes up 2nd backup superblock space, to ensure the superblock migration is working as expected. Suggested-by: David Sterba <dsterba@suse.cz> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: document cli-tests in readmeDavid Sterba2016-06-01
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert: dump all superblocks after conversionDavid Sterba2016-06-01
| | | | | | We want to see all of them, even if they're not valid. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: run rollback after conversionDavid Sterba2016-06-01
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: convert, run md5sum with sudo helperDavid Sterba2016-06-01
| | | | | | | Some of the files might not end up in the checksum list because of permissions. This is reported by md5sum as incorrectly formatted lines. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add 020-extent-ref-casesLu Fengqi2016-06-01
| | | | | | | | | | | | | | | In order to confirm that btrfsck supports to check a variety of refs, add the following cases: * keyed_block_ref * keyed_data_ref * shared_block_ref * shared_data_ref * no_inline_ref (a extent item without inline ref) * no_skinny_ref Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: add fuzzed testing images, superblock and chunksLiu Bo2016-05-11
| | | | | | | | | | This adds 4 fuzz testing images, btrfsck either doesn't detect errors in them or crashes immediately. Reported-by: Vegard Nossum <vegard.nossum@oracle.com> Reported-by: Quentin Casasnovas <quentin.casasnovas@oracle.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>