summaryrefslogtreecommitdiff
path: root/tests/common
Commit message (Collapse)AuthorAge
* btrfs-progs: tests: fix typos in test commentsJosh Soref2018-11-26
| | | | | | | | Generated by https://github.com/jsoref/spelling Issue: #154 Author: Josh Soref <jsoref@users.noreply.github.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: update log markersDavid Sterba2018-06-07
| | | | | | | Use visual markers that separate tests and individual commands run via the run_* helpers. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add helper to log pipe stdoutDavid Sterba2018-02-19
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for testsGu Jinxiang2018-02-13
| | | | | | | | | | | | Use TEST_TOP as base for tests to reference any files, this will be used for git and external testsuite. INTERNAL_BIN is needed for referencing binaries that could reside in different paths in git vs external testsuite. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ add quotes around sourced files, update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests common: remove meaningless colon in extract_image()Su Yue2018-02-07
| | | | | | | The colon is meaningless so remove it. Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance common umount helper to take optional pathsDavid Sterba2018-01-31
| | | | | | | | | | | The run_check_umount_test_dev umounts the TEST_DEV and also optionally uses the arguments but this would not work as expected if the TEST_DEV is not a vald path for umount (eg. a restored image). Update the helper so it tries to umount all paths, or fallback to TEST_DEV to keep the current behaviour. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: truncate test image to 0 firstDavid Sterba2018-01-31
| | | | | | | | We use the prepare_test_dev helper to make sure the image has at least this size. The "at least" part is not desired by some tests as the device might be larger than the test expects. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix typo in error messageDavid Sterba2018-01-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Enhance prepare_test_dev to reset device sizeQu Wenruo2018-01-03
| | | | | | | | | So prepare_test_dev() can be called several times in one test case, to test different device sizes. Signed-off-by: Qu Wenruo <wqu@suse.com> [ switch to [ ] ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test/common: Introduce run_mustfail_stdoutQu Wenruo2018-01-03
| | | | | | | For later test case which needs info from stderr. Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests/common: Display warning only after searching for btrfs ↵Lakshmipathi.G2017-11-14
| | | | | | | kernel module Signed-off-by: Lakshmipathi.G <lakshmipathi.g@giis.co.in> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: make sure _is_file_or_command does not get confusedDavid Sterba2017-09-25
| | | | | | | | | | | The test cli/007-check-force reports something like: $ type -p '--string that starts with dashes' bash: type: --: invalid option Add the option/argument separator. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: remove temporary loopdev filesDavid Sterba2017-09-25
| | | | | | Remove files for testing loop devices when using the helper. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: fix name generation not to contain trailing spacesMisono, Tomohiro2017-09-08
| | | | | | | | | | | | | First patch causes test-convert fails. This is because generate_dataset() creates a name containing trailing spaces for "slow_symlink" type, and cause getfacl error in convert_test_perm(). (This is not noticed since original run_check_stdout() throws away the error.) Fix this by use space for delimiter for cut. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: fix run_check_stdout() call _fail()Misono, Tomohiro2017-09-08
| | | | | | | | | | run_check_stdout() uses "... | tee ... || _fail". However, since tee won't fail, _fail() is not called even if first command fails. Fix this by checking PIPESTATUS in the end. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: move loopdev helpers out of the testcase to commonDavid Sterba2017-09-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: fix _is_file_or_command detectionDavid Sterba2017-08-25
| | | | | | | | type -p returns an empty string for nonexistent commands, but the -f test on an empty string does not behave the same on all shells. To be safe, use the quoted value. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: catch bad usage of run_mustfailDavid Sterba2017-08-24
| | | | | | | This function has an extra argument and can get forgotten, add a sanity check so the bad usage can be caught during development. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: Use '-t btrfs' mount option in testsAdam Buchbinder2017-07-20
| | | | | | | | Without it, mount (at least from util-linux 2.20.1) tries (and fails) to mount some filesystems as NTFS. Signed-off-by: Adam Buchbinder <abuchbinder@google.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: check: Fix lowmem mode override to allow it skip repair workLu Fengqi2017-03-08
| | | | | | | | | | | | | | | | | | | | Current common.local doesn't handle lowmem mode well. It passes "--mode=lowmem" alone with "--repair", making it unable to check lowmem mode. It's caused by the following bugs: 1) Wrong variable in test/common.local We should check TEST_ARGS_CHECK, not TEST_CHECK, which is not defined so we never return 1. 2) Wrong parameter passed to _cmd_spec() in test/common This prevents us from grepping the correct parameters. Fix it. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: convert-test: trigger chunk allocation after convertQu Wenruo2016-12-21
| | | | | | | | | Populate fs after convert so we can trigger data chunk allocation. This can expose too restrict old rollback condition Reported-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add support for additional command argumentsDavid Sterba2016-11-23
| | | | | | | | | Add convenient support for extending command arguments, now implemented for 'btrfs check' to cover the low-memory mode. If defined, arguments are inserted to any 'btrfs check' command in tests. Exceptions could be defined in common.local. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: more variable quoting in common scriptsDavid Sterba2016-11-23
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: drop redundant test for rwx number validityDavid Sterba2016-11-23
| | | | | | | The list of rwx permissions is now hardcoded but used to begenerated and the invalid numbers filtered out. Not necessary anymore. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: test: fix how to make test files in fsck-tests 013Tsutomu Itoh2016-11-23
| | | | | | | | | | | | | | | | | | | | | | In my test environment, following error was occurred because the size of /lib/modules/`uname -r`/* is larger than 1GB. # make test-fsck [TEST] fsck-tests.sh [TEST/fsck] 013-extent-tree-rebuild failed: cp -aR /lib/modules/4.9.0-rc5/ /test/btrfs-progs/tests/mnt test failed for case 013-extent-tree-rebuild Makefile:272: recipe for target 'test-fsck' failed make: *** [test-fsck] Error 1 # In this test case, 'generate_dataset small' is enough for making the test files, so I will use 'generate_dataset' instead of 'cp'. For this, move 'generate_dataset()' from 'common.convert' to 'common'. Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add fallback to current directory for check_all_imagesDavid Sterba2016-11-23
| | | | | Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: check for TEST_LOG values by a regexDavid Sterba2016-11-23
| | | | | | | The set of possible values will be extended so check for existence of the keyword. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: enhance run_mayfail description commentDavid Sterba2016-11-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add quotes around variables in commonDavid Sterba2016-11-11
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: add assertion helperDavid Sterba2016-11-11
| | | | | | Helper to extend sanity checks in various functions. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: check if kernel has btrfs supportDavid Sterba2016-11-11
| | | | | | | Add some sanity checks, reported among other issues via bugzilla. References: https://bugzilla.kernel.org/show_bug.cgi?id=177141 Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: teach extract_image about packed streamsDavid Sterba2016-11-11
| | | | | | | Packed streams for testing purposes should be packed with 'xz -9' and use suffix .stream.xz . Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: teach run_mayfail about sigabrtDavid Sterba2016-10-05
| | | | | | Mayfail helper should stop when we encoutner an abort. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: tests: don't treat segfault as ignorable errorDavid Sterba2016-10-05
| | | | | | | | Some fuzzed images cause various tools to crash but the mayfail helper would not recognize that. We don't mind if the utility failes but it must not crash. 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: 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>