1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00
Commit Graph

763 Commits

Author SHA1 Message Date
Leo Yan
759b0392d5 tests: Support multiple backing devices
In current implementation, the option "LVM_TEST_BACKING_DEVICE" only
supports to specify one backing device; this patch is to extend the
option to support multiple backing devices by using comma as separator,
e.g. below command specifies two backing devices:

  make check_lvmlockd_idm LVM_TEST_BACKING_DEVICE=/dev/sdj3,/dev/sdk3

This can allow the testing works on multiple drives and verify the
locking scheme if can work as expected for multiple drives case.  For
example, for Seagate IDM locking scheme, if a VG uses two PVs, every PV
is resident on a drive, thus the locking operations will be sent to two
drives respectively; so the extension for "LVM_TEST_BACKING_DEVICE" can
help to verify different drive configurations for locking.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Leo Yan
c64dbc7ee8 tests: Enable the testing for IDM locking scheme
This patch is to introduce testing option LVM_TEST_LOCK_TYPE_IDM, with
specifying this option, the Seagate IDM lock manager will be launched as
backend for testing.  Also add the prepare and remove shell scripts for
IDM.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
2021-06-03 09:39:32 -05:00
Zdenek Kabelac
f678052385 shellcheck: updates
Ehance some shellcheck reported issues.
2021-04-23 23:00:55 +02:00
Zdenek Kabelac
79a168d119 tests: pvmove updates
Switch to plain 'kill' we should no longer need SIGKILL
as polling can be interrupted.

Resolve problem in aux wait_pvmove_lv_ready() that was using
lvm command to check for UUID - but this was interferring with
VG lock and it's been delaying confirmation.

So reducing slow-down of test - so it can run faster.
2021-04-06 22:02:31 +02:00
Zdenek Kabelac
d9b9751032 tests: add aux remove_dm_devs
Add function to remove DM devices and dies
if some device can't be removed.
2021-03-28 14:22:11 +02:00
Zdenek Kabelac
12222add1a tests: use known path for test in find
Actually make sure which 'test' binary is executed.
Since we used to have 'test' binary in tests.
2021-03-27 23:18:38 +01:00
Zdenek Kabelac
4c59b2aa21 tests: add aux mdadm_assemble
Wrapper for slowed version of mdadm --assemble
2021-03-26 20:39:41 +01:00
Zdenek Kabelac
0558b223b8 tests: aux fix check_lvmpolld_init_rq_count
Make check_lvmpolld_init_rq_count() more compatible with older gawk,
where some functionality was not working properly.
Also change 'not not' condition.
2021-03-26 00:33:21 +01:00
Zdenek Kabelac
c1f5ca6751 tests: improve check raid_leg_status
Enhance function to wait until raid status gets consisten
(shifts from 0/xxxxx to something else)

If it would took too long fail the check.
2021-03-24 16:38:12 +01:00
Zdenek Kabelac
0783c661b9 tests: handle case of missing /dev/disk
In case there is no symlink - udev can optimize /dev/disk away,
thus find would fail in teardown.
2021-03-24 16:38:12 +01:00
Zdenek Kabelac
a126dde069 tests: remove more file in teardonw
Our tests may result in producation of huge set of
invalid links in /dev/disk directory depeding on version
of udev and various kinds of failures.

Also we happen to invoke some on-system pvscans generating
local /etc/lvm/archive & backups - remove them when
test is finished.
2021-03-24 12:23:07 +01:00
Zdenek Kabelac
dd1f5f9a24 tests: aux clean DM on top of MD
Before cleaning MD, try to remove any DM on top such MD.
Check is made through DM table check.
Maybe parse /proc/mdstat for this???
2021-03-23 21:28:28 +01:00
Zdenek Kabelac
93f2d194ac tests: wipefs with udev_wait
Try to synchronize with colliding udev.
Also retry once if there is some failure with some
sleep between next retry.

Use oflag=direct for wipping without wipefs.
2021-03-23 14:57:10 +01:00
Zdenek Kabelac
712f7dfb4c tests: ignore failure of zeroing
Older mdadm fails the command, when the signature is already gone.
2021-03-23 12:05:55 +01:00
Zdenek Kabelac
a5fc6a0fe7 tests: set default basic flavour 2021-03-23 11:33:30 +01:00
Zdenek Kabelac
b19e036918 tests: aux updates
Select unused md from /proc/mdstat
Check for wipefs once.
2021-03-23 09:48:03 +01:00
Zdenek Kabelac
370749a4b8 tests: enhance mdadm_create
For older mdadm its hard to support new names - to simplify things
keep using  /dev/mdXXX name which is automatically selected.
2021-03-23 01:16:21 +01:00
Zdenek Kabelac
077040199d tests: remove unused wait_md_create 2021-03-22 22:51:24 +01:00
Zdenek Kabelac
7166bbd9c2 tests: avoid sleep on kill path
Before sleeping, check if pid is still there.
2021-03-22 22:51:24 +01:00
Zdenek Kabelac
ada99f939f tests: new aux mdadm_create
Add generic wrapper for mdadm --create which takes
normal 'mdadm' args - but allows us to handle differences of
mdadm usage across various version of mdadm tool.

Resulting MD device is availalble in  $(< MD_DEV).

Automatic cleaning is made through   cleanup_md_dev

Calling of mdadm_create cleans previous MD dev if it exists.
2021-03-22 22:42:52 +01:00
Zdenek Kabelac
8d2ad4419a tests: more system defaults for installed tests
When testing installed binaries on system, use more 'built-in'
predefined settings to usethem with their  compiled-in values.

Also it's better to use same locking dir so the system's pvscan
is not unexpectedly interferring with test commands.
2021-03-22 22:36:37 +01:00
Zdenek Kabelac
edcc410835 tests: fix condition for exclusion of /dev 2021-03-20 00:28:13 +01:00
Zdenek Kabelac
d5b37f24f4 tests: aux reject /dev as testing dir
If LVM_TEST_DIR would be set to /dev, reject such selection.
2021-03-20 00:05:01 +01:00
Zdenek Kabelac
1880b573f3 tests: aux always shift emulated devices by 1MiB
Always shift created virtual PVs on backing device by 1MiB
and leave 1MiB free space at the end of device.

This way the system doesn't see same PV headers at multiple devices.
2021-03-18 18:57:45 +01:00
Zdenek Kabelac
e5e957e330 shellcheck: avoid assign warnings
Shellcheck seems to be happier when assigning variables with quotes.
2021-03-15 11:13:24 +01:00
Zdenek Kabelac
4bbaff1fa6 tests: settle after wiping
Add call to settle after wiping device so there is reduced
change to meet watch rule race during tests.
2021-03-11 00:18:01 +01:00
David Teigland
d5f3239de4 tests: check_devicesfile
make check_devicesfile T=...

(A number of tests should probably get a new
SKIP_WITH_DEVICES_FILE.)
2021-03-08 17:19:26 -06:00
Zdenek Kabelac
7528a33630 tests: update setting LVM_BINARY for testing
When testing is running on uninstealled system - prefer our own binary
in tests.
2021-03-02 22:24:51 +01:00
David Teigland
b36b4b82d8 tests: for devices file 2021-02-23 16:43:38 -06:00
David Teigland
135c226e26 tests: allow tests to use real devices
user creates a file listing real devices they want
lvm tests to use, and sets LVM_TEST_DEVICE_LIST.
lvm tests can use these with prepare_real_devs
and get_real_devs.
Other aux functions do not work with these devs.
2021-02-23 16:43:37 -06:00
Zdenek Kabelac
25b942a8ac aux: update thin_restore_needs_more_volumes
Version 0.8.5-2.el7 needs to return 0;
2021-02-01 12:13:49 +01:00
Zdenek Kabelac
5e26a2b74d tests: aux hides zero and error device
When ERR_DEV and ZERO_DEV are used, they are automatically
taken down when the last user no longer needs them,
so hide them from 'forgotten' device check.
2020-10-02 22:27:00 +02:00
Zdenek Kabelac
8d9b4c624f tests: rename shown debug trace
As there could be few invokes of stacktrace, avoid
repeatedly display logs from commands.
So after first display rename  debug.log* -> debug_log
so the file still can remain for reading in test dir.
2020-10-02 22:27:00 +02:00
Marian Csontos
46e5908759 test: grep -q may fail and it does
The script runs with pipefail, grep -q exits immediately sending SIGPIPE
to lvm segtype which fails whole pipe.
2020-10-01 11:33:57 +02:00
Zdenek Kabelac
e280f56dd3 tests: move function to aux for reuse 2020-09-22 23:43:26 +02:00
Zdenek Kabelac
206620018e tests: inittest supports SKIP_WITH_LOW_SPACE
Test can set individually a higher value for required free space on
storage.

Note: it is not fully reliable since when 'brd' (ramdisk) device is used
this free space value is rather meanigul, but it might help
in case where a real filesystem is doing back-end for test devices.
2020-09-18 17:30:31 +02:00
Zdenek Kabelac
048e04e417 tests: utils better handle ouf of disk space
When the test exhausts all the available free space on storage device,
then during the fail we cannot write anything as well - yet
the teardown needs to finish it's work - otherwise we leave
basicaly overfilled filesystem for all remaining tests.
2020-09-18 17:29:26 +02:00
Zdenek Kabelac
b77595ac8b tests: aux better handle invalid table
In cases where internal functions like zero_dev, delay_dev pass-in
invalid parameter so resulting table can't work, resume at least
previous table line before failing out - so the cleaning process
later on is not stuck waiting on a suspended device.
2020-09-18 14:23:20 +02:00
Zdenek Kabelac
64c8827cf3 tests: check in_sync prints also dm status
It's more useful to see how the progress of status checking is moving.
2020-09-14 00:15:14 +02:00
Zdenek Kabelac
f233d9a909 tests: have_cache function checks for cache-pool
Check for cache-pool segment as plain cache can match writecache.
2020-09-11 21:52:55 +02:00
Zdenek Kabelac
3f2e9e3546 tests: aux collects stack trace when stuck is assumed
Automatically collect traces in this case.
2020-09-10 23:55:03 +02:00
Zdenek Kabelac
76b1f43e81 tests: add aux delayzero_dev support
Just like we have 'writeerror_dev' supporting creation of device
which 'readable' segment and segments where write will fail we
have now support for delay zero mappings.

This is useful if we want to 'fake' large writing areas where we do
not really care about the actual 'disk' content - since we test
operation logic and it doesn't matter we read and write zeroes.
With combination with 'delay' target we can create specific mappings
and avoid using large memory areas of ramdisk.
2020-09-04 18:11:42 +02:00
Zdenek Kabelac
3f32f9811e tests: check pool metadata are zeroed 2020-06-24 15:01:03 +02:00
David Teigland
d9e8895a96 Allow dm-integrity to be used for raid images
dm-integrity stores checksums of the data written to an
LV, and returns an error if data read from the LV does
not match the previously saved checksum.  When used on
raid images, dm-raid will correct the error by reading
the block from another image, and the device user sees
no error.  The integrity metadata (checksums) are stored
on an internal LV allocated by lvm for each linear image.
The internal LV is allocated on the same PV as the image.

Create a raid LV with an integrity layer over each
raid image (for raid levels 1,4,5,6,10):

lvcreate --type raidN --raidintegrity y [options]

Add an integrity layer to images of an existing raid LV:

lvconvert --raidintegrity y LV

Remove the integrity layer from images of a raid LV:

lvconvert --raidintegrity n LV

Settings

Use --raidintegritymode journal|bitmap (journal is default)
to configure the method used by dm-integrity to ensure
crash consistency.

Initialization

When integrity is added to an LV, the kernel needs to
initialize the integrity metadata/checksums for all blocks
in the LV.  The data corruption checking performed by
dm-integrity will only operate on areas of the LV that
are already initialized.  The progress of integrity
initialization is reported by the "syncpercent" LV
reporting field (and under the Cpy%Sync lvs column.)

Example: create a raid1 LV with integrity:

$ lvcreate --type raid1 -m1 --raidintegrity y -n rr -L1G foo
  Creating integrity metadata LV rr_rimage_0_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_0_imeta" created.
  Creating integrity metadata LV rr_rimage_1_imeta with size 12.00 MiB.
  Logical volume "rr_rimage_1_imeta" created.
  Logical volume "rr" created.
$ lvs -a foo
  LV                  VG  Attr       LSize  Origin              Cpy%Sync
  rr                  foo rwi-a-r---  1.00g                     4.93
  [rr_rimage_0]       foo gwi-aor---  1.00g [rr_rimage_0_iorig] 41.02
  [rr_rimage_0_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_0_iorig] foo -wi-ao----  1.00g
  [rr_rimage_1]       foo gwi-aor---  1.00g [rr_rimage_1_iorig] 39.45
  [rr_rimage_1_imeta] foo ewi-ao---- 12.00m
  [rr_rimage_1_iorig] foo -wi-ao----  1.00g
  [rr_rmeta_0]        foo ewi-aor---  4.00m
  [rr_rmeta_1]        foo ewi-aor---  4.00m
2020-04-15 12:10:32 -05:00
Zdenek Kabelac
9532bb577a tests: validate vdo slab_size
New vdoformat can print this size - so check we pass proper bit count
matching preset value.
2020-02-26 13:29:21 +01:00
Zdenek Kabelac
ecb77e9db3 tests: writeerror_dev
Intruduce aux function for easy simulation of disk areas,
that are 'normally' readable, but will fail on write.
2020-01-23 10:32:15 +01:00
Heming Zhao
2f6d0a6408 fix corosync.conf: no interface error
systemctl status corosync (version: 2.4.5) report error:
  parse error in config: No interfaces defined

Signed-off-by: Zhao Heming <heming.zhao@suse.com>
2020-01-15 09:46:54 -06:00
Zdenek Kabelac
611d4107a4 test: fix missing waiting on udev
After device creation we need to wait for a cookie so it's not forgotten
in the system.
2019-12-10 15:44:16 +01:00
Zdenek Kabelac
3b6defcf1f test: fail on device create
Correct validation of prepared device and fail if the device can't
be created.
2019-12-10 15:44:16 +01:00
Zdenek Kabelac
8ab1d489f3 test: aux setup
Avoid endless loop if there was no 'remove' progress.
2019-12-10 15:44:16 +01:00
David Teigland
bbd8badaef tests: update to md dev name
Restore WAIT_MD_DEV in teardown.

NOTE: The name of MD device may have changed.

(cherry picked from commit c2ff8876f9)
2019-11-26 10:34:51 +01:00
Marian Csontos
4757ce4c2a Partial revert "tests: update to md dev name"
This partially reverts commit c2ff8876f9.

Not all MD devices are stopped. Something is missing there...
2019-11-25 09:23:02 +01:00
Marian Csontos
1e669ab315 test: Fix handling leftovers from previous tests
teardown fails current PREFIX is prefix of previously failed test with
leftovers in dmtable.
2019-11-20 15:27:03 +01:00
Zdenek Kabelac
3b05fd4d07 tests: add extra settle
To avoid removing, while 'add' might not have been processed yet.
(when emulating reboot in pvmove-restart)
2019-11-11 22:44:25 +01:00
David Teigland
a22729a557 tests: improve lib wipefs_a
in wipefs fallback, use limited dd and mdadm --zero-superblock
to avoid writing to entire dev in case dev space is provisioned
on write.
2019-10-04 11:06:38 -05:00
David Teigland
d693041149 tests: add wipefs wrapper
which falls back to using dd on old systems without
the wipefs command
2019-10-02 14:11:08 -05:00
David Teigland
c2ff8876f9 tests: update to md dev name
Use /dev/md33 instead of /dev/md0 to reduce chances of
conflicting with an existing name.

Only call 'mdadm --stop /dev/md33' for cleanup and don't
use 'mdadm --stop --scan' to avoid stopping other md devs.
2019-10-02 14:09:51 -05:00
David Teigland
fd5b8b72da tests: mdadm stop in test cleanup
try to clear any existing md devs remaining after
a test
2019-09-27 12:51:34 -05:00
David Teigland
13fb57bbb1 Revert "tests: drop unnecessary pid from LVMTEST prefix"
This reverts commit 51c105702f.

it seems the test system still needs this for some reason
2019-09-16 13:01:50 -05:00
David Teigland
51c105702f tests: drop unnecessary pid from LVMTEST prefix 2019-09-12 14:52:13 -05:00
David Teigland
df36a8eadf tests: don't change real test output 2019-09-12 14:45:13 -05:00
David Teigland
39a0de68bd tests: unnecessary braces causes test failures 2019-09-12 12:55:00 -05:00
David Teigland
1fe04f89ef tests: use standard md devices 2019-09-12 10:11:27 -05:00
Zdenek Kabelac
e653f43732 tests: simplify some var settings
scan_lvs now automatically comes with extend_filter_LVMTEST
2019-08-09 12:57:21 +02:00
Zdenek Kabelac
3596210e02 tests: replaces grep -q usage
Since we use 'set -euE -o pipefail' for shell execution,
any failure of any command in the 'piped' shell can result
in failure of whole executed chain - resulting in typically
unsually test skip, that was left unnoticed.

Since checked command have usually short output, the simplest
fix seems to be to let grep parse whole output instead
of quiting after first match.
2019-08-09 12:57:21 +02:00
Marian Csontos
dd19fa9ff3 tests: Fix unbound variable
Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.
2019-07-24 16:30:15 +02:00
Marian Csontos
09f29570f2 test: Fix unbound variable
Test `aux kernel_at_least 5 1` fails even for newer kernel
with `$3: unbound variable` when using `set -u`.
2019-06-27 10:41:21 +02:00
David Teigland
208a09745d tests: aux have_writecache
function was never defined, causing writecache.sh to be skipped
2019-06-13 11:36:18 -05:00
Zdenek Kabelac
c9203a6106 tests: correct checked target name
So when the target name happened to be a suffix of another one,
the grep was filtering incorrect line
(i.e. dm-cache && dm-writecache) - so do a line head matching.
2019-06-11 16:43:14 +02:00
Zdenek Kabelac
ddd68fbead tests: automatically set scan_lvs when using extend_filter
When using 'aux extend_filter' we always want to use LV as PV.
2019-06-05 15:48:44 +02:00
Zdenek Kabelac
246b0c444b tests: aux fix testing for kvdo 2019-01-21 12:53:16 +01:00
Zdenek Kabelac
18aa541ca2 configure: avoid repeative inclusion of configure.h
Since configure.h is a generated header and it's missing traditional
ifdefs preambule - it can be included & parsed multiple times.
Normally compiler is fine when defines have same value and there is
no warning - yet we don't need to parse this several times
and by adding -include  directive we can ensure every file
in the package is rightly compile with configure.h as the
first header file.
2018-12-21 19:19:50 +01:00
Zdenek Kabelac
0b19387dae headers: use configure.h as 1st. header
Ensure configure.h is always 1st. included header.
Maybe we could eventually introduce gcc -include option, but for now
this better uses dependency tracking.

Also move _REENTRANT and _GNU_SOURCE into configure.h so it
doesn't need to be present in various source files.
This ensures consistent compilation of headers like stdio.h since
it may produce different declaration.
2018-12-14 15:09:13 +01:00
Zdenek Kabelac
cb15373ad7 tests: missing copyright 2018-11-19 17:58:09 +01:00
Zdenek Kabelac
4021e88a31 tests: prefer internal header
Although we primarily want to check externally used libdevmapper
library,   out internal  all.h is still keeping all symbols
as the original library has - so for simpler compilation keep
using this private copy for defining needed symbols.
2018-11-17 01:40:29 +01:00
Zdenek Kabelac
188bedf8de tests: correcting header file enclosure
Use "" for internal header file.
2018-11-17 01:12:06 +01:00
Zdenek Kabelac
83d9ea7348 tests: secure data erase 2018-11-17 00:30:50 +01:00
Zdenek Kabelac
9e1ee07d69 tests: missed char in list
'=' also doesn't belong to property name.
2018-10-17 10:41:25 +02:00
Zdenek Kabelac
69bebfd958 tests: fix conf generation with older shells
For shells without array support, fix selecting bug,
and require keyword to end with some 'space' char,
so  'scan' is not matched with  'scan_var'.
2018-10-16 23:49:35 +02:00
David Teigland
3bcc6c7e60 tests: drop lvmetad bits 2018-09-10 11:49:11 -05:00
Marian Csontos
9cd05d1f1e test: Check flavour is used and exists 2018-07-26 15:01:50 +02:00
Zdenek Kabelac
c47655f231 tests: initial vdo tests
Basic functionality of lvcreate, lvchange.
2018-07-09 15:29:16 +02:00
David Teigland
ae961a192a Remove python bindings for liblvm2app 2018-06-08 10:33:47 -05:00
David Teigland
dbc3e62cc0 tests: don't look for liblvm 2018-06-08 09:36:03 -05:00
David Teigland
063d065388 tests: add missing file 2018-05-30 09:25:45 -05:00
David Teigland
595196bc29 tests: enable lvmlockd for passing tests 2018-05-30 09:25:45 -05:00
David Teigland
cd369d8a7f tests: separate lvmlockd tests with or without lvmetad 2018-05-30 09:25:45 -05:00
David Teigland
5ac9f8d631 tests: fix skipping logic for lvmpolld and lvmlockd 2018-05-30 09:25:45 -05:00
Zdenek Kabelac
f865e1bf87 tests: passthrough args with extend_filter_LVMTEST
Don't rebuild config twice.
2018-05-24 11:22:59 +02:00
Zdenek Kabelac
76a45424a7 tests: aux improve for mdadm support
Correcting some symlink handling.
2018-05-24 11:03:47 +02:00
Heinz Mauelshagen
a39eaea27d tests: fix kernal_at_least argument in aux.sh 2018-05-17 14:41:47 +02:00
Zdenek Kabelac
550380c1a4 tests: aux fixes
Properly check for kernel version.
Also detect sysfs throttling support.
2018-05-15 22:02:41 +02:00
Zdenek Kabelac
0217c53b24 tests: dont try to use DAX based brd device
Unfortunatelly on kernels <4.16 lvm2 can't user brd ramdisks
for backend device as number of test is failing with this kernel
message:

device-mapper: ioctl: can't change device type after initial table load.

caused by DAX request-based handling, and lvm2 tries to replace device
with backend 'error' bio-based device and such table reload is being
rejected.

So ATM keep ramdisk only on most recent kernel to experiment a bit,
for older machines just stay safe and keep old slower loop backend.
2018-05-15 16:07:13 +02:00
Zdenek Kabelac
ca87674ea4 tests: fix check sysfs
Commit 810f856c24 missed to move
assign of P after setting maj & min.
2018-05-12 23:01:52 +02:00
Zdenek Kabelac
7b8b13c62b tests: aux detecs supported segments
Replace previous compilation detection of present supported segtypes
with runtime check.
2018-05-12 22:50:36 +02:00
Zdenek Kabelac
0b465d1543 tests: drop cache checking
Just like 52656c89fd
when now cache is compiled in 'unditionally'.

This patch is actually enforce by changes in
commit: 2bc896f2a3
where CACHE value is not set anymore.
2018-05-12 18:18:23 +02:00
Zdenek Kabelac
d38a2d64f0 tests: add support to run unit test 2018-05-12 18:18:23 +02:00
Zdenek Kabelac
cbe81a0b05 tests: inittest may run without root
If the test does not need root, it can use 'SKIP_ROOT_DM_CHECK'.

For such test no actions needed root to initilize DM devices and
nodes will be take and test can check i.e. functional unit tests.
2018-05-12 18:05:50 +02:00
Zdenek Kabelac
0221ebfd64 tests: inittest compare string
Avoid logging warning when compared string is empty with -eq.
2018-05-12 18:05:50 +02:00
Zdenek Kabelac
a7a23e7dd2 tests: aux extra protection for rm -rf 2018-05-12 18:05:50 +02:00
Zdenek Kabelac
7362ed68be tests: move device discard 2018-05-12 17:48:31 +02:00
Zdenek Kabelac
172d8fb355 tests: aux support throttling of dm mirror
Usage of dm_delay looks to be slowing not just 'delayed' portion
of device, but due to the fact it's also slows down ANY flush
operation on such device it's overal speed impact is huge.

In some case we can however user other methods to slowdown disk writes,
in case of old dm 'mirror'  target we can throttle  I/O of mirror
synchronisation giving the next commands enough time to test couple
race conditions.

Usage:

throttle_dm_mirror [percentage]

Thtrottle down sync speed (lowest is '1' which is also default when
unspecified)

restore_dm_mirror

Restores the value of throttling before call of  'throttle_dm_mirror'
Usually it should '100'
2018-05-12 17:48:31 +02:00
Zdenek Kabelac
0cadfdd69d tests: try running tests over ramdisk
Currently usage of loop device over backend file in ramdisk (tmpfs)
is actually causing unnecassary memory consution, since just
reading such loop device is causing RAM provisioning.

This patch add another possible way how to use ramdisk directly
through 'brd' device when possible (and allowed).

This however has it's limitation as well -  brd does not support
TRIM, so the only way how to erase is to remove brd module ??

Alse there is 4K sector size limitation imposed by ramdisk.

Anyway - for some mirror test that were using large amount of
disk space (tens of MB) this brings noticable speed boost.
(But could be worth to solve the slowness of loop in kernel?)

To prevent using 'brd' for testing set LVM_TEST_PREFER_BRD=0
like this:

make check_local LVM_TEST_PREFER_BRD=0
2018-05-12 17:48:31 +02:00
Joe Thornber
52656c89fd functional tests: Update have_raid function
No need to check if it's built in.
2018-05-03 14:22:24 +01:00
David Teigland
c365d7de4f tests: fix THIN built-in check 2018-04-30 13:12:17 -05:00
Zdenek Kabelac
dd7ac793a0 aux: enhance teardown to better handle weird names
When 'dmsetup' reports result with --nameprefixes it currently
incorrectly 'escapes' problematic characters.

Letting pass such string though shell 'eval' function is hard task.
So instead cut away substring.

Once dmsetup will start to properly escape backslash and apostrophe
this function may need further tuning.
2018-04-30 10:41:51 +02:00
David Teigland
d75aa55784 disable LVM1 tests 2018-04-20 11:22:46 -05:00
Zdenek Kabelac
d51429254f tests: improve mirror_images_redundant
Use only passed VG for lvs and avoid 1 extra uneeded use of lvs.
2018-04-20 12:17:01 +02:00
Zdenek Kabelac
3a48fb47b7 tests: shellcheck misc
Few more minor complains from ShellCheck.
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
1507956383 tests: shellcheck split assing
Keep possibly error unmasked by assign
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
397b7891ff tests: shellcheck liter 2018-03-23 17:25:00 +01:00
Zdenek Kabelac
410c992744 tests: shellcheck use grep -E
Replace egrep with grep -E
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
14abe1e87b tests: shellcheck prevention check
Always make sure variable is set to something else the /dev/*
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
fe69731d31 tests: handle setting better
When using 'make check...  LVM_TEST_AUX_TRACE=0'  make it behaving
like other supported VARS in use so it's like disabled.
2018-03-23 17:25:00 +01:00
Zdenek Kabelac
f6f8f0c7fd tests: skip test when not enough space
Make the test skipped instead of failing when there was not
enough space.
2018-03-15 11:01:04 +01:00
Zdenek Kabelac
bed869a8a0 tests: use DM_DEBUG_WITH_LINE_NUMBERS
Use src:line also for debugging of tools like dmsetup.
2018-03-15 11:01:04 +01:00
Zdenek Kabelac
750fc2e876 tests: fix running tests on systems without udevd
Variable was unbound on systems without running udevd.
2018-03-15 11:01:04 +01:00
Zdenek Kabelac
90512910e5 tests: try unfreezeing raids
With problematic kernels raid devices can be occasionaly left with
'frozen' status - try to 'unfreeze' them with idle message on teardown.

Also replace couple greps with 'built-in' dmsetup --select feature.

Note: dmsetup --select  currently reports 'No devices found' on stdout
and return success - looks like a bug to fix.
2018-03-13 12:58:57 +01:00
Zdenek Kabelac
8e5305f630 tests: correct usage of pipe
This is somewhat tricky - for test suite we keep using
'set -e -o pipefail'  - the effect here is - we get error report
from any 'failing' command in whole pipeline - thus when something
like this:   'lvs | head -1'  is used - and  'head' finishes before
lead 'lvs' is done - it recieves SIGPIPE and exits with error,
and somewhat misleading gets occasionally reported depending
of speed of commands.

For this case we have to avoid using standard pipes and rather
switch to using streamed results with temporary output file.
This is all nicely handled with bash feature '< <()'.

For more info:
https://stackoverflow.com/questions/41516177/bash-zcat-head-causes-pipefail
2018-02-19 16:45:10 +01:00
Zdenek Kabelac
5baf2de898 tests: longer startup timeout for daemons with valgrind
It's getting noticable somewhat slower...
2018-01-17 14:45:48 +01:00
Zdenek Kabelac
0bf1cc2320 tests: sleep first
Sleep a bit before checking /sys/block dir so the kernel has a moment to
actually put scsi debug device in it...

Some quite old kernels are in troubles with this plain searching grep
without sleep (namely 2.6.32)

modprobe scsi_debug
 <sleep .1>
grep -H scsi_debug /sys/block/*/device/model
modprobe -r scsi_debug
2017-12-19 15:28:07 +01:00
Marian Csontos
15ccea7111 test: Fix condition when detecting lvmdbusd 2017-12-12 14:19:22 +01:00
Marian Csontos
2f4c2a43d4 test: lvmdbusd is used for process name
lvmdbusd was started, but the process was not recognized by pgrep.

- configure does not make the script executable - set the flag
  explicitly when running make check,
- process name changed to lvmdbusd. The previous python3 value
  originated from the use of /usr/bin/env.
2017-12-12 13:17:07 +01:00
Marian Csontos
b8caca4652 tests: Fix common_dev_ argument handling
from[:[len]] arguments with missing colon assigned from to len, instead
of till_the_end_of_device.
2017-11-28 12:03:35 +01:00
Zdenek Kabelac
fe69a8d215 tests: use nonflusing status
Avoid being blocked when reporting status with flushing on some stacked
device tree.
2017-11-11 01:00:35 +01:00
Zdenek Kabelac
1e80ec8926 tests: allow override of LVM_LOG_FILE_MAX_LINES
Just like with other vars support this:

make check_local T=xyz LVM_LOG_FILE_MAX_LINES=10000000

Allows easily to override existing line limit.
Also increase limiting size of logs per command since some of
our commands are becoming very verbose....
2017-10-26 14:04:58 +02:00
Zdenek Kabelac
d9f9ce1268 tests: use portable df output
For awk parsing more 'predictable' format of output line is needed.
2017-09-20 15:34:02 +02:00
Zdenek Kabelac
2fd2b197ab tests: check for free space in test dir
Avoid starting test, when test dir has less then 50M of free space.
Better to crash early before letting die machine on weird crash
in OOM cases...

Also show free disk space when test starts
2017-09-20 15:14:16 +02:00
Zdenek Kabelac
7b048f6b43 tests: aus.sh fix md teardown
Commit 8a912d6dbc missed the wrong logic,
we use 2 vars 'dev' & 'mddev' and their usage can't be mixed.

So correctly separate them so mddev keeps name of MD device.
2017-07-20 12:16:27 +02:00
Zdenek Kabelac
86d7adc2a5 tests: aux.sh fix wait_pvmove_lv_ready
Ignore error if the 'queried' LV is still not available
(since 'get' now properly returns failure when LV is missing)
2017-07-19 12:15:39 +02:00
Zdenek Kabelac
43dbfee32a tests: aus.sh better defaults 2017-07-18 21:25:03 +02:00
Zdenek Kabelac
9599645bb6 tests: aux.sh limit device
During test do a more close selection of visible devices.
If some test leaks a device with LVMTEST prefix, next
test should not be influnced (or parallel running one).

If the test is running in non-/dev  dir - it's already protected
by full path with $PREFIX in it - however it test is running
in real /dev dir - there was no such protection and test
were confused when they have seen such leaked device.
2017-07-18 13:14:02 +02:00
Zdenek Kabelac
fde23f7ce1 tests: better support for unbound vars for older shell 2017-07-17 20:32:48 +02:00
Zdenek Kabelac
5a5553bcec tests: aux.sh some backward compatible updates
Older bash does not take empty array as bounded variable
(except for $@)
2017-07-17 15:01:44 +02:00
Zdenek Kabelac
f293d46946 tests: aux.sh correcting bounder values
grep for defined PREFIX.
use 'dev' instead of undefined mddev.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
84b56872fb tests: aux.sh also uses increseed hardening protection
Also use similar incresed hardeing of script correctness
for standalone aux scripts - so there is one common
logic for pipe failures.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
bd2a0fe2ec tests: utils.sh look for more coredump places
Quoting helps to anyone storing coredumps inside dir with spaces....
Also add default dir for coredumps with systemd coredumpctl.
2017-07-17 12:33:42 +02:00
Zdenek Kabelac
413209f3f8 tests: utils.sh looks for more dumps
Check for core in  sysctl kernel.core_pattern
(assuming core prefix still)
2017-07-15 00:12:07 +02:00
Zdenek Kabelac
2154f30a99 tests: add udev_wait before tearing scsi_debug
Make less probably there will be some udev work going while we try
to remove scsi_debug target.
2017-07-14 20:30:04 +02:00
Zdenek Kabelac
ac0945bc4a tests: aux.sh fix double quote
Patch 72a58ce4b0 was wronly placing
double quotes around this variable which we want to pass expanded,
as it's just set of 'space' device args ATM.

TODO consider using array[@] to make this cleaner.
Add shellcheck directive to skip warning here
2017-07-14 20:29:38 +02:00
Marian Csontos
1c95cf8c6f tests: utils.sh six stacktrace
Changes:

- BASH_SOURCE index was one off.
- The first line of stacktrace was pure confusion displaying executed
  script together with innermost line number (which was either 125 when
  STACKTRACE or 229 when skip was called.)
- We can safely ignore innermost call, as stack trace is always produced
  by stacktrace function.
- It is safer to test for array length, instead of testing FUNCNAME is
  main - if main function were introduced.
- Bashishm is safe to use as this function as a whole is relying on bash.
2017-07-14 20:18:42 +02:00
Zdenek Kabelac
cd4e6c9b17 tests: aux.sh integrate both teardown loops
Use 1 logic for 2 loops tearing down left device.
First loops tries to remove all closed devices with 'normal' remove.
Second loop tries to replace those left devices with 'error' target.
2017-07-14 13:22:15 +02:00
Zdenek Kabelac
e682af7878 tests: aux.sh better teardown loop
We can't really sleep that much in teardown as it slows test too much.
So do a nested loop (similar to 'dmsetup remove_all') and keep
removing devices with open count == 0 as long as it works.
2017-07-14 00:27:55 +02:00
Zdenek Kabelac
490e6e9ef1 tests: add some delay after dmsetup
When we want to squash as much device as possible,
it's better to give it some delay, so devices have
some time to release it's resouces for next removal.

Also drop surrounding cookie processing and let each
dmsetup call run on its own.
2017-07-13 21:11:16 +02:00
Zdenek Kabelac
c4b6df94b4 tests: properly check variables were defined
When test suite is installed some vars are not defined.
2017-07-12 13:51:16 +02:00
Zdenek Kabelac
5a91b0a2e2 tests: fix detection of running dmeventd after test
The checking order here has happend after TESTDIR was removed
resulting in weird further error on trap path.

Properly check for unexpected dmeventd before removing TESTDIR
since  'trap' codepath is still using it.

Also try to kill this unexpected dmeventd so testing is
not skipping all next  dmeventd tests.

(Downside would be - if user would be accidentally starting
dmeventd by some regular system admin work - such dmeventd
might be killd if it's unused. It can't kill dmeventd in-use.
2017-07-12 13:38:07 +02:00
Zdenek Kabelac
d9ef564e42 tests: utils.sh drop gdb_commands.txt
Remove file after use (fixes recursive STACKTRACE calls)
2017-07-12 01:50:06 +02:00
Zdenek Kabelac
8387f4efc9 tests: more vars bounded 2017-07-12 01:21:44 +02:00
Zdenek Kabelac
2baac408fc tests: aux.sh better loop logic
Instead of using pipe for read and haveing no chance
to modify shell vars inside such loop  use  <( )
and keep using bash arrays.
2017-07-12 01:21:44 +02:00
Zdenek Kabelac
a87860965e tests: hardening - no unbound vars
Dissallow usage of any unbound shell variable in tests.
All vars needs to have some defined value.
2017-07-11 16:48:25 +02:00