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

126 Commits

Author SHA1 Message Date
Zdenek Kabelac
8d1a946a9b tests: update unit-tests
Fix some memleaks.
Drop call of bcache_clear_fd() when bache was not initialized.
2024-04-10 00:04:54 +02:00
Zdenek Kabelac
cb16f5053f cov: make obvious how free of memory happens
When there is allocation, it needs also deallocator.
Remove no longer needed coverity warning masking.
2024-04-10 00:03:09 +02:00
Zdenek Kabelac
88ad83e3d6 makefiles: use SHOW 2024-04-08 14:52:23 +02:00
Zdenek Kabelac
5210f6665c tests: unit test for raid status 2023-10-31 18:53:30 +01:00
David Teigland
ee8fb0310c remove static autoactivation
event based autoactivation is now the only method that lvm
provides for autoactivation.

Setting lvm.conf event_activation=0 can still be used to disable
event based autoactivation commands, but doing so will no longer
enable static autoactivation.
2022-01-27 16:43:11 -06:00
Zdenek Kabelac
e7b5f490c5 cov: ignore close result 2021-10-15 23:40:29 +02:00
Zdenek Kabelac
2e2d673780 makefile: enhance run-unit-test target
Use TMPDIR for executing test and also ensure
all libraries linked to the test are from builddir.
2021-10-15 09:55:54 +02:00
Zdenek Kabelac
037165300e unit-test: better check for O_DIRECT
Instead of guessing tmpfs usage, just directly try if we could
reopen file with O_DIRECT on the used filesystem.
2021-10-15 09:55:54 +02:00
Zdenek Kabelac
a13dfcbc77 cov: check for function result 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
b1f33a4000 tests: len always initialized 2021-09-20 16:24:08 +02:00
Zdenek Kabelac
1b52451996 cov: mask some warning about leakage
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
efaab93491 cov: ignore syscall 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
9721f3e0ff cov: test for fixture being NULL pointer
Explicit check for teoretical NULL pointer passed as fixture.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
d5c82b0e73 cov: better defined constructors
Ensure C++ initializes all struct members.
Also some deterministic buffer initialization.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ebd150366f cov: add explicit NULL pointer check
Make obvious to coverity strcmp() is not getting NULL pointer.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
ce907bcd26 cov: handle teoretical sysconf failure
sysconf() may also return -1 although rather theoretically.
Default to 4K when such case would happen.
Also in function call it just once and keep as static variable.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
b6e9892bc6 tests: use single funtion to get random value 2021-09-20 14:18:13 +02:00
Zdenek Kabelac
a428856a21 tests: fix test of read buffer
Patch 7aba7fe68b incorrectly
converted  SECTOR_SIZE * BLOCK_SIZE_SECTORS to sizeof(f->data).
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
30b188857c gcc-fanalyzer: some explicit NULL checks for tests
Testing code being happier with these extra checks...
2021-09-20 14:17:46 +02:00
Zdenek Kabelac
834f17bb33 clang: ensure new_len is at least 1 2021-09-20 10:51:30 +02:00
Zdenek Kabelac
aee0cd6530 makefiles: static linking enhancements 2021-04-12 09:54:15 +02:00
Wu Guanghao
262008f1ce unit-test: modify for systems with PGSIZE of 64K
This modification supports dynamically obtaining the value of PAGE_SIZE,
which is compatible with systems with PAGE_SIZE of (4K/64K)

Signed-off-by: wuguanghao <wuguanghao3@huawei.com>
2021-03-11 00:56:43 +01:00
David Teigland
1570e76233 bcache: use indirection table for fd
Add a "device index" (di) for each device, and use this
in the bcache api to the rest of lvm.  This replaces the
file descriptor (fd) in the api.  The rest of lvm uses
new functions bcache_set_fd(), bcache_clear_fd(), and
bcache_change_fd() to control which fd bcache uses for
io to a particular device.

. lvm opens a dev and gets and fd.
  fd = open(dev);

. lvm passes fd to the bcache layer and gets a di
  to use in the bcache api for the dev.
  di = bcache_set_fd(fd);

. lvm uses bcache functions, passing di for the dev.
  bcache_write_bytes(di, ...), etc.

. bcache translates di to fd to do io.

. lvm closes the device and clears the di/fd bcache state.
  close(fd);
  bcache_clear_fd(di);

In the bcache layer, a di-to-fd translation table
(int *_fd_table) is added.  When bcache needs to
perform io on a di, it uses _fd_table[di].

In the following commit, lvm will make use of the new
bcache_change_fd() function to change the fd that
bcache uses for the dev, without dropping cached blocks.
2020-09-18 15:10:11 -05:00
Joe Thornber
5fdebf9bbf [bcache] add unit test
abort-forces-read
2019-10-29 10:33:31 +00:00
Joe Thornber
2938b4dcca [bcache] add bcache_abort()
This gives us a way to cope with write failures.
2019-10-28 15:00:53 +00:00
Zdenek Kabelac
ee9d623d38 tests: indent 2018-12-23 01:07:27 +01:00
Zdenek Kabelac
6d8356d208 tests: fix unit test
Use more universal  /usr/bin/env bash
(as older systems do only have /bin/sh)
Uncommment disabled event_activation testing.
2018-12-23 01:07:27 +01:00
Zdenek Kabelac
0161ebe484 scripts: simplify including for generator
Uses included .c file as primary header includer.
2018-12-21 21:42:30 +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
David Teigland
1f1d36f6a2 unit test: use_lvmetad replaced by event_activation 2018-12-17 10:04:44 -06:00
Zdenek Kabelac
2076dda0b8 makefiles: also fix build of unit test 2018-12-17 11:51:38 +01:00
Zdenek Kabelac
94237354dd makefiles: correcting login of makefile
Fixing some ordering issue with inclusion of common make.tmpl.
Correcting dependency calculation
Simplifying inclusive makefile
2018-12-17 10:55:20 +01:00
Zdenek Kabelac
d76b4afb8e makefiles: sort 2018-12-17 10:36:52 +01:00
Zdenek Kabelac
701ecff0ff lvm: drop usage of dl library
Since lvm no longer supports any dlopen-able plugins
(which in practice was never really usable) drop linking
with -ldl.
2018-12-17 10:36:52 +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
250e05a965 makefiles: ensure test dir can run unit-test 2018-12-01 01:05:53 +01:00
Zdenek Kabelac
8b87ffaa8a makefiles: clean unit-test 2018-11-30 13:03:09 +01:00
Zdenek Kabelac
41afe8c5cc tests: drop use_lvmetad from unit test 2018-11-29 23:10:09 +01:00
Zdenek Kabelac
98c21e98b2 makefiles: improving cleaning rules 2018-11-29 23:05:43 +01:00
Zdenek Kabelac
f54ead831f makefiles: avoid dependency calcs for base dir
For some targets we do not want to generate dependencies.
Also add note about usage of such Makefile - it might be
possibly better to rename it to different filename to avoid
any confusion.
2018-11-29 23:05:43 +01:00
Joe Thornber
ba6d8a3195 [unit-test/radix-tree] Add a huge test case
Derived from the logs that dct gave me.
2018-09-20 14:38:34 +01:00
David Teigland
3bcc6c7e60 tests: drop lvmetad bits 2018-09-10 11:49:11 -05:00
Joe Thornber
8b05f1f230 radix-tree: Fix bug in remove_prefix()
Accidental decrement of the nr entries when a n256 didn't have the
entry in the first place.
2018-08-20 15:23:40 +01:00
Zdenek Kabelac
b98846998b build: not yet merged
status.c will get linked with VDO support.
2018-07-09 10:37:39 +02:00
Zdenek Kabelac
5f3eff8eae tests: update vdo unit test to dm prefix
Update prefix and reindent.
2018-07-09 10:30:34 +02:00
Zdenek Kabelac
4a64bb9573 build: unit test Makefile update
Update makefile to link with more libs since now whole liblvm-internal.a
is linked-in and  this library has futher dependencies.

Avoid including deps for run-unit-test.

Drop linking separate status.c as it's already linked via internal libs.
2018-07-09 10:30:34 +02:00
Zdenek Kabelac
c96400b6c7 vdo: enhance status parser
Add support for using mempool for allocations inside status parser.
Convert some string pointers to arrays.
Reindent tabs.
2018-07-02 10:25:35 +02:00
Zdenek Kabelac
52b07672f8 build: avoid rebuild deps for top-level makefiles 2018-07-02 10:21:42 +02:00
Zdenek Kabelac
c728d88e11 build: include configure.h
It's important to consistenly include  configure.h as the 1st. header.
It containts #defines influencing behavior of other included header
files.
2018-06-22 23:11:44 +02:00
Joe Thornber
40c1f7889f radix-tree: More debugging of remove
There's now a pretty printer called radix_tree_dump()

n4, n16, and n48 weren't UNSETting the last entry after
sliding values down.
2018-06-21 09:49:43 +01:00