Commit Graph

197 Commits

Author SHA1 Message Date
Ming-Hung Tsai
955e11bc28 [block-cache] fix potential file descriptor leak
Encapsulate file descriptor into an object, to ensure that an fd will be
closed properly while exception raised, e.g., the block_cache throws
exception during the block_manager's construction.
2020-02-23 15:41:16 +08:00
Joe Thornber
acf2e6e625 [unit-tests] squash some warnings
ASSERT_THAT(), defined in google-test needs to be wrapped in braces if
it's the only statement in an if block (dangling else).
2019-05-27 09:19:14 +01:00
Joe Thornber
80e046a7df [build] support separate build directories 2018-06-13 09:34:14 +01:00
Jörg Thalheim
6a7351da0d Fix musl build (#96)
a) Fix build if limits.h provides definition for PAGE_SIZE, as musl does w/musl per XSI[1] although it's apparently optional [2].
   This value is only provided when it's known to be a constant, to avoid the need to discover the value dynamically.
b) If not using system-provided (kernel headers, or libc headers, or something) use the POSIX approach of querying the value
   dynamically using sysconf(_SC_PAGE_SIZE) instead of hardcoded value that hopefully is correct.
[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
[2] http://www.openwall.com/lists/musl/2015/09/11/8

This patch originate from:

  https://raw.githubusercontent.com/voidlinux/void-packages/a0ece13ad7ab2aae760e09e41e0459bd999a3695/srcpkgs/thin-provisioning-tools/patches/musl.patch

and was also applied in NixOS:

  https://github.com/NixOS/nixpkgs/pull/40559/

cc @dtzWill
2018-05-22 14:02:49 +01:00
Joe Thornber
6b36f68ef5 [unit-tests/block_t] Comment out failing test
WONTFIX
2017-09-14 14:39:42 +01:00
Joe Thornber
977bbf05e5 [unit-tests/btree_counter_t] Add a couple of flushes().
This fixes the two failing btree_counter tests.  The blocknr in each
node is filled in when written out.  These days (thanks to Ming) the
counter also checks the btree, *but* if there are any problems
encoutered it just skips counting that node.
2017-09-14 14:00:21 +01:00
Joe Thornber
36169d399c [unit-tests] add failing test.
You currently can get a read lock when a write lock is already held.
2017-08-14 14:20:59 +01:00
Joe Thornber
467be1a69e Add some std namespaces to get tests building.
I guess a rogue header had previously been using the std namespace.
2017-07-24 15:40:17 +01:00
Joe Thornber
b9009b53b6 [bcache_t] Add block cache test case for issue 80 2017-07-24 15:32:26 +01:00
Joe Thornber
1a6b8bda3f [unit-test] update a cache metadtaa version test 2017-03-27 09:14:30 -04:00
Joe Thornber
4ed5ec5e10 [unit-test] Knock out some dead code 2017-03-13 14:17:32 +00:00
Joe Thornber
7df5b26f39 [unit-test] knock out the bloom filter tests.
We don't use bloom filters, and they take ages to run.
2017-03-13 14:16:47 +00:00
Joe Thornber
0a8d7fdb89 [build] tweak includes for test targets 2017-03-13 14:02:11 +00:00
Joe Thornber
c2fdbad322 Merge branch '2016-07-07-improve-thin-repair-error-message' into v0.7-devel
Conflicts:
	Makefile.in
	VERSION
	configure.ac
	persistent-data/file_utils.cc
2016-07-11 15:51:30 +01:00
Joe Thornber
a124b7ce26 [block-cache] Fix some bugs in the copier 2016-06-14 16:27:17 +01:00
Joe Thornber
07f44e9c77 [io_engine] Add exclusive flag to io_engine 2016-06-07 13:45:27 +01:00
Joe Thornber
a94bfea798 [block-cache] unit tests + debug io_engine and copier 2016-06-07 11:12:27 +01:00
Joe Thornber
34c039d7dc [mempool] more tests 2016-06-01 14:46:27 +01:00
Mike Frysinger
3e24cff8a1 respect & use CPPFLAGS properly
The common preprocessor variable is named CPPFLAGS.  configure sets this
up for us, including sourcing values from the user.  Rename INCLUDES to
match, and pull the default from configure.
2016-05-09 02:41:54 -04:00
Mike Frysinger
b46676575c fix up test targets
- PHONY is misspelled
- fix the pdata_tools target dep
- add a "check" alias to match standard automake behavior
- mark test & check targets as phony
2016-05-08 23:35:19 -04:00
Joe Thornber
73a69abfd2 [unit-tests] copier and mem_pool tests.
More to come
2016-05-07 11:47:40 +01:00
Joe Thornber
4f54245600 [block_t] add check_raw to mock 2016-04-21 14:31:52 +01:00
Joe Thornber
286f70ceac Merge remote-tracking branch 'remotes/github-m-h-tsai/v0.6.2-repairtool' into 2016-02-29-mingus-merge
Conflicts:
	Makefile.in
	VERSION
	thin-provisioning/commands.cc
	thin-provisioning/commands.h
	thin-provisioning/thin_delta.cc
2016-02-29 10:29:28 +00:00
Ming-Hung Tsai
778c153c1e [block-cache] Add check_raw() to bcache::validator 2016-02-27 15:21:13 +08:00
Joe Thornber
a5a53648c9 Merge branch '2015-08-19-thin-show-duplicates' into merge-thin-ls
Conflicts:
	Makefile.in
	block-cache/block_cache.h
	main.cc
	thin-provisioning/commands.h
2016-02-24 14:31:51 +00:00
Joe Thornber
767c39cf71 [build] switch to c++11
Conflicts:
	Makefile.in
	chunker/cache_stream.cc
	chunker/cache_stream.h
	thin-provisioning/thin_archive.cc
	thin-provisioning/thin_show_duplicates.cc
	unit-tests/Makefile.in
2016-02-16 16:45:44 +00:00
Joe Thornber
750ce0f47b [thin_show_dups] variable_chunk_stream 2015-09-03 13:02:29 +01:00
Joe Thornber
880785a9bf [damage_tracker] Reset the tracker in the end() method so we can reuse it.
The *_check tools already reuse trackers.

Patch from Ming-Hung Tsai.
2015-05-26 12:49:27 +01:00
Joe Thornber
a934ee69c4 [error_state] add a sneaky little stream operator to simplify combining error_states 2015-04-08 13:58:41 +01:00
Joe Thornber
ef517035f1 The file boost/random/uniform_int_distribution.hpp was introduced in boost
version 1.47. If we have older Boost, use random numbers from libc.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2015-01-16 10:19:25 +00:00
Joe Thornber
50341faa64 Fix these errors:
unit-tests/array_block_t.cc:38: error: using 'typename' outside of template
unit-tests/array_block_t.cc:39: error: using 'typename' outside of template
unit-tests/array_block_t.cc:40: error: using 'typename' outside of template

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
2015-01-16 10:18:21 +00:00
Alexander Holler
b56aec4d96 [unit-tests/bloom_filter_t.cc] Fix ambigious uniform_int_distribution (C++11)
uniform_int_distribution exist in the namespace boost as well as in std
of C++11. Use the one provided by boost.

This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with
gcc 4.8.3 and boost 1.55.
2014-11-15 16:49:08 +01:00
Joe Thornber
67865e0732 [bitset_t] Add test for walk_bitset 2014-09-01 14:15:32 +01:00
Joe Thornber
a7c96c0e1e [everything] Fix circular shared pointer references.
We had a cycle from transaction_manager <-> space_map, and also from
the ref_counters back up to the tm.

This prevented objects being destroyed when various programs exited.

From now on we'll try and only use a shared ptr if ownership is
implied.  Otherwise a reference will be used (eg, for up pointers).
2014-08-26 11:14:49 +01:00
Joe Thornber
3724f78a13 [block_t] Fix a validator test 2014-08-21 11:51:04 +01:00
Joe Thornber
f06a2673c5 wip 2014-07-29 11:34:26 +01:00
Joe Thornber
d517684c95 Initial code drop for merging block_cache 2014-07-22 16:41:39 +01:00
Joe Thornber
8c24419238 Knock out the era_superblock_t for now.
It's still got some bloom stuff in it.  Will tidy up after release.
2014-03-27 12:23:00 +00:00
Joe Thornber
8531a2befa [era] switch from bloom filters to writesets 2014-01-29 21:37:25 +00:00
Joe Thornber
bfb540cc5b [era] era_superblock_t and era_check 2014-01-09 22:40:34 +00:00
Joe Thornber
4df679174c correct a couple of #includes that were pointing to the old location of endian_utils.h 2014-01-08 11:04:56 +00:00
Joe Thornber
be5fa59f90 Merge branch 'era' of github.com:jthornber/thin-provisioning-tools into era 2014-01-08 10:50:26 +00:00
Joe Thornber
8049d369a9 stuff 2013-12-11 17:28:14 +00:00
Joe Thornber
927f611aad remove btree_checker, and add btree_counter 2013-12-11 17:00:57 +00:00
Joe Thornber
7a2d43268d [array] damage reported if the array is smaller than claimed in the ctr 2013-12-03 15:04:16 +00:00
Joe Thornber
180f7e6187 persistent-data/data-structures/bloom_filter 2013-11-18 13:08:07 +00:00
Joe Thornber
12a50cb568 Some experiments with bloom filters for dm-era 2013-11-15 13:59:12 +00:00
Joe Thornber
664aacd435 Merge branch 'master' of github.com:jthornber/thin-provisioning-tools 2013-10-30 12:45:23 +00:00
Joe Thornber
dd65089b68 sort out some #includes 2013-10-23 11:39:31 +01:00
Joe Thornber
20bf22e662 [caching] handle VARIABLE_HINT_SIZE incompat flag 2013-10-17 11:45:20 +01:00