summaryrefslogtreecommitdiff
path: root/tests/common
Commit message (Collapse)AuthorAge
* 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: 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: tests: introduce mustfail helperDavid Sterba2016-03-30
| | | | | | | Invalid syntax, expected failure on corrupted data etc. Failure is success. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do not log output of run_mayfail to terminalDavid Sterba2015-11-02
| | | | | | | No need to log expected failures to the terminal, the results file is fine; pass the return value of the command. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add support for command instrumentationDavid Sterba2015-11-02
| | | | | | | | | | | | | | | | | | Add a way to wrap commands executed by the tests. This means the common wrappers: run_check, run_check_stdout and run_mayfail , with the exception of the use root_helper. The contents of the shell variable INSTRUMENT are prepended to the command, without quotes. Use with care. Example: this has been tested with valgrind, the output goes to the RESULTS file. $ INSTRUMENT=valgrind make test-misc Any use of root_helper/SUDO_HELPER will skip the instrumentation. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: do not run sudo helper tests if not necessaryDavid Sterba2015-11-02
| | | | | | | | We use setup_root_helper in some helpers to make sure that the sudo helper is set up, and adding that to each test. Make the real test run only once. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: set default test image size to 2GDavid Sterba2015-11-02
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: print commands on terminal if requestedDavid Sterba2015-10-21
| | | | | | | | | Set the variable TEST_LOG=tty (in the enviroment or as parameter to make) to print commands executed by 'run_check' helpers to terminal (ie. /dev/tty). This might be useful to see the test progress beside watching the results file. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Avoid printing useless warning in fsck testsZhao Lei2015-10-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 002-bad-transid outout 'transid verify failed' message in screen which is just a warning in btrfs-image in normal condition of this test. This patch move above warning into $RESULTS, to: 1: Avoid trouble screen output 2: Let user known detail if other error happened in btrfs-image Before patch: # ./fsck-tests.sh [TEST] 001-bad-file-extent-bytenr [TEST] 002-bad-transid parent transid verify failed on 29360128 wanted 9 found 755944791 parent transid verify failed on 29360128 wanted 9 found 755944791 Ignoring transid failure [TEST] 003-shift-offsets [TEST] 004-no-dir-index ... After patch: # ./fsck-tests.sh [TEST] 001-bad-file-extent-bytenr [TEST] 002-bad-transid [TEST] 003-shift-offsets [TEST] 004-no-dir-index ... Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Move extract_image out of check_all_images for common useZhao Lei2015-10-19
| | | | | | | | | | Move code for extract image file to a function from check_all_images() for common use, so caller can use this function to extrace single image file. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> [minor reformatting and updates] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: introduce test dev mount helpersZhao Lei2015-09-01
| | | | | | | | | | | | | mount command in old system can not add "-o loop" option automatically for a loop device, and make following test 013-extent-tree-rebuild fail. Considering that $TEST_DEV can be block or loop device, we need to determine our mount option in a condition for both case. Introduce a wrapper that will add the loop options if needed. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Introduce init_env to initialize common env variantZhao Lei2015-09-01
| | | | | | | | | | | | | | | | | | | | | | | For example, $TEST_DIR is common used in severial tests, and have duplicated code for initialize. These duplicated code not only benifits harddisk vendor, but have inconsistent details, as: convert-tests.sh: lack of mkdir fsck-tests/012-leaf-corruption/test.sh: unnecessary mkdir fsck-tests/013-extent-tree-rebuild/test.sh: unnecessary init misc-tests/XXX ... And severial error message: _fail "unable to create mount point on $TEST_MNT" _fail "failed to create mount point" ... This patch move initizlizaton of $TEST_DIR to common init_env(), to avoid above problem, and init_env() can be used to add more things in future. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests, add more common helpersDavid Sterba2015-08-31
| | | | | | Add support for failures of commands, log the output. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Move code to create loop device to commonZhao Lei2015-08-31
| | | | | | | | This code block is used several tests, move it to ./common and add a helper. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: common: add helper run_check_stdoutDavid Sterba2015-06-02
| | | | | | | Sometimes we need to process the output of the command, but run_check captures all the output into results file. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: sort image filesDavid Sterba2015-05-25
| | | | | | | If a test has several images let filenames enforce a particular order of checks if desired. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests: support more formats of test imagesDavid Sterba2015-05-21
| | | | | | | We're using he meta-dump images, now we support compressed meta-dump, raw and compressed raw images. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: test-frame: Update variant namesQu Wenruo2015-04-07
| | | | | | | | | | | | Use upper case variant name for the following variants: 1) top -> TOP 2) script_dir -> SCRIPT_DIR And change the following variant name: 1) RESULT -> RESULTS Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, common: fix typo after cleanupDavid Sterba2015-03-10
| | | | | | | The previous value for unknown was -1. Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, clean up scriptsDavid Sterba2015-03-09
| | | | | | | Rename variables, use caps, call true by full path, add quotation to variables and a few wording fixes. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilegeQu Wenruo2015-03-09
| | | | | | | | | | | | | | | | | | | | | | Although fsck-test/012 uses sudo, it uses 'sudo -n', which won't prompt user to input password and will return 1 if no valid credential is found. And this makes test result quite annoying since it fails to mount and still continue, which will always fail. This patch will check 'sudo -v -n' and 'sudo -n true' to determine whether sudo works fine in different version/settings, since in some setting/version, 'sudo -v -n' will fail even the user is set NOPASSWD. Also, remove the 'have_root_helper' variant, since there is a possibility that sudo credential will timeout during the test and 'have_root_helper' won't help to detect such problem. New '_sudo' command will do credential check if needed to avoid such problem. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, use non-interactive sudo helperDavid Sterba2015-01-19
| | | | | | | | Sudo may not be configured to run without user prompt, in that case the tests would be stuck. Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: tests, add support for running commands under rootDavid Sterba2015-01-14
| | | | | | | | Most of the checks run fine without root, but some of them may need to do a mount test or access the data. Add the support to selectively run commands under root, hardcoded to sudo for now. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: New btrfsck test infrastructureQu Wenruo2015-01-14
Change the old btrfsck test infrastructure (btrfs-image dump or xz raw dump) to the new test infrastructure. 1) Test case layout The new infrastructure is dir based, each dir is one test type, and can contain multiple images/scripts for different corner cases. So layout will be the following: btrfs-progs |-tests |-fsck-tests |-001-SOME-CORRUPT-TYPE |-IMAGE-FOR-CASE1 |-IMAGE-FOR-CASE2 2) Test case image types Only 2 types for test case images. a) btrfs-image dump This one is the simplest case, one only needs to add the image to corresponding dir. b) custom script This one is for all the resting cases which can't fit btrfs-image, like csum error or script can generate the image (this reduces the size obviously and good for review) The old binary dump also belongs to this type, so need to add script to extract them. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>