Patrick J Cherry
d0439dab88
Call the thread cleanup code when requesting status
...
This ensures the correct number of connected clients is returned when
the status command is issued.
Previously the thread pool would only be cleaned up on a new connection.
2018-02-16 12:58:03 +00:00
James F. Carter
9f56f38f42
Merge branch 'rationalise-ld-preload-tests' into develop
2018-02-14 16:48:57 +00:00
Patrick J Cherry
2e17e8955f
Added tests for NBD_MAX_SIZE
...
This constant is only used in the proxy, so the tests only cover proxy
mode.
2018-02-13 17:04:51 +00:00
Patrick J Cherry
9817fd7b0a
Final tidies, comments etc.
2018-02-09 11:42:25 +00:00
Patrick J Cherry
195de41d86
Remove extra line
2018-02-09 11:32:26 +00:00
Patrick J Cherry
b75a6529d0
Move LdPreload include to correct place
2018-02-09 10:41:24 +00:00
Patrick J Cherry
8e67180999
Check that TCP_NODELAY is set on upstream sockets on reconnection
...
Also rationalize the test to see if a function has been called. Still
not great, but getting there :)
2018-02-09 10:26:08 +00:00
Patrick J Cherry
c053a54faa
Added test to cover setsockopt for tcpkeepalive
2018-02-08 23:07:17 +00:00
Patrick J Cherry
ebacf738bc
Tidy up ld preload hacks
2018-02-08 22:28:34 +00:00
Patrick J Cherry
347b7978e4
Discs must be sized in multiples of 512 bytes or odd things happen
...
In #36 some of the odd errors were due to seeks beyond the end of the
disc. This was because the disc was "specially crafted" to be 25GB + 1
byte, which doesn't fit into the normal 512 byte sectors expected of a
disc. This lead to reads going beyond the end of the disc etc.
If a similarly evil disc is used with `losetup`, it just ignores the
last bytes of the disc that don't fit into 512 chunks. This is what
that patch does, logging an error at the same time.
2018-02-08 16:31:28 +00:00
Patrick J Cherry
8beb3f0af6
Allow proxy to pass NBD protocol errors downstream; server returns EINVAL/ENOSPC appropriately
...
Previously the proxy would just disconnect when it saw an NBD protocol
error, and retry the operation it was in the middle of.
Additionally, the server needs to return the correct error types when
this happens.
2018-02-08 13:19:51 +00:00
Patrick J Cherry
f71b872622
Only set up LD_PRELOAD for tests that actually need it.
2018-02-07 22:05:07 +00:00
Patrick J Cherry
79181b3153
Added LD_PRELOAD library to monitor msync calls in testing
2018-02-07 21:45:20 +00:00
Patrick J Cherry
55548cc969
Change ordering of @env configuration/start so we can alter the blocksize.
...
argh.
2018-02-06 10:24:54 +00:00
Patrick J Cherry
da35187af0
Allow blocksize to be changed in Environment
...
This number is peppered all over the test suite, so changing @blocksize
for everything is not a goer, when we really only need to change it for
one test.
2018-02-06 09:55:32 +00:00
Patrick J Cherry
7704f9e5c8
Fix tests to reflect new filesize.
2018-02-06 07:57:40 +00:00
Patrick J Cherry
3a86870c9f
Use sysconf to determine actual page size for msync
...
Also added comments in tests around testing for msync offsets/lengths.
2018-02-06 07:32:58 +00:00
Patrick J Cherry
2b58468800
Added test for FUA acceptance.
...
Although I think this might be a bit useless as servers normally just
ingore flags.
2018-02-03 20:29:15 +00:00
Patrick J Cherry
4d9db4d6e9
Added basic FLUSH test
2018-02-03 20:10:47 +00:00
Patrick J Cherry
d6057a4244
Use 'English' in ruby
2018-02-02 21:41:07 +00:00
Patrick J Cherry
1d98ba1d3e
Further rubocopping
2018-02-02 21:36:30 +00:00
Patrick J Cherry
9c48da82cc
Rubocop
2018-02-02 21:34:14 +00:00
Patrick J Cherry
1b7b688f7a
Tidied up nbd init test
2018-02-02 21:30:55 +00:00
Patrick J Cherry
051576df6d
Remove warnings about Object#timeout
2018-02-02 20:46:46 +00:00
Patrick J Cherry
72c8c6f757
Altered test to check for type as a 16-bit uint; added flags test
2018-02-02 20:30:39 +00:00
Chris Elsworth
42d206cfb7
Update test
2017-07-14 16:26:25 +01:00
James Carter
b4cb2d9240
Merge branch 'fix-wrong-handle-type' into 'master'
...
Fix up "wrong" handle type from char* to uint64_t
Following from the NBD handle comparison simplifications.
See merge request !25
2016-10-07 10:20:35 +01:00
James Carter
1efb7bada6
Merge branch 'fix-unsigned-longs-in-bitset-test' into 'master'
...
fix check_bitset test on 32-bit platforms
The use of `unsigned long` and `UL` suffices caused this test to fail
on 32 bit platforms, where these are just 4, not 8 bits long.
```
tests/unit/check_bitset.c:73:F:bit:test_bit_ranges:0: longs[32] = 0 SHOULD BE ffffffff
```
See merge request !24
2016-10-07 10:20:08 +01:00
Patrick J Cherry
209da655b3
Skip large file test on 32-bit platforms
...
This test cannot run on 32-bit machines as they cannot access files
large than 2G. Makes flexnbd on 32-bit a bit useless really..
2016-10-06 21:42:52 +01:00
Patrick J Cherry
52b45e6b40
fix check_bitset test on 32-bit platforms
...
The use of `unsigned long` and `UL` suffices caused this test to fail
on 32 bit platforms, where these are just 4, not 8 bits long.
```
tests/unit/check_bitset.c:73:F:bit:test_bit_ranges:0: longs[32] = 0 SHOULD BE ffffffff
```
2016-10-06 21:22:53 +01:00
Patrick J Cherry
d279eb7570
Fix up "wrong" handle type from char* to uint64_t
...
Following from the NBD handle comparison simplifications.
2016-10-06 21:19:15 +01:00
Patrick J Cherry
d1e6e835c4
OK removed the cast and fixed the function def in the test
...
This should definitely clear the warning.
2016-10-06 15:56:57 +01:00
Patrick J Cherry
898f3f6c7e
Reinstated char * cast to remove compiler warning
2016-10-06 15:43:20 +01:00
Patrick J Cherry
1338d9e910
Fix up nbdtypes test to correctly use htobe64
...
Previous change hadn't taken this into account, and hopefully this makes
our test a little clearer.
2016-10-06 14:46:29 +01:00
Patrick J Cherry
191b3bc72c
Merge branch 'master' of gitlab.bytemark.co.uk:open-source/flexnbd-c into fix-check-readwrite
2016-10-06 14:06:21 +01:00
Patrick J Cherry
6505588f25
Fixed check_readwrite test to pass correct handle to fd_write_reply
...
The (char*) cast to resp->received.handle.b was causing a segfault
2016-10-06 14:01:47 +01:00
Patrick J Cherry
957707bcfc
Fixed up internal test names (copy/pasta?)
...
The test names output by `make check` now reflect reality.
2016-10-06 13:44:20 +01:00
James F. Carter
679fa6dbf8
force binary encoding in a ruby2.1-compatible way
2016-10-05 11:54:09 +01:00
James F. Carter
a09e14b2d4
whitespace fix
2016-10-05 11:06:39 +01:00
James F. Carter
a6710b6c32
update tests to reflect changes in handle storage
2016-10-05 10:57:52 +01:00
James Carter
f5de8fb12b
Merge branch '20-fix-encoding-failures' into 'master'
...
Use a BINARY encoded string when doing read/write comparisons.
This is a bit of a cheat really, but `#read` returns an ASCII encoded
string, where as our ruby generates UTF-8 encoded strings, causing
assertion failures.
Closes #20
See merge request !8
2016-10-05 10:32:05 +01:00
James F. Carter
99a5f79a52
fixed typo
2016-10-05 10:30:44 +01:00
Patrick J Cherry
356e1fd6a1
Use a BINARY encoded string when doing read/write comparisons.
...
This is a bit of a cheat really, but `#read` returns an ASCII encoded
string, where as our ruby generates UTF-8 encoded strings, causing
assertion failures.
Fixes #20
2016-10-05 10:01:15 +01:00
Patrick J Cherry
d3762162db
Fixes "double-definition of constants" warning
...
Looks like `#constants.include?` doesn't work as well as
`#const_defined?`.
2016-10-05 09:29:07 +01:00
Michel Pollet
956a602475
Simplified NBD handle comparisons
...
8 bytes, therefore a uing64_t to compare to, no need for memcmp()
Signed-off-by: Michel Pollet <buserror@gmail.com >
2016-10-04 15:41:48 +01:00
nick
f48bf2b296
Automated merge with ssh://dev/flexnbd-c
2014-02-27 14:33:01 +00:00
nick
dbe7053bf3
Avoid some false positives
2014-02-27 14:32:26 +00:00
Alex Young
fa8023cf69
Proxy prefetch cache becomes a command-line argument.
2014-02-27 14:21:36 +00:00
Alex Young
5551373073
Merge
2014-02-26 15:37:44 +00:00
Alex Young
77f333423b
Apply Michel's tidy-ups
2014-02-26 15:19:03 +00:00