1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

2368 Commits

Author SHA1 Message Date
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
Heinz Mauelshagen
dd88a0f05c raid: support raid5_n convenience type on conversion to raid10
Fix requesting a conversion on raid5_{ls,rs,la,ra} -> raid10
not offering offering interim convenience type raid5_n.

Resolves: rhbz1468600
2018-03-09 21:23:16 +01:00
Zdenek Kabelac
15b6793528 tests: skipping test waiting for fixed kernel
Once working kernel is released, reenable me...
2018-03-06 15:42:49 +01:00
Zdenek Kabelac
b05caca77e tests: component activation 2018-03-06 15:42:49 +01:00
Zdenek Kabelac
cc4855acbe tests: check inactive extorig resize 2018-02-28 21:15:55 +01:00
Marian Csontos
32bcdd90ae tests: check vgsplit thin-data and ext.origin 2018-02-27 14:37:47 +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
f5401fbd34 tests: update 2018-02-15 13:56:35 +01:00
Marian Csontos
dd6fbcbb69 test: mirrored mirrorlog is not supposed to work in cluster 2018-02-14 13:10:52 +01:00
Zdenek Kabelac
102926ed9f tests: update set of devices
Previous change added slighly more complex mapping so missed to update
few pieces.
2018-01-23 11:45:18 +01:00
Zdenek Kabelac
e16d309d56 tests: check pvmove is merging segments
pvmove was imporoved to properly merge consqutive segments after pvmove
so check it's working.
2018-01-17 14:45:48 +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
8ebd45fde7 tests: check preserved exclusivness of snapshot merge
Detect if origin remains exclusively activated after merging.
2018-01-17 14:45:48 +01:00
Zdenek Kabelac
8c7ec44bf0 tests: properly test with clustered VG
Testing in cluster makes sense only with clustered VG.
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
Heinz Mauelshagen
584ff361df test: fix trap adding proper teardown to previous, new raid tests
Also remove superfluous variable.
2017-12-13 14:41:23 +01:00
Heinz Mauelshagen
86fa0333ff test: new raid tests
Add three new raid tests with io load and table
reloads during reshape for target 1.13.2.

Add a raid0 to raid10 conversion test.

Also add more signals to trap in lvconvert-raid-reshape-load.sh.
2017-12-13 13:30:53 +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
Heinz Mauelshagen
b74e7f6a78 test: allow to succeed in the cluster
Avoiding "$(get first_extent_sector "$d")" in the loop
allows the test to succeed in the cluster.  Further cluster
analysis needed to get to the core reason.
2017-12-01 18:59:55 +01:00
Heinz Mauelshagen
053314f295 test: add large tests skip option
The lvm2 test suite aims at small test resource footprints
(few PVs, small PV sizes) to run on tmpfs backed loop device.

OTOH, lvconvert-reshape-raid.sh aims to test the maxima of
supported total stripes of 64.  This patch adds a prerequisite
conditional to skip tests using more than 14 stripes.

It requires the target version 1.13.1 to avoid deadlocks.
2017-12-01 18:50:55 +01:00
Heinz Mauelshagen
7aef59c6c3 test: reduce pv sizes, fix comment and stripe size 2017-12-01 18:42:37 +01:00
Heinz Mauelshagen
16fa9d9ed5 test: cleanup command 2017-12-01 18:39:38 +01:00
Heinz Mauelshagen
3688eeeea0 test: disable new reshape test until target version 1.13.1 2017-12-01 18:33:11 +01:00
Heinz Mauelshagen
9681d98cc4 test: new reshape test under io load 2017-12-01 18:31:12 +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
ce83162d7c tests: more places where missing should not appear 2017-11-24 16:09:59 +01:00
Zdenek Kabelac
7eae2647c0 tests: typo 2017-11-24 16:09:59 +01:00
Zdenek Kabelac
5e88d3a89b cache: use conditional in warning message
In some cases the message could be slightly misleading so use
here rather conditional.

TODO:

In future we may possibly further tune the message in case we are
certain the level of redundancy protection has not been reduced.
2017-11-24 16:09:59 +01:00
Zdenek Kabelac
b0618f9011 tests: pvmove supports more cases
pvmove handles cached LVs as well as snapshots now.
2017-11-15 21:00:29 +01:00
Heinz Mauelshagen
7a5728fb4c test: additional avoid have_raid overhead 2017-11-14 14:41:44 +00:00
Heinz Mauelshagen
97750cd12f test: avoid have_raid overhead 2017-11-14 14:41:15 +00: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
Ondrej Kozina
f0d1c8429b test: check dmsetup hides integrity encryption keys 2017-11-10 15:23:07 +01:00
Marian Csontos
512b2adc77 test: D-Bus test_nesting requires filter 2017-11-09 11:57:59 +01:00
Marian Csontos
cd3b5e60a8 test: Rename test nothing methods
These two methods might be useful for debugging, but are not testing
anything.
2017-11-09 11:31:54 +01:00
Zdenek Kabelac
b78add3df5 tests: allow to proceed futher with test
So raid doesn't want to create raid arrays with bigger regionsize ATM,
so just use smaller regionsize.
2017-11-08 00:02:54 +01:00
Zdenek Kabelac
d6473b2018 tests: detect racy systemd version
Systemd 222 has a bug - where it's sometimes umount unpredictibly just
mounted device - skip testing when this happens.
2017-11-08 00:02:54 +01:00
Zdenek Kabelac
2172115379 tests: have some space for 2nd mda
pvcreate with 2MDAs needs some extra space.
2017-11-08 00:02:54 +01:00
Zdenek Kabelac
e822a9f38d tests: snasphot merging 2017-11-07 21:34:35 +01:00
Jonathan Brassow
4129cf5090 testsuite: Forgot to pull 'should's after fixing RAID4/5/6 mismatch test
Test will now fail rather than warn if conditions are not met.
2017-11-02 10:25:46 -05:00
Jonathan Brassow
9e8dec2f38 testsuite: Fix problem when checking RAID4/5/6 for mismatches.
The lvchange-raid[456].sh test checks that mismatches can be detected
properly.  It does this by writing garbage to the back half of one of
the legs directly.  When performing a "check" or "repair" of mismatches,
MD does a good job going directly to disk and bypassing any buffers that
may prevent it from seeing mismatches.  However, in the case of RAID4/5/6
we have the stripe cache to contend with and this is not bypassed.  Thus,
mismatches which have /just/ happened to an area that now populates the
stripe cache may be overlooked.  This isn't a serious issue, however,
because the stripe cache is short-lived and reasonably small.  So, while
there may be a small window of time between the disk changing underneath
the RAID array and when you run a "check"/"repair" - causing a mismatch
to be missed - that would be no worse than if a user had simply run a
"check" a few seconds before the disk changed.  IOW, it simply isn't worth
making a fuss over dropping the stripe cache before beginning a "check" or
"repair" (which we actually did attempt to do a while back).

So, to get the test running smoothly, we simply deactivate and reactivate
the LV to force the stripe cache to be dropped and then proceed.  We could
just as easily wait a few seconds for the stripe cache to empty also.
2017-11-02 09:49:35 -05:00
Jonathan Brassow
5013032845 testsuite: Add and document a 'should' for "idle" -> "recover" RAID test
When a "recover" is just starting for a RAID LV, it is possible to get
"idle" for the sync action if the status is issued quickly enough.  This
is fine, the MD thread just hasn't gotten things going yet.  However,
the /need/ for a "recover" should be marked in md->recovery and it would
be simple enough to fix the kernel so this doesn't happen.  May eventually
want a separate bug for this, but for now it fits with RHBZ 1507719.
2017-11-02 08:53:48 -05:00
Jonathan Brassow
bc29785d09 test: clean-up failing test case and document 'should' cases
There are two known bugs in the lvconvert-raid-status-validation.sh
test.  The first one I consider to be more of an annoyance (1507719).
The second one I consider to be more serious (1507729).

RHBZ 1507719 simply documents the fact that the three RAID status
fields may not always be coherent due to the way they are set and
unset when the MD thread is shutting down and starting up.  For
example, the sync ratio may be 100% but the sync action may not
yet have switched to "idle" and the health characters may not yet
all be 'A's (i.e. the devices set to InSync).

RHBZ 1507729 is more serious.  The sync ratio can be 100% for a
short period of time after upconverting linear -> RAID1.  It is
reset to 0 once the MD sync thread gets to work on it.  It does
this because, technically, the array /is/ in-sync if the new
devices are excluded - i.e. the data is 100% available and
consistent.  I'm not sure what to do about this problem, but we'd
much rather not have this state that looks exactly like the
end of the process when the sync ratio is 100% because the
"recover" process finished, but the sync action and health
characters haven't been updated yet.  Put simply, the problem
is that we can't tell if a sync is starting or finished based
on the status output.
2017-10-30 21:58:38 -05:00
Zdenek Kabelac
7e3be7d1ba tests: revert commit change
Commit 0424410773 by mistake took also
this unwanted local modification of test - revert it.
2017-10-30 17:27:29 +01:00
Zdenek Kabelac
3efd1f9c6e tests: load reiserfs
Preload reiserfs module for the case, fs is present/compiled for a
kernel but it's not present in memory.

Size reducition needs --yes confirmation to preceed for reiserfs.
2017-10-30 14:39:16 +01:00
Zdenek Kabelac
0424410773 validation: capture store of LV without segment 2017-10-30 14:39:16 +01:00
Zdenek Kabelac
af21263cb3 thin: fix merging messages
Correct reported message when thin snapshot has been already merged.
So lvm2 is no longer reporting "Mergins of snapshot X will occur..."
(even with swapped names).
2017-10-30 11:53:39 +01:00
Zdenek Kabelac
eb710cced1 tests: update checked messages 2017-10-27 17:07:42 +02:00
Zdenek Kabelac
b765288bf2 tests: better clustering support
Use exclusive activation for snapshot conversion since we can only
convert exclusively active volumes.
2017-10-26 14:04:58 +02: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
04186616be Makefile: help shows hint about LVM_LOG_FILE_MAX_LINES 2017-10-26 14:04:58 +02:00
Zdenek Kabelac
f32ef63b6c tests: snapshot conversions
Add missing tests for snapshost conversions.
2017-10-25 22:02:24 +02:00
Jonathan Brassow
38f7fbac64 clean-up: Correct the comment to match the particular test case 2017-10-24 14:06:44 -05:00
Zdenek Kabelac
10c76ce35a tests:check lvconvert with /dev in vglvname 2017-10-24 16:16:08 +02:00
Ondrej Kozina
213cea3aaa test: add regression test for fsadm bug
the bug in LUKS grow/shrink decision in fsadm was
masked due to fact that default LVM2 extent size
was larger than LUKS1 default data offset for dm-crypt
mapping. The new test address this bug.
2017-10-24 13:41:00 +02:00
Zdenek Kabelac
888dd33148 tests: check stacked cache dataLV of thin-pool 2017-10-23 12:01:16 +02:00
Heinz Mauelshagen
d6f4563103 test: remove 'should's from test to test target status race fix 2017-10-19 17:41:44 +02:00
Zdenek Kabelac
1f359f7558 tests: check external origin is monitored 2017-10-16 15:47:46 +02:00
Marian Csontos
ae55b1b20a test: "Disable" lvconvert-raid-reshape
...when running from ramdisk. This causes test failure, so it is kept on
eyes.
2017-10-12 10:55:02 +02:00
Ondrej Kozina
71261ae374 test: update fsadm-crypt to pass with legacy cryptsetup 2017-10-11 14:39:33 +02:00
Ondrej Kozina
e61313843f test: fsadm-crypt.sh fixes
use conservative 'luksOpen' command instead
fix reiserfs tests on plain crypt devices
2017-10-10 15:47:04 +02:00
Ondrej Kozina
27ef503b35 test: add fsadm crypt test 2017-10-10 14:19:07 +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
a15b796146 tests: repair of cachepool 2017-09-20 15:14:16 +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
Peter Rajnoha
aa75ca6332 test: pvcreate-bootloaderarea: pvcreate --restorefile --bootloaderarea not supported anymore
The fact that this combination is not supported anymore is tested
already in pvcreate-operation.sh test.
2017-08-15 14:15:50 +02:00
Peter Rajnoha
3c978f7bcc pvcreate: fix check for 2nd mda at end of disk fits if using pvcreate --restorefile
Fix code checking that the 2nd mda which is at the end of disk really
fits the available free space and avoid any DA and MDA interleaving when
we already have DA preallocated. This mainly applies when we're restoring
a PV from VG backup using pvcreate --restorefile where we may already have
some DA preallocated - this means the PV was in a VG before with already
allocated space from it (the LVs were created). Hence we need to avoid
stepping into DA - the MDA can never ever be inside in such case!

The code responsible for this calculation was already in
_text_pv_add_metadata_area fn, but it had a bug in the calculation where
we subtracted one more sector by mistake and then the code could still
incorrectly allocate the MDA inside existing DA. The patch also renames
the variable in the code so it doesn't confuse us in future.

Also, if the 2nd mda doesn't fit, don't silently continue with just 1
MDA (at the start of the disk). If 2nd mda was requested and we can't
create that due to unavailable space, error out correctly (the patch
also adds a test to shell/pvcreate-operation.sh for this case).
2017-08-15 13:40:25 +02:00
Zdenek Kabelac
5dd53943c9 tests: update checked message 2017-08-02 00:04:35 +02:00
Zdenek Kabelac
19bd65207e tests: update makefiles 2017-08-01 18:53:25 +02:00
Zdenek Kabelac
a60fd57236 tests: update makefile 2017-08-01 11:53:32 +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
466da710e0 tests: avoid endless loops
If there is some problem with device removal avoid generating very long
error logs...
2017-07-18 21:17:51 +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
3c32883cec test: repeat rediscovery few times
Avoid using 'aux' shell when setting dmsetup cookie.
Do not user '--force' when using external cookie.
2017-07-17 13:38:31 +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
d15b9ac510 tests: extend lvcreate size validation 2017-07-17 12:33:42 +02:00
Zdenek Kabelac
c64e2a85cb tests: use get_devs 2017-07-15 00:13:33 +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
8a2448a4ed tests: skip test for non dirty cache
Seems some cache LV can't be made dirty easily with older
cache policy implementations....
2017-07-14 00:42:40 +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
f64f6c5e70 tests: wait for udev to minize race windows
mkfs can complain about volume in use when meets udev rule processing.
2017-07-13 21:11:16 +02:00
Zdenek Kabelac
870c7bc76c tests: bound variables 2017-07-13 21:11:16 +02:00
Zdenek Kabelac
e88534b680 tests: delay read of cache pool data
It's better to delay read of cached data.
Limit loop checking for cleaner policy.
2017-07-13 21:11:16 +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
c838e79cd2 tests: fix for new hardened bash
Add missing get_devs.
When $7 is not given use empty string.
See if we can live with less RAM disk for PVs.
Drop limitation on single core as presence 1.12 should address this.
2017-07-12 18:05:56 +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
1daa1cc3a9 tests: use properly quoted device list 2017-07-12 13:50:25 +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
0f2dccc601 tests: bounds still more vars 2017-07-12 01:37:29 +02:00
Zdenek Kabelac
ec9b845aaa tests: drop type
Assuming test wanted to check $lv3 does not exists.
2017-07-12 01:21:44 +02:00
Zdenek Kabelac
a1ed9bc145 tests: more exact test
Check there is really just linear.

Also short-circuit mimages_are_on_ when file is empty
(avoids unbound  mimages[@] access on older bash)
2017-07-12 01:21:44 +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
b97f75b133 tests: improve logic for a race to catch abortion 2017-07-11 17:21:25 +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
Zdenek Kabelac
41e11e0f21 tests: check.sh simplify in_sync
Avoid calling sed.
2017-07-11 16:26:12 +02:00
Zdenek Kabelac
5ab2676bac tests: double quote 2017-07-11 16:26:12 +02:00
Zdenek Kabelac
21e0e98665 tests: correct typo
Use defined MARKED_AS_USED_MSG shell var.
2017-07-11 16:26:12 +02:00
Zdenek Kabelac
429e613ba8 tests: avoid unbound shell var usage 2017-07-11 16:26:12 +02:00
Zdenek Kabelac
f11e74ae3d tests: improve test logic
Use existing vars.
Reduce extra lvchange -an and use directly activation with lvcreate.
2017-07-11 16:26:12 +02:00
Zdenek Kabelac
e9a544b942 tests: avoid using readarray
Real bashman can live without readarray.

Support older tested machines with bash <4.0....
2017-07-10 17:40:31 +02:00
Zdenek Kabelac
d23a475c98 tests: using prepare_vg 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
dafeb0274a tests: assign path 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
f818a83a1d tests: fix array usage
Use bash arrays to pass devs.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
85e5a8803c tests: simplify and doublequote 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
1c9789b0cc tests: use well defined test
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.

Apparently && and || "short-circuit" while -a and -o do not.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
9c0a92ee8d tests: cleaner written eval
Although code work this coding style is better.
This \c will be a regular 'c' in this context.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
ec05890026 tests: mixes string and array
Argument mixes string and array. Use * or separate argument
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
4e2fd6f6ab tests: fix caller of mirror_images_on
Missed vg name.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
bc10d0373a tests: fix working with devs in array
Also fixes one instance of invalid  'mirror_image_on' test
and places there correct indexed set of PVs.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
fdbb680531 tests: check mirror_images_on fixed
Fix mirror_images_on() to actually report something useful (thought
it might be tuned later).

So for now the function got through all '_mimages_' and compares
where the order of them is matching given list of devices.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
91d6a62fc5 tests: correcting usage of $@
Use "$@" (with quotes) to prevent whitespace problems.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
f161c6ee9f tests: assign as string
Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
2e47ab9b8c tests: secure rm call
Use "${var:?}" to ensure this never expands to / .
(Should never happen as 'dir' was supposed to exist from preceding
test.)
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
4ed3f1bee3 tests: improve loop 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
e68d986cd5 tests: check result directly 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
160cb1e713 tests: replace cat usage 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
e11de5847d tests: add space to split words
Fixing shellcheck warning:
This word is outside of quotes. Did you intend to 'nest '"'single quotes'"' instead'?
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
270e526734 tests: fix tests variable
Actually check $r instead or 'r' for test failure.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
38917ee51c tests: replace legacy code
Use $(..) instead of legacy `..`.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
d606891e4a tests: fix quoting 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
494d819a6f tests: drop extra sourcing of utils
This sourceing is automatic by . lib/inittest
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
ff2242036b tests: drop useless literal
Here was usage of '\' unneeded.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
5214e62f09 tests: drop unneeded ; 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
c3d8ee4da2 tests: drop unneeded check
Test should actually fail in this condition as it's testing lvmetad.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
4a5eea7758 tests: drop unneeded echo 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
2d96b758e4 tests: drop unneeded cat 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
eba96a9720 tests: fix possible misspelling
Possible misspelling: FAILED_MIXED_STR may not be assigned, but FAIL_MIXED_STR is.
Possible misspelling: FAILED_MULTI_STR may not be assigned, but FAIL_MULTI_STR is.
Possible misspelling: FAILED_BLACK_STR may not be assigned, but FAIL_BLACK_STR is.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
d4345220cc tests: avoid masking return values
Declare and assign separately to avoid masking return values.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
146bfb2417 tests: math drop uncessary $/${}
$/${} is unnecessary on arithmetic variables.

Use $((..)) instead of deprecated $[..]
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
72e82b42a9 tests: aux.sh tweaks
Some improvements.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
73cb5b486a tests: aus.sh avoid duplicating arg list 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
f612fdd1dd tests: aux.sh common pattern for starting daemons 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
4fc0166ca9 tests: aux.sh move corosyn 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
408e3b84f6 tests: cleanup msg 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
73bbd5528c tests: scripts double quote 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
74ef5f07d0 tests: use read -r 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
7a8f87d28b tests: replace egrep 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
bdd95051ed tests: use bash array 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
efcbad25ee tests: drop wc -l when grep -c works 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
e55bae2b2c tests: use bash 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
24751b45bd tests: double quote 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
5ca4fd0478 tests: correcting usage of '==' in bash 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
d12c0ae163 tests: utils.sh assign directly
Assign properly quoted vars in eval directly.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
f21d812127 tests: get.sh use simplier tr 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
d426d7e709 tests: aux.sh check for already present config
'aux lvmconf' detects if new config needs to be regenerated.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
32c0dc3549 tests: aux.sh double quote 2017-07-10 14:23:53 +02:00
Zdenek Kabelac
84e83ac37e tests: aux.sh replace sed call
Use internal shell vars manips
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
928a49a7c8 tests: aux.sh use grep -E
egrep is nonstandard.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
5bd09cb79d tests: aux.sh drop useless echo
Simply trim on space.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
6be61bf044 tests: aux.sh check cd result
Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
2017-07-10 14:23:53 +02:00
Zdenek Kabelac
c87e1afa03 tests: export many shell vars with 1 command 2017-07-10 14:23:53 +02:00
Heinz Mauelshagen
70c340dbc2 test: return 0 if ignoring 'a' device health chars is requested
This allows lvconvert-raid-reshape-striped_to_linear.sh to succeed when
it reduces raid5 to two stripes before converting to raid1 and linear.
2017-07-04 19:34:10 +02:00
Zdenek Kabelac
006a9eaada tests: aux.sh fix pattern
Commit 72a58ce4b0 fixed 'translation' of
pattern by bash by using "" - so we need to drop '\' here to get
wanted behavior.
2017-06-30 21:13:07 +02:00
Zdenek Kabelac
c31614eccc tests: aux.sh use subshell for simple redirection 2017-06-30 17:08:47 +02:00
Zdenek Kabelac
57779e39ec tests: correcting globbing usage
Ensure globbing uses current dir.
Break loop when no match is found.
Let STACKTRACE finish its output when gdb fails.
2017-06-30 14:40:50 +02:00
Zdenek Kabelac
9348ad4f16 tests: aux prepares lvmdbusd
Correctly skip the test when lvmdbusd is found already running.
For pgrep usage we need to add '-f -l' options to get python3 name
printed.
Remove no longer used 'pids' local var.
2017-06-30 12:12:16 +02:00
Zdenek Kabelac
674a93ffe3 tests: aux do not specify bitmap for raid0 2017-06-30 12:09:10 +02:00
Zdenek Kabelac
596cf2c6fa tests: check LV in proper VG 2017-06-30 12:09:10 +02:00
Zdenek Kabelac
e84a145cf4 tests: check.sh uses array for list
For properly quoted args, switch to use arrays for arg list.
2017-06-30 12:09:10 +02:00
Zdenek Kabelac
c613fa48ff tests: api updates 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
3d90c7fffc tests: get.sh declare and assign separately
Declare and assign separately to avoid masking return values.

Also comment-out currently unused  orig variable.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
834b82b0cd tests: get.sh double quote 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
d7b3815223 tests: utils.sh separately assign
Declare and assign separately to avoid masking return values.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
cf4b671acd tests: utils.sh avoid iterating over ls output 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
4697937af4 tests: utils.sh arithmetic
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]].
$ is unnecessary on arithmetic variables.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
00957450eb tests: utils.sh no mixed string array
Argument mixes string and array. Use * or separate argument.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
c396053955 tests: utils.sh double quote 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
b442861f50 tests: lvm-wrapper.sh legacy syntax 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
b1f80512c8 tests: lvm-wrapper.sh double quote 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
32be18959d tests: inittest.sh double quote and mixing string 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
b45ca523ec tests: check.sh eliminate useless cat
Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
51237cb504 tests: check.sh better if
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
db338c2b42 tests: check.sh drop unnecessary $
$/${} is unnecessary on arithmetic variables.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
c0197040a5 tests: check.sh using grep -F
fgrep is non-standard and deprecated. Use grep -F instead.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
824db54128 tests: check.sh no mixing string
Argument mixes string and array. Use * or separate argument.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
810f856c24 tests: check.sh assign separately
Declare and assign separately to avoid masking return values.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
02729202f3 tests: check.sh double quote 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
491fcd2a92 tests: aux.sh fix pid handling
Modification of pids is local (to subshell caused by pipeline).
pids was modified in a subshell. That change might be lost.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
96fcf82ddd tests: aux.sh add -r to read 2017-06-29 22:23:17 +02:00
Zdenek Kabelac
ec02307e95 tests: aux.sh array assing
Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
8a912d6dbc tests: aux.sh separately assign
Declare and assign separately to avoid masking return values.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
4f63b7e9c1 tests: aux.sh using grep -c
Consider using grep -c instead of grep|wc -l.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
b16ca76260 tests: aux.sh no mixing string
Argument mixes string and array. Use * or separate argument.
2017-06-29 22:23:17 +02:00
Zdenek Kabelac
44e530b919 tests: aux.sh drop unnecessary $
$/${} is unnecessary on arithmetic variables.
2017-06-29 22:23:16 +02:00
Zdenek Kabelac
474e3cd66d tests: aux.sh use pgrep 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
72a58ce4b0 tests: aux.sh double quote 2017-06-29 22:23:16 +02:00
Zdenek Kabelac
52f4042f1a cmdline: fix missing NULL at end of array of args
lvm_run needs to place NULL as the last element into argv[].
Otherwise we get:

Conditional jump or move depends on uninitialised value(s)
 _command_required_pos_matches (lvmcmdline.c:1443)
 _find_command (lvmcmdline.c:1610)
 lvm_run_command (lvmcmdline.c:2770)
 lvm2_run (lvmcmdlib.c:91)
2017-06-26 20:07:21 +02:00