Commit Graph

92 Commits

Author SHA1 Message Date
Jes Sorensen 59416da78f tests/func.sh: Fix some total breakage in the test scripts
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: 20d10b4be8 ("mdadm/test: Refactor and revamp 'test' script")
2018-04-11 17:27:28 -04:00
Zhilong Liu 064bd3f5ca mdadm/test: add do_clean to ensure each case only catch its own testlog
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2018-03-08 14:29:50 -05:00
Zhilong Liu 05e0e58f70 mdadm/test: improve filtering r10 from raid1 in raidtype
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2018-03-08 14:28:03 -05:00
Zhilong Liu 6c33d34df2 mdadm/test: add '--testdir=' to switch choosing test suite
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>
2018-01-21 16:36:08 -05:00
Zhilong Liu cbb8d34a81 mdadm/test: move some functions to new source file
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>
2018-01-21 16:36:08 -05:00
Zhilong Liu ed5e31aa21 mdadm/test: correct the logic operation in save_log
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>
2018-01-21 16:36:08 -05:00
Xiao Ni 62e2991ff9 mdadm/test: Add one test case for raid5 reshape
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>
2017-10-10 16:23:14 -04:00
Zhilong Liu 3af7f2adc0 mdadm/test: use the first element of array as parsing condition
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>
2017-09-01 11:22:03 -04:00
Zhilong Liu 25357919d2 mdadm/test: Add '--disks=' to support testing phsical devices
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>
2017-07-10 13:37:54 -04:00
Zhilong Liu 8403b202ca mdadm/test: Add '--raidtype=' to run different raidlevel cases
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>
2017-07-10 13:33:19 -04:00
Zhilong Liu 20d10b4be8 mdadm/test: Refactor and revamp 'test' script
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>
2017-07-10 13:30:10 -04:00
Zhilong Liu 662c349a5a mdadm/test: Convert code format to use Tab
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>
2017-06-09 11:04:10 -04:00
Song Liu 356e69de79 mdadm: add test script for raid456 journal
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: NeilBrown <neilb@suse.com>
2015-10-22 12:20:08 +11:00
NeilBrown 6fba5a339c test: assume recovery has completed if sync_completed says so.
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>
2015-07-23 11:17:10 +10:00
NeilBrown d51e39c0a4 test: add -F flag to mkfs
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>
2015-07-22 09:58:41 +10:00
NeilBrown 0832fb09d9 tests: slow down --stop a bit to allow revert-inplace to work.
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>
2015-07-16 10:50:40 +10:00
NeilBrown 21a1287ac9 test: clear out old metadata from loop devices.
Old metadata can tempt udev to assemble things, which
just gets in the way.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-07-16 07:49:14 +10:00
NeilBrown 5bc29745a0 tests: save failure logs to logdir
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>
2015-07-10 14:44:58 +10:00
NeilBrown bc6ccf969e test: add dmesg output to logs on error.
This can help isolate the problem.

Signed-off-by: NeilBrown <neilb@suse.de>
2015-07-06 15:32:46 +10:00
NeilBrown a76b3a345b test: check sync_action as well when checking for an action.
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>
2015-07-06 13:58:19 +10:00
NeilBrown 602b916951 test: speed up reshape when stopping arrays.
--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>
2015-07-06 13:52:04 +10:00
NeilBrown 5c351af129 test: stop all arrays before starting test.
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>
2015-07-06 13:48:59 +10:00
NeilBrown 4a859abdc9 test: make 'check wait' more reliable.
'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>
2015-05-28 17:00:36 +10:00
NeilBrown dd0468af57 test: forcefully clean up old loop devices.
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>
2015-05-20 13:16:00 +10:00
mwilck@arcor.de 7d8a70bf23 test: allow LVM volumes or RAM disks as test devices
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>
2013-08-06 09:56:21 +10:00
NeilBrown 9540cc244d test: ensure testing uses correct mdmon
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>
2013-08-05 14:55:13 +10:00
mwilck@arcor.de 840ad583e0 test: increase number of devices to 13
extended DDF/RAID10 tests need 6 disks for DDF.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-22 16:56:32 +10:00
NeilBrown 6fd2a36f9b test: allow resync/reshape etc to go faster.
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>
2013-07-11 13:24:40 +10:00
NeilBrown aef14b9e49 tests: add a test for reverting reshapes
Only reverting reshapes that grow the array so far.

Signed-off-by: NeilBrown <neilb@suse.de>
2013-07-04 17:10:36 +10:00
NeilBrown 855a353904 test: include any 'stderr' output in the log file.
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>
2013-07-02 13:12:07 +10:00
NeilBrown 35698c6e91 tests: add test for converting levels to raid0 and back.
Now that I have this mostly working, I should make sure
it doesn't break...

Signed-off-by: NeilBrown <neilb@suse.de>
2013-06-24 15:57:58 +10:00
Gilles Espinasse 98a92cff5a Keep track on which kernel the test suite has run
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-11-20 12:12:03 +11:00
NeilBrown d5a221a525 test: remove unnecessary bash-ism.
Bash allows '-' in function names, but other shells don't.
So use '_' - always safe.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-11-20 12:08:51 +11:00
NeilBrown bde085f411 test: add --disable-integrity switch.
The integrity tests are very slow and aren't always needed.
So make them optional.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-11-20 12:08:03 +11:00
NeilBrown 1dc837e4ed test: keep separate log file for each failed test.
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>
2012-10-23 09:21:32 +11:00
Gilles Espinasse 45e34015b6 test: redirect all output to log file to keep output clean
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>
2012-10-23 09:12:15 +11:00
Gilles Espinasse 4d3271732e Replace --no-error by --keep-going
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>
2012-10-22 09:11:07 +11:00
Gilles Espinasse 4d5995c49f Allow escape by ctrl-c broken by --no-error change
Signed-off-by: Gilles Espinasse <g.esp@free.fr>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-10-22 09:09:55 +11:00
Robert Buchholz 23b7d3b927 Make test a bash script (as it is)
Signed-off-by: NeilBrown <neilb@suse.de>
2012-07-09 17:22:43 +10:00
Jes Sorensen fc092254a1 Fix --no-error in test script
b8e91a32cd was applied incorrectly.
It changed the name of the variable set when specifying --no-error,
without changing the places checking it.

Set it back as it was to make --no-error work correctly again.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-30 10:44:10 +10:00
Jes Sorensen 572d7091f7 Move setup code to a function and introduce matching cleanup argument
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-28 10:52:27 +10:00
Jes Sorensen 0aaecb4330 Improve --help message from test
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-28 10:51:57 +10:00
Jes Sorensen b8e91a32cd Add --no-error argument to 'test'
This allows the test suite to run to completion even if one test
fails.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-28 10:51:43 +10:00
Jes Sorensen 6038155520 Add support for saving log files in test script
--logdir= specifies where to save, if different from default, and
--save-logs tells test to save all log files.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-28 10:50:38 +10:00
Jes Sorensen 4e5ce543f0 Add command line argument parsing to 'test' sript
This adds more generic command line argument parsing to the test
script. It also introduces a couple of new options, while preserving
the old '<prefix>' and 'setup' arguments. The new options are
--disable-multipath and --tests=<test1>,<test2>,...

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-23 13:36:52 +10:00
Jes Sorensen 04c1ca5f29 Check for multipath module before running multipath tests
Some systems do not ship the md multipath module. If not available
simply skip any multipath tests.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-23 13:25:44 +10:00
NeilBrown 3c8b273984 Update some device sizes for self tests.
A recent change means that devices smaller than
1Gig no longer have 1Meg wasted at the start.
So we must adjust some sizes again.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-18 17:08:28 +10:00
NeilBrown 974e0395ee test: don't worry too much about array size.
With different amounts of space being reserved for metadata
it is hard for the script to know how big the array should be.
So allow a bit of slack.

Signed-off-by: NeilBrown <neilb@suse.de>
2012-05-03 15:29:04 +10:00
Czarnowska, Anna ed02d9cc04 tests: use $config to store test config path
We also need to tell Monitor where to look for Policy in 11spare-migration tests

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-28 10:34:17 +11:00
NeilBrown 019ca1e1da test: call "udevadm settle" after stopping array.
If we don't do this, then the unlink from /dev might happen
after the next step in the test creates something in /dev,
and device names seem to go missing.

Signed-off-by: NeilBrown <neilb@suse.de>
2011-03-22 10:09:30 +11:00