Commit Graph

118 Commits

Author SHA1 Message Date
Pieter Noordhuis
2da784ce8f Abort on invalid format
There is no way we can guess the width of the argument when we cannot
infer its type from the format specifier.
2011-07-09 15:08:45 +02:00
Pieter Noordhuis
4ac55be9b5 Update printf-formatting tests to fail 2011-07-09 15:08:45 +02:00
Pieter Noordhuis
375ba48eea Revert "Add function to retrieve formatted reply"
This reverts commit 77540aa316. The change
in buffer strategy is too large to put in a minor release. It is put in
a separate branch in the meantime, so it can be refined and released
together with a minor version bump.
2011-06-19 13:41:25 +02:00
Pieter Noordhuis
367ac44ac1 Remove private feature macros for Solaris from compiler flags 2011-06-18 16:28:57 +02:00
Pieter Noordhuis
e0d5c71277 Fix compiler warnings 2011-06-18 12:29:49 +02:00
Pieter Noordhuis
5f5b3d9787 Fix for issue #45 2011-06-09 09:25:09 +02:00
Pieter Noordhuis
159a83ab8a Flag to disable throughput tests 2011-06-09 09:16:31 +02:00
Pieter Noordhuis
7a8de1fe25 Exit with a non-zero status when tests failed 2011-05-29 10:03:39 -07:00
Pieter Noordhuis
9723a4fc46 More control over host/port and unix path in test.c 2011-05-22 16:26:04 +02:00
Piotr Sikora
5793b999a9 Add "make check" target (useful for automated tests).
While there, add "-p" option to "hiredis-test", so that we could run
tests without interrupting Redis instance running on the default port.
2011-05-22 15:24:11 +02:00
Pieter Noordhuis
77540aa316 Add function to retrieve formatted reply
This is done by only truncating the read buffer once a full reply has
been read. The buffer is no longer truncated halfway through reading a
reply. In addition: pass offset/length of protocol and content via the
read tasks.
2011-05-05 17:01:34 +02:00
Pieter Noordhuis
19709152f2 Reflect rename in tests 2011-04-21 16:03:54 +02:00
Pieter Noordhuis
6d207ea98e Create protocol reader when creating context 2011-04-21 15:04:42 +02:00
Pieter Noordhuis
fc790ebea6 State should not be reset after protocol error 2011-04-21 10:54:54 +02:00
Pieter Noordhuis
178024244d Use variable for throughput test iteration count 2011-04-19 23:03:29 +02:00
Pieter Noordhuis
b4f85484ea Add pipelined throughput tests 2011-03-31 12:41:46 +02:00
Pieter Noordhuis
8e2c39200d Fix formatCommand to work with all empty interpolations 2011-03-06 11:38:07 +01:00
Pieter Noordhuis
663d6d1258 Properly reset state after protocol error in reply reader 2011-01-27 14:39:34 +01:00
Pieter Noordhuis
fbe756d838 Avoid warnings with -Wstrict-prototypes 2011-01-27 12:50:55 +01:00
Pieter Noordhuis
43ab0f8018 Return error on socket timeout for a blocking context 2011-01-07 13:04:42 +01:00
Pieter Noordhuis
7684d556bd Add (nearly) full printf support by delegating to vsprintf 2010-12-02 16:20:55 +01:00
Pieter Noordhuis
257a9d40a9 Set error on unexpected nesting of multi bulks 2010-11-24 15:46:05 +01:00
Pieter Noordhuis
b6b96f776e Make error messages consistent in casing 2010-11-22 10:37:14 +01:00
Pieter Noordhuis
537e64e946 Tests for behavior when connecting fails 2010-11-22 10:32:37 +01:00
Pieter Noordhuis
7c33f2666b Make test for formatting commands using a vector more robust 2010-11-22 10:06:43 +01:00
Pieter Noordhuis
cb89a472b6 Fix formatting literal percent characters 2010-11-22 10:00:45 +01:00
Pieter Noordhuis
9d9b8e1c79 Correctly format commands with empty interpolated values 2010-11-22 09:55:54 +01:00
Pieter Noordhuis
650df0f982 Don't do a write(2) after QUIT
This causes non-deterministic error messages because sometimes the
socket will already be closed and sometimes it is yet to be closed.
2010-11-19 12:37:06 +01:00
Pieter Noordhuis
0b27639e09 Don't print when testing can continue 2010-11-15 20:17:31 +01:00
Pieter Noordhuis
a5acb58948 Redis >=2.1 replies with OK on QUIT, so make the test conditional 2010-11-15 20:16:01 +01:00
Pieter Noordhuis
1c39483434 Include signal.h 2010-11-05 17:24:11 +01:00
Pieter Noordhuis
8ce0b3228d Finding \r\n without strstr is a little harder 2010-11-04 23:52:47 +01:00
Pieter Noordhuis
2e5e9a49fd Return the reply type when the reply object function set is NULL 2010-11-04 13:15:44 +01:00
Pieter Noordhuis
bea6c4bde2 Check replies in throughput test 2010-11-03 11:43:01 +01:00
Pieter Noordhuis
f25a5267cc Allow to connect using a unix socket from hiredis 2010-11-03 11:38:26 +01:00
Pieter Noordhuis
ffa8666a64 Change error reporting to have an explicit type
When there is an I/O error, errno should be used to find out what is
wrong. In other cases, errno cannot be used. So, use an explicit type in
Hiredis to define the different error scenarios that can occur.
2010-11-02 16:36:38 +01:00
Pieter Noordhuis
f463734e91 Remove reply object functions from connect functions 2010-10-31 12:53:57 +01:00
Pieter Noordhuis
298e9325d7 First step in decoupling reply callbacks from internals 2010-10-31 10:56:24 +01:00
Pieter Noordhuis
a3a405bcba Format a command using an argument vector 2010-10-31 10:34:29 +01:00
Pieter Noordhuis
bc5dcdbc85 Status replies should have type REDIS_REPLY_STATUS 2010-10-30 17:49:39 +02:00
Pieter Noordhuis
171b5a24d4 Drop dependency on sds.h for exposed API 2010-10-30 17:47:19 +02:00
Pieter Noordhuis
0f745d1ac0 Run pending callbacks with NULL reply on redisDisconnect() 2010-10-19 21:26:06 +02:00
Pieter Noordhuis
bbe007a75a Test helper for creating a non-blocking connection 2010-10-19 21:24:30 +02:00
Pieter Noordhuis
d4b4a9128e Revert e5dd32d8 that added the const qualifier for command callbacks 2010-10-19 21:24:30 +02:00
Pieter Noordhuis
ba42ab2ef8 Revert privdata in context callbacks to being non-const 2010-10-19 14:19:51 +02:00
Pieter Noordhuis
f9596db90b Test callback sequence in non-blocking context 2010-10-18 16:27:52 +02:00
Pieter Noordhuis
e332a32b35 Change redisWriteBuffer to return OK on an empty buffer 2010-10-18 15:49:52 +02:00
Pieter Noordhuis
a68cb9686e Tests for context callbacks in non-blocking mode 2010-10-18 15:39:56 +02:00
Pieter Noordhuis
634314f386 Rearrange tests to isolated functions 2010-10-18 14:51:03 +02:00
Pieter Noordhuis
7496458c68 The QUIT commands returns OK on master 2010-10-18 12:01:17 +02:00
Pieter Noordhuis
5c7b5fca4d Make error messages more consistent (e.g. no newline) 2010-10-06 21:23:03 +02:00
Pieter Noordhuis
1a5f111d52 c->error is no longer a redisReply object, but rather a plain C-string 2010-10-06 21:10:09 +02:00
Pieter Noordhuis
8345467b2e Free the replies after the tests are done 2010-09-25 15:33:46 +02:00
Pieter Noordhuis
9e417047ed Add function to free an allocated context 2010-09-25 15:33:27 +02:00
Pieter Noordhuis
a7d7618141 Deprecate the error object for I/O and protocol errors
Rather, use the return value REDIS_OK and REDIS_ERR to designate if
calling a function has a successful outcome. When there was an error in
performing the call the error field will be set inside the reader or the
context.
2010-09-25 15:09:13 +02:00
Pieter Noordhuis
d156550886 Rename fd to the more appropriate c 2010-09-24 18:48:07 +02:00
Pieter Noordhuis
817d26b81d Use context variable to keep state for a connection
The context supports both blocking and non-blocking connections. All
read and write events are not handled by hiredis, but hiredis exposes an
API for buffered reading/writing to Redis.
2010-09-24 18:42:22 +02:00
Pieter Noordhuis
af8ba74cbf Rename functions to be more consistent, split feed from get reply 2010-09-21 11:39:18 +02:00
Pieter Noordhuis
b1bedf5c6d Use a set of function pointers for building the reply
Allows libraries to wrap the reply parsing code and build the reply in a
streaming fashion. Reply objects can immediately be initialized to the
required type without having to convert an intermediary format.
2010-09-20 22:04:35 +02:00
Pieter Noordhuis
e944ea3662 Add reply type for protocol errors, in order to never exit() 2010-09-20 14:05:23 +02:00
Pieter Noordhuis
aec1fbd2ad Use automatic numbering in tests 2010-09-20 13:44:24 +02:00
Pieter Noordhuis
4ec97f5907 Free reply in test.c to make hiredis-test run cleanly on Valgrind 2010-09-19 20:43:57 +02:00
Pieter Noordhuis
f87625777d Change function prototype 2010-09-19 20:43:43 +02:00
Pieter Noordhuis
62c8054dbe Clean up when there is an I/O error 2010-09-19 19:01:31 +02:00
Pieter Noordhuis
457cdbf7c5 Rewrite reply parsing to use a read buffer 2010-09-19 18:47:05 +02:00
Pieter Noordhuis
66036d113e Add speed tests 2010-09-19 15:18:51 +02:00
Pierre Riteau
7302a5ec69 strcasecmp requires strings.h 2010-05-25 14:02:44 +02:00
antirez
bd4ec57059 minimalistic test suite... 2010-05-18 20:12:03 +02:00