summaryrefslogtreecommitdiffstats
path: root/test (follow)
Commit message (Collapse)AuthorAgeFilesLines
* test: pass flags to servicesMateusz Kusiak2024-06-181-5/+3
| | | | | | | | | | | | | | | | | | Commit 4c12714d1ca0 ("test: run tests on system level mdadm") removed MDADM_NO_SYSTEMCTL flag from test suite. This causes imsm tests to fail as mdadm no longer triggers mdmon and flags exists only within session. Use systemd set/unset-environment to pass necessary flags. Introduce colors to grab users attention to warnings and key messages. Make test suite setup systemd environment. Add setup/clean_systemd_env() functions. Warn user about altering systemd environment. Add colors to success/fail messages and warnings. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
* mdadm/tests: disable selinuxXiao Ni2024-05-241-0/+3
| | | | | | | | | Sometimes systemd service fails because selinux. Disable selinux during testing now. We can enable it in future when having a better method. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/tests: 07autoassembleXiao Ni2024-05-241-0/+2
| | | | | | | | | | | | | | | | This test is used to test stacked array auto assemble. There are two different cases depends on if array is foreign or not. If the array is foreign, the stacked array (md0 is on md1 and md2) can't be assembled with name md0. Because udev rule will run when md1 and md2 are assembled and mdadm -I doesn't specify homehost. So it will treat stacked array (md0) as foreign array and choose md127 as the device node name (/dev/md127) Add the case that stacked array is local. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* tests/04update-metadata skip linearXiao Ni2024-05-241-0/+3
| | | | | | | | Add one check that if kernel doesn't support linear/multipath, it can skip linear/multipath testing. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/tests: 03assem-incr enhanceXiao Ni2024-05-241-0/+3
| | | | | | | | | | It fails when hostname lenght > 32. Because the super1 metadata name doesn't include hostname when hostname length > 32. Then mdadm thinks the array is a foreign array if no device link is specified when assembling the array. It chooses a minor number from 127. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/tests: names_template enhanceXiao Ni2024-05-241-0/+5
| | | | | | | | | | | | For super1, if the length of hostname is >= 32, it doesn't add hostname in metadata name. Fix this problem by checking the length of hostname. Because other cases may use need to check this, so do the check in do_setup. And this patch adds a check if link /dev/md/name exists. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/tests: test don't fail when systemd reports errorXiao Ni2024-05-241-1/+1
| | | | | | | | Sometimes systemd reports error in dmesg and test fails. Add a condition to avoid this failure. Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* mdadm/tests: test enhanceXiao Ni2024-05-241-5/+5
| | | | | | | | | | | | | | | | | There are two changes. First, if md module is not loaded, it gives error when reading speed_limit_max. So read the value after loading md module which is done in do_setup Second, sometimes the test reports error sync action doesn't happen. But dmesg shows sync action is done. So limit the sync speed before test. It doesn't affect the test run time. Because check wait sets the max speed before waiting sync action. And recording speed_limit_max/min in do_setup. Fixes: 4c12714d1ca0 ('test: run tests on system level mdadm') Signed-off-by: Xiao Ni <xni@redhat.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* test: run tests on system level mdadmMateusz Kusiak2024-02-231-9/+18
| | | | | | | | | | | | | | | | | | | | | | The tests run with MDADM_NO_SYSTEMCTL flag by default, however it has no effect on udev. In case of external metadata, even if flag is set, udev will trigger systemd to launch mdmon. This commit changes test execution level, so the tests are run on system level mdadm, meaning local build must be installed prior to running tests. Add warning that the tests are run on system level mdadm and local build must be installed first. Do not call mdadm with "quiet" as it makes it not display critical messages necessary for debug. Remove forcing speed_limit and add restoring system speed_limit_max after test execution. Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* tests: Gate tests for linear flavor with variable LINEARSong Liu2024-01-161-0/+4
| | | | | | | | | | linear flavor is being removed in the kernel [1], so tests for the linear flavor will fail. Add detection for linear flavor and --disable-linear option, with the same logic as multipath. [1] https://lore.kernel.org/linux-raid/20231214222107.2016042-1-song@kernel.org/ Signed-off-by: Song Liu <song@kernel.org> Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
* tests: support to skip checking dmesgYu Kuai2023-10-261-2/+6
| | | | | | | | | | Prepare to add a regression test for raid10 that require error injection to trigger error path, and kernel will complain about io error, checking dmesg for error log will make it impossible to pass this test. Signed-off-by: Yu Kuai <yukuai3@huawei.com> Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm/test: Mark and ignore broken test failuresLogan Gunthorpe2022-08-071-2/+35
| | | | | | | | | | | | | | | | Add functionality to continue if a test marked as broken fails. To mark a test as broken, a file with the same name but with the suffix '.broken' should exist. The first line in the file will be printed with a KNOWN BROKEN message; the rest of the file can describe the how the test is broken. Also adds --skip-broken and --skip-always-broken to skip all the tests that have a .broken file or to skip all tests whose .broken file's first line contains the keyword always. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* mdadm/test: Add a mode to repeat specified testsLogan Gunthorpe2022-08-071-12/+24
| | | | | | | | | | Many tests fail infrequently or rarely. To help find these, add an option to run the tests multiple times by specifying --loop=N. If --loop=0 is specified, the test will be looped forever. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
* tests/func.sh: Fix some total breakage in the test scriptsJes Sorensen2018-04-111-1/+1
| | | | | | | | | We will never mandate an obsolete file system such as ext[2-4] for running the test suite, nor should the test version of mdadm be installed on the system for the tests to be run. Signed-off-by: Jes Sorensen <jsorensen@fb.com> Fixes: 20d10b4be873ba ("mdadm/test: Refactor and revamp 'test' script")
* mdadm/test: add do_clean to ensure each case only catch its own testlogZhilong Liu2018-03-081-3/+1
| | | | | Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: improve filtering r10 from raid1 in raidtypeZhilong Liu2018-03-081-1/+1
| | | | | Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: add '--testdir=' to switch choosing test suiteZhilong Liu2018-01-211-4/+28
| | | | | | | | | By now, mdadm has two test suites to cover traditional sofr-raid testing and clustermd testing, the '--testdir=' option supports to switch which suite to test, tests/ or clustermd_tests/. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: move some functions to new source fileZhilong Liu2018-01-211-349/+4
| | | | | | | | To make 'test' file concise, move some functions to new file tests/func.sh, and leave core functions in 'test' file. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: correct the logic operation in save_logZhilong Liu2018-01-211-5/+4
| | | | | | | | | 1. delete the mdadm -As, keep the original testing scene intact. 2. move some actions into 'array' test, 'mdadm -D $array' would complain errors if $array is null. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: Add one test case for raid5 reshapeXiao Ni2017-10-101-0/+7
| | | | | | | | | | | | This case tries to allow raid5 reshape to use backwards direction. It changes chunksize after reshape and stops the raid. Then starts the raid again. Signed-off-by: Xiao Ni <xni@redhat.com> Suggested-by: Jes Sorensen <jes.sorensen@gmail.com> Suggested-by: Zhilong Liu <zlliu@suse.com> Suggested-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: use the first element of array as parsing conditionZhilong Liu2017-09-011-1/+1
| | | | | | | | | | it would complain "too many arguments" when array[] has few members, it's proper to check whether or not array[0] is null. Reported-by: Xiao Ni <xni@redhat.com> Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: Add '--disks=' to support testing phsical devicesZhilong Liu2017-07-101-5/+32
| | | | | | | | | | | | | | If test mode has set as '--dev=disk', then users can specify the argument of "--disks" to test a bunch of physical devices. For example: ./test --dev=disk --disks=/dev/sda{2..15} could execute all test cases on physical devices. Currently, the --dev=disk mode would confilct with testdev() in current test cases, thus ignore testing testdev() if has set --dev=disk mode. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: Add '--raidtype=' to run different raidlevel casesZhilong Liu2017-07-101-0/+31
| | | | | | | | | | | It supports to specify the argument of "--raidtype" to run the different raid level cases. Details refer to the do_help() usage. For example: ./test --raidtype=raid1 could execute all the raid1 test cases under tests/. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: Refactor and revamp 'test' scriptZhilong Liu2017-07-101-180/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding functions: die() uniform the abnormal situations that have to abort. check_env() do various basic checking before running test suite. save_log() collect array infos, include of dmesg, superblock, bitmap and /proc/mdstat. main() the core function of this script. Improve functions: cleanup() clear dmesg and remove the /var/tmp/mdtest* files. mdadm() clear superblock once creating or building arrays every time, because it's always creating arrays many times in a test case. check() just tidy up with die(), didn't change code meanings. testdev() add checking $1 must be a block device, add 'return 0' in final because this function exists in last line of test case, such as tests/05r6tor0. do_test() add checking abnormal dmesg and changing log management. do_help() just recommend a better way to print Usage. parse_args() revamp and improve. Delete function: fast_sync() It's no longer used, so get rid of it. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm/test: Convert code format to use TabZhilong Liu2017-06-091-324/+378
| | | | | | | | In case to make codes neat, this commit didn't change any codes, just tidy up and use Tab as code format. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com>
* mdadm: add test script for raid456 journalSong Liu2015-10-221-0/+9
| | | | | | Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com>
* test: assume recovery has completed if sync_completed says so.NeilBrown2015-07-231-0/+8
| | | | | | | The final completion of a recovery can be delayed, so use sync_completed to check if it is finished, just not been reaped. Signed-off-by: NeilBrown <neilb@suse.com>
* test: add -F flag to mkfsNeilBrown2015-07-221-1/+1
| | | | | | | | | newer versions of mkfs.extX ask before creating a filesystem on a device which appears to already have a filesystem. We don't want that, so add the -F flag. Also be explicit about fs type as one shouldn't depend on defaults. Signed-off-by: NeilBrown <neilb@suse.com>
* tests: slow down --stop a bit to allow revert-inplace to work.NeilBrown2015-07-161-1/+1
| | | | | | | | | | revert-inplace would sometimes find that the original reshape had finished. So slow down the reshaping during --stop (which needs to be a little bit fast so that stop doesn't timeout waiting) and don't wait quite so long before stopping. Signed-off-by: NeilBrown <neilb@suse.de>
* test: clear out old metadata from loop devices.NeilBrown2015-07-151-0/+2
| | | | | | | Old metadata can tempt udev to assemble things, which just gets in the way. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: save failure logs to logdirNeilBrown2015-07-101-8/+4
| | | | | | | If --save-logs is given we already save all logs to --logdir If not, we should still save erroneous logs to --logdir. Signed-off-by: NeilBrown <neilb@suse.com>
* test: add dmesg output to logs on error.NeilBrown2015-07-061-0/+2
| | | | | | This can help isolate the problem. Signed-off-by: NeilBrown <neilb@suse.de>
* test: check sync_action as well when checking for an action.NeilBrown2015-07-061-5/+14
| | | | | | | | | Some actions only appear in /proc/mdstat after a little delay, so check in sync_action as well. This applies when checking for recovery etc, and when waiting for idle. Signed-off-by: NeilBrown <neilb@suse.de>
* test: speed up reshape when stopping arrays.NeilBrown2015-07-061-4/+7
| | | | | | | --stop needs to wait for reshape to get to a suitable spot, so having really slow resync isn't helpful. Signed-off-by: NeilBrown <neilb@suse.de>
* test: stop all arrays before starting test.NeilBrown2015-07-061-0/+1
| | | | | | | As well a cleaning up loop devices, stop all arrays. After all, we cannot do the one without the other. Signed-off-by: NeilBrown <neilb@suse.com>
* test: make 'check wait' more reliable.NeilBrown2015-05-281-1/+1
| | | | | | | | | | | 'recover' etc doesn't appear in /proc/mdstat immediately. The "sync" thread must be started first. But 'sync_action' shows it as soon as MD_RECOVERY_NEEDED is set in the kernel. So look there too. Now maybe I can get rid of some of those silly 'sleep' calls. Signed-off-by: NeilBrown <neilb@suse.de>
* test: forcefully clean up old loop devices.NeilBrown2015-05-201-0/+8
| | | | | | | | sometimes these can get left around, and udev can be looking at them at awkward times so they don't disappear. So be forceful. Signed-off-by: NeilBrown <neilb@suse.de>
* test: allow LVM volumes or RAM disks as test devicesmwilck@arcor.de2013-08-061-13/+56
| | | | | | | | | | | | | | Allow other device types for testing; this allows to test on a larger variety of devices. Option --dev=[loop|lvm|ram] selects loop device (default), lvm, and ram disk, respecively. To use RAM disks with DDF, the kernel parameter ramdisk_size=65536 must be used. For LVM, use --volgroup=<vg> to specify the name of the volume group in which the test LVs will be created. Signed-off-by: Martin Wilck <mwilck@arcor.de> Signed-off-by: NeilBrown <neilb@suse.de>
* test: ensure testing uses correct mdmonNeilBrown2013-08-051-0/+3
| | | | | | | | | When testing we want to run mdmon directly, not use systemctl to get systemd to run it. So allow an environment variable to make that choice. Signed-off-by: NeilBrown <neilb@suse.de>
* test: increase number of devices to 13mwilck@arcor.de2013-07-221-2/+2
| | | | | | extended DDF/RAID10 tests need 6 disks for DDF. Signed-off-by: NeilBrown <neilb@suse.de>
* test: allow resync/reshape etc to go faster.NeilBrown2013-07-111-1/+10
| | | | | | | | Whenever we "check wait" - make the resync process go at full speed. Also allow script to adjust it manually. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: add a test for reverting reshapesNeilBrown2013-07-041-0/+1
| | | | | | Only reverting reshapes that grow the array so far. Signed-off-by: NeilBrown <neilb@suse.de>
* test: include any 'stderr' output in the log file.NeilBrown2013-07-021-0/+1
| | | | | | | Errors from mdadm go to 'stderr', so if there is an array, copy those to the log file. Signed-off-by: NeilBrown <neilb@suse.de>
* tests: add test for converting levels to raid0 and back.NeilBrown2013-06-241-0/+4
| | | | | | | Now that I have this mostly working, I should make sure it doesn't break... Signed-off-by: NeilBrown <neilb@suse.de>
* Keep track on which kernel the test suite has runGilles Espinasse2012-11-201-0/+2
| | | | | Signed-off-by: Gilles Espinasse <g.esp@free.fr> Signed-off-by: NeilBrown <neilb@suse.de>
* test: remove unnecessary bash-ism.NeilBrown2012-11-201-2/+2
| | | | | | | Bash allows '-' in function names, but other shells don't. So use '_' - always safe. Signed-off-by: NeilBrown <neilb@suse.de>
* test: add --disable-integrity switch.NeilBrown2012-11-201-0/+5
| | | | | | | The integrity tests are very slow and aren't always needed. So make them optional. Signed-off-by: NeilBrown <neilb@suse.de>
* test: keep separate log file for each failed test.NeilBrown2012-10-231-1/+6
| | | | | | | | If a test failed when --keep-going is selected, give the log file a name based on the test name, so that all the logs can be examined afterwards. Signed-off-by: NeilBrown <neilb@suse.de>
* test: redirect all output to log file to keep output cleanGilles Espinasse2012-10-231-1/+1
| | | | | | | | If a test sent anything to stdout, it would not get logged, and would mess up the listing of test status. Signed-off-by: Gilles Espinasse <g.esp@free.fr> Signed-off-by: NeilBrown <neilb@suse.de>
* Replace --no-error by --keep-goingGilles Espinasse2012-10-221-2/+2
| | | | | | | | Suggest to replace by the option name that 'make' use. no error is only a developper hope. Signed-off-by: Gilles Espinasse <g.esp@free.fr> Signed-off-by: NeilBrown <neilb@suse.de>