redis-server 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. data/LICENSE +38 -0
  2. data/README.md +33 -0
  3. data/bin/redis +114 -0
  4. data/redis/Makefile +5 -0
  5. data/redis/extconf.rb +3 -0
  6. data/redis/redis-2.2.11/00-RELEASENOTES +199 -0
  7. data/redis/redis-2.2.11/BUGS +1 -0
  8. data/redis/redis-2.2.11/CONTRIBUTING +13 -0
  9. data/redis/redis-2.2.11/COPYING +10 -0
  10. data/redis/redis-2.2.11/Changelog +1032 -0
  11. data/redis/redis-2.2.11/INSTALL +30 -0
  12. data/redis/redis-2.2.11/Makefile +22 -0
  13. data/redis/redis-2.2.11/README +83 -0
  14. data/redis/redis-2.2.11/TODO +4 -0
  15. data/redis/redis-2.2.11/client-libraries/README +11 -0
  16. data/redis/redis-2.2.11/deps/hiredis/COPYING +10 -0
  17. data/redis/redis-2.2.11/deps/hiredis/Makefile +115 -0
  18. data/redis/redis-2.2.11/deps/hiredis/README.md +311 -0
  19. data/redis/redis-2.2.11/deps/hiredis/TODO +2 -0
  20. data/redis/redis-2.2.11/deps/hiredis/adapters/ae.h +95 -0
  21. data/redis/redis-2.2.11/deps/hiredis/adapters/libev.h +113 -0
  22. data/redis/redis-2.2.11/deps/hiredis/adapters/libevent.h +76 -0
  23. data/redis/redis-2.2.11/deps/hiredis/async.c +321 -0
  24. data/redis/redis-2.2.11/deps/hiredis/async.h +112 -0
  25. data/redis/redis-2.2.11/deps/hiredis/example-ae.c +53 -0
  26. data/redis/redis-2.2.11/deps/hiredis/example-libev.c +47 -0
  27. data/redis/redis-2.2.11/deps/hiredis/example-libevent.c +48 -0
  28. data/redis/redis-2.2.11/deps/hiredis/example.c +67 -0
  29. data/redis/redis-2.2.11/deps/hiredis/fmacros.h +15 -0
  30. data/redis/redis-2.2.11/deps/hiredis/hiredis.c +1058 -0
  31. data/redis/redis-2.2.11/deps/hiredis/hiredis.h +170 -0
  32. data/redis/redis-2.2.11/deps/hiredis/net.c +170 -0
  33. data/redis/redis-2.2.11/deps/hiredis/net.h +43 -0
  34. data/redis/redis-2.2.11/deps/hiredis/sds.c +479 -0
  35. data/redis/redis-2.2.11/deps/hiredis/sds.h +77 -0
  36. data/redis/redis-2.2.11/deps/hiredis/test.c +479 -0
  37. data/redis/redis-2.2.11/deps/hiredis/util.h +40 -0
  38. data/redis/redis-2.2.11/deps/linenoise/Makefile +10 -0
  39. data/redis/redis-2.2.11/deps/linenoise/README.markdown +45 -0
  40. data/redis/redis-2.2.11/deps/linenoise/example.c +27 -0
  41. data/redis/redis-2.2.11/deps/linenoise/linenoise.c +609 -0
  42. data/redis/redis-2.2.11/deps/linenoise/linenoise.h +55 -0
  43. data/redis/redis-2.2.11/design-documents/REDIS-CLUSTER +214 -0
  44. data/redis/redis-2.2.11/design-documents/REDIS-CLUSTER-2 +343 -0
  45. data/redis/redis-2.2.11/doc/AppendCommand.html +48 -0
  46. data/redis/redis-2.2.11/doc/AppendOnlyFileHowto.html +41 -0
  47. data/redis/redis-2.2.11/doc/AuthCommand.html +39 -0
  48. data/redis/redis-2.2.11/doc/Benchmarks.html +129 -0
  49. data/redis/redis-2.2.11/doc/BgrewriteaofCommand.html +41 -0
  50. data/redis/redis-2.2.11/doc/BgsaveCommand.html +39 -0
  51. data/redis/redis-2.2.11/doc/BlpopCommand.html +51 -0
  52. data/redis/redis-2.2.11/doc/BrpoplpushCommand.html +39 -0
  53. data/redis/redis-2.2.11/doc/CommandReference.html +47 -0
  54. data/redis/redis-2.2.11/doc/Comparisons.html +42 -0
  55. data/redis/redis-2.2.11/doc/ConfigCommand.html +76 -0
  56. data/redis/redis-2.2.11/doc/Configuration.html +38 -0
  57. data/redis/redis-2.2.11/doc/ConnectionHandlingSidebar.html +36 -0
  58. data/redis/redis-2.2.11/doc/ControlCommandsSidebar.html +36 -0
  59. data/redis/redis-2.2.11/doc/Credits.html +38 -0
  60. data/redis/redis-2.2.11/doc/DbsizeCommand.html +38 -0
  61. data/redis/redis-2.2.11/doc/DelCommand.html +41 -0
  62. data/redis/redis-2.2.11/doc/DesignPatterns.html +37 -0
  63. data/redis/redis-2.2.11/doc/EventLibray.html +44 -0
  64. data/redis/redis-2.2.11/doc/ExistsCommand.html +42 -0
  65. data/redis/redis-2.2.11/doc/ExpireCommand.html +96 -0
  66. data/redis/redis-2.2.11/doc/FAQ.html +70 -0
  67. data/redis/redis-2.2.11/doc/Features.html +38 -0
  68. data/redis/redis-2.2.11/doc/FlushallCommand.html +39 -0
  69. data/redis/redis-2.2.11/doc/FlushdbCommand.html +39 -0
  70. data/redis/redis-2.2.11/doc/FromSqlToDataStructures.html +37 -0
  71. data/redis/redis-2.2.11/doc/GenericCommandsSidebar.html +36 -0
  72. data/redis/redis-2.2.11/doc/GetCommand.html +39 -0
  73. data/redis/redis-2.2.11/doc/GetbitCommand.html +39 -0
  74. data/redis/redis-2.2.11/doc/GetsetCommand.html +38 -0
  75. data/redis/redis-2.2.11/doc/HackingStrings.html +83 -0
  76. data/redis/redis-2.2.11/doc/HashCommandsSidebar.html +36 -0
  77. data/redis/redis-2.2.11/doc/Hashes.html +37 -0
  78. data/redis/redis-2.2.11/doc/HdelCommand.html +39 -0
  79. data/redis/redis-2.2.11/doc/HexistsCommand.html +39 -0
  80. data/redis/redis-2.2.11/doc/HgetCommand.html +39 -0
  81. data/redis/redis-2.2.11/doc/HgetallCommand.html +40 -0
  82. data/redis/redis-2.2.11/doc/HincrbyCommand.html +45 -0
  83. data/redis/redis-2.2.11/doc/HlenCommand.html +38 -0
  84. data/redis/redis-2.2.11/doc/HmgetCommand.html +40 -0
  85. data/redis/redis-2.2.11/doc/HmsetCommand.html +40 -0
  86. data/redis/redis-2.2.11/doc/HsetCommand.html +40 -0
  87. data/redis/redis-2.2.11/doc/HsetnxCommand.html +41 -0
  88. data/redis/redis-2.2.11/doc/IncrCommand.html +43 -0
  89. data/redis/redis-2.2.11/doc/InfoCommand.html +48 -0
  90. data/redis/redis-2.2.11/doc/IntroductionToRedisDataTypes.html +152 -0
  91. data/redis/redis-2.2.11/doc/KeysCommand.html +43 -0
  92. data/redis/redis-2.2.11/doc/LastsaveCommand.html +39 -0
  93. data/redis/redis-2.2.11/doc/LindexCommand.html +40 -0
  94. data/redis/redis-2.2.11/doc/ListCommandsSidebar.html +36 -0
  95. data/redis/redis-2.2.11/doc/Lists.html +42 -0
  96. data/redis/redis-2.2.11/doc/LlenCommand.html +41 -0
  97. data/redis/redis-2.2.11/doc/LpopCommand.html +41 -0
  98. data/redis/redis-2.2.11/doc/LrangeCommand.html +47 -0
  99. data/redis/redis-2.2.11/doc/LremCommand.html +41 -0
  100. data/redis/redis-2.2.11/doc/LsetCommand.html +38 -0
  101. data/redis/redis-2.2.11/doc/LtrimCommand.html +47 -0
  102. data/redis/redis-2.2.11/doc/MgetCommand.html +52 -0
  103. data/redis/redis-2.2.11/doc/MonitorCommand.html +63 -0
  104. data/redis/redis-2.2.11/doc/MoveCommand.html +42 -0
  105. data/redis/redis-2.2.11/doc/MsetCommand.html +44 -0
  106. data/redis/redis-2.2.11/doc/MultiExecCommand.html +166 -0
  107. data/redis/redis-2.2.11/doc/NonexistentCommands.html +51 -0
  108. data/redis/redis-2.2.11/doc/ObjectHashMappers.html +39 -0
  109. data/redis/redis-2.2.11/doc/Pipelining.html +36 -0
  110. data/redis/redis-2.2.11/doc/ProgrammingExamples.html +38 -0
  111. data/redis/redis-2.2.11/doc/ProtocolSpecification.html +137 -0
  112. data/redis/redis-2.2.11/doc/PublishSubscribe.html +115 -0
  113. data/redis/redis-2.2.11/doc/QuickStart.html +68 -0
  114. data/redis/redis-2.2.11/doc/QuitCommand.html +38 -0
  115. data/redis/redis-2.2.11/doc/README.html +119 -0
  116. data/redis/redis-2.2.11/doc/RandomkeyCommand.html +39 -0
  117. data/redis/redis-2.2.11/doc/Redis0100ChangeLog.html +67 -0
  118. data/redis/redis-2.2.11/doc/Redis0900ChangeLog.html +56 -0
  119. data/redis/redis-2.2.11/doc/RedisBigData.html +61 -0
  120. data/redis/redis-2.2.11/doc/RedisCLI.html +37 -0
  121. data/redis/redis-2.2.11/doc/RedisEventLibrary.html +70 -0
  122. data/redis/redis-2.2.11/doc/RedisGuides.html +37 -0
  123. data/redis/redis-2.2.11/doc/RedisInternals.html +38 -0
  124. data/redis/redis-2.2.11/doc/RedisPipelining.html +93 -0
  125. data/redis/redis-2.2.11/doc/RedisStatus.html +56 -0
  126. data/redis/redis-2.2.11/doc/Redis_1_2_0_Changelog.html +40 -0
  127. data/redis/redis-2.2.11/doc/Redis_2_0_0_Changelog.html +62 -0
  128. data/redis/redis-2.2.11/doc/Redis_2_0_Whats_new.html +59 -0
  129. data/redis/redis-2.2.11/doc/RenameCommand.html +39 -0
  130. data/redis/redis-2.2.11/doc/RenamenxCommand.html +42 -0
  131. data/redis/redis-2.2.11/doc/ReplicationHowto.html +43 -0
  132. data/redis/redis-2.2.11/doc/ReplyTypes.html +42 -0
  133. data/redis/redis-2.2.11/doc/RoadMap.html +38 -0
  134. data/redis/redis-2.2.11/doc/RpoplpushCommand.html +44 -0
  135. data/redis/redis-2.2.11/doc/RpushCommand.html +40 -0
  136. data/redis/redis-2.2.11/doc/SaddCommand.html +41 -0
  137. data/redis/redis-2.2.11/doc/SaveCommand.html +39 -0
  138. data/redis/redis-2.2.11/doc/ScardCommand.html +41 -0
  139. data/redis/redis-2.2.11/doc/SdiffCommand.html +45 -0
  140. data/redis/redis-2.2.11/doc/SdiffstoreCommand.html +38 -0
  141. data/redis/redis-2.2.11/doc/SelectCommand.html +39 -0
  142. data/redis/redis-2.2.11/doc/SetCommand.html +39 -0
  143. data/redis/redis-2.2.11/doc/SetCommandsSidebar.html +36 -0
  144. data/redis/redis-2.2.11/doc/SetbitCommand.html +45 -0
  145. data/redis/redis-2.2.11/doc/SetexCommand.html +42 -0
  146. data/redis/redis-2.2.11/doc/SetnxCommand.html +51 -0
  147. data/redis/redis-2.2.11/doc/SetrangeCommand.html +58 -0
  148. data/redis/redis-2.2.11/doc/Sets.html +36 -0
  149. data/redis/redis-2.2.11/doc/ShutdownCommand.html +39 -0
  150. data/redis/redis-2.2.11/doc/SideBar.html +36 -0
  151. data/redis/redis-2.2.11/doc/SinterCommand.html +40 -0
  152. data/redis/redis-2.2.11/doc/SinterstoreCommand.html +39 -0
  153. data/redis/redis-2.2.11/doc/SismemberCommand.html +42 -0
  154. data/redis/redis-2.2.11/doc/SlaveofCommand.html +41 -0
  155. data/redis/redis-2.2.11/doc/SmembersCommand.html +38 -0
  156. data/redis/redis-2.2.11/doc/SmoveCommand.html +44 -0
  157. data/redis/redis-2.2.11/doc/SortCommand.html +75 -0
  158. data/redis/redis-2.2.11/doc/SortedSetCommandsSidebar.html +36 -0
  159. data/redis/redis-2.2.11/doc/SortedSets.html +36 -0
  160. data/redis/redis-2.2.11/doc/Speed.html +38 -0
  161. data/redis/redis-2.2.11/doc/SponsorshipHistory.html +38 -0
  162. data/redis/redis-2.2.11/doc/SpopCommand.html +40 -0
  163. data/redis/redis-2.2.11/doc/SrandmemberCommand.html +40 -0
  164. data/redis/redis-2.2.11/doc/SremCommand.html +42 -0
  165. data/redis/redis-2.2.11/doc/StringCommandsSidebar.html +36 -0
  166. data/redis/redis-2.2.11/doc/Strings.html +37 -0
  167. data/redis/redis-2.2.11/doc/StrlenCommand.html +39 -0
  168. data/redis/redis-2.2.11/doc/SubstrCommand.html +52 -0
  169. data/redis/redis-2.2.11/doc/SunionCommand.html +40 -0
  170. data/redis/redis-2.2.11/doc/SunionstoreCommand.html +38 -0
  171. data/redis/redis-2.2.11/doc/SupportedLanguages.html +60 -0
  172. data/redis/redis-2.2.11/doc/SupportedPlatforms.html +37 -0
  173. data/redis/redis-2.2.11/doc/TemplateCommand.html +38 -0
  174. data/redis/redis-2.2.11/doc/TtlCommand.html +38 -0
  175. data/redis/redis-2.2.11/doc/TwitterAlikeExample.html +250 -0
  176. data/redis/redis-2.2.11/doc/TypeCommand.html +46 -0
  177. data/redis/redis-2.2.11/doc/UnstableSource.html +39 -0
  178. data/redis/redis-2.2.11/doc/VirtualMemorySpecification.html +156 -0
  179. data/redis/redis-2.2.11/doc/VirtualMemoryUserGuide.html +66 -0
  180. data/redis/redis-2.2.11/doc/ZaddCommand.html +43 -0
  181. data/redis/redis-2.2.11/doc/ZcardCommand.html +41 -0
  182. data/redis/redis-2.2.11/doc/ZincrbyCommand.html +42 -0
  183. data/redis/redis-2.2.11/doc/ZrangeCommand.html +42 -0
  184. data/redis/redis-2.2.11/doc/ZrangebyscoreCommand.html +77 -0
  185. data/redis/redis-2.2.11/doc/ZrankCommand.html +43 -0
  186. data/redis/redis-2.2.11/doc/ZremCommand.html +42 -0
  187. data/redis/redis-2.2.11/doc/ZremrangebyrankCommand.html +39 -0
  188. data/redis/redis-2.2.11/doc/ZremrangebyscoreCommand.html +39 -0
  189. data/redis/redis-2.2.11/doc/ZscoreCommand.html +41 -0
  190. data/redis/redis-2.2.11/doc/ZunionCommand.html +42 -0
  191. data/redis/redis-2.2.11/doc/ZunionstoreCommand.html +43 -0
  192. data/redis/redis-2.2.11/doc/index.html +43 -0
  193. data/redis/redis-2.2.11/doc/redis.png +0 -0
  194. data/redis/redis-2.2.11/doc/style.css +25 -0
  195. data/redis/redis-2.2.11/redis.conf +417 -0
  196. data/redis/redis-2.2.11/src/Makefile +177 -0
  197. data/redis/redis-2.2.11/src/adlist.c +325 -0
  198. data/redis/redis-2.2.11/src/adlist.h +92 -0
  199. data/redis/redis-2.2.11/src/ae.c +390 -0
  200. data/redis/redis-2.2.11/src/ae.h +117 -0
  201. data/redis/redis-2.2.11/src/ae_epoll.c +91 -0
  202. data/redis/redis-2.2.11/src/ae_kqueue.c +93 -0
  203. data/redis/redis-2.2.11/src/ae_select.c +72 -0
  204. data/redis/redis-2.2.11/src/anet.c +347 -0
  205. data/redis/redis-2.2.11/src/anet.h +57 -0
  206. data/redis/redis-2.2.11/src/aof.c +675 -0
  207. data/redis/redis-2.2.11/src/config.c +627 -0
  208. data/redis/redis-2.2.11/src/config.h +64 -0
  209. data/redis/redis-2.2.11/src/db.c +543 -0
  210. data/redis/redis-2.2.11/src/debug.c +314 -0
  211. data/redis/redis-2.2.11/src/dict.c +721 -0
  212. data/redis/redis-2.2.11/src/dict.h +156 -0
  213. data/redis/redis-2.2.11/src/fmacros.h +15 -0
  214. data/redis/redis-2.2.11/src/help.h +638 -0
  215. data/redis/redis-2.2.11/src/intset.c +422 -0
  216. data/redis/redis-2.2.11/src/intset.h +19 -0
  217. data/redis/redis-2.2.11/src/lzf.h +100 -0
  218. data/redis/redis-2.2.11/src/lzfP.h +159 -0
  219. data/redis/redis-2.2.11/src/lzf_c.c +295 -0
  220. data/redis/redis-2.2.11/src/lzf_d.c +150 -0
  221. data/redis/redis-2.2.11/src/mkreleasehdr.sh +9 -0
  222. data/redis/redis-2.2.11/src/multi.c +268 -0
  223. data/redis/redis-2.2.11/src/networking.c +899 -0
  224. data/redis/redis-2.2.11/src/object.c +484 -0
  225. data/redis/redis-2.2.11/src/pqsort.c +197 -0
  226. data/redis/redis-2.2.11/src/pqsort.h +15 -0
  227. data/redis/redis-2.2.11/src/pubsub.c +267 -0
  228. data/redis/redis-2.2.11/src/rdb.c +1020 -0
  229. data/redis/redis-2.2.11/src/redis-benchmark.c +530 -0
  230. data/redis/redis-2.2.11/src/redis-check-aof.c +185 -0
  231. data/redis/redis-2.2.11/src/redis-check-dump.c +681 -0
  232. data/redis/redis-2.2.11/src/redis-cli.c +773 -0
  233. data/redis/redis-2.2.11/src/redis.c +1677 -0
  234. data/redis/redis-2.2.11/src/redis.h +1022 -0
  235. data/redis/redis-2.2.11/src/release.c +13 -0
  236. data/redis/redis-2.2.11/src/replication.c +557 -0
  237. data/redis/redis-2.2.11/src/sds.c +639 -0
  238. data/redis/redis-2.2.11/src/sds.h +78 -0
  239. data/redis/redis-2.2.11/src/sha1.c +276 -0
  240. data/redis/redis-2.2.11/src/sha1.h +17 -0
  241. data/redis/redis-2.2.11/src/solarisfixes.h +22 -0
  242. data/redis/redis-2.2.11/src/sort.c +389 -0
  243. data/redis/redis-2.2.11/src/syncio.c +154 -0
  244. data/redis/redis-2.2.11/src/t_hash.c +476 -0
  245. data/redis/redis-2.2.11/src/t_list.c +986 -0
  246. data/redis/redis-2.2.11/src/t_set.c +610 -0
  247. data/redis/redis-2.2.11/src/t_string.c +438 -0
  248. data/redis/redis-2.2.11/src/t_zset.c +1084 -0
  249. data/redis/redis-2.2.11/src/testhelp.h +54 -0
  250. data/redis/redis-2.2.11/src/util.c +243 -0
  251. data/redis/redis-2.2.11/src/valgrind.sup +5 -0
  252. data/redis/redis-2.2.11/src/version.h +1 -0
  253. data/redis/redis-2.2.11/src/vm.c +1149 -0
  254. data/redis/redis-2.2.11/src/ziplist.c +1323 -0
  255. data/redis/redis-2.2.11/src/ziplist.h +15 -0
  256. data/redis/redis-2.2.11/src/zipmap.c +455 -0
  257. data/redis/redis-2.2.11/src/zipmap.h +48 -0
  258. data/redis/redis-2.2.11/src/zmalloc.c +278 -0
  259. data/redis/redis-2.2.11/src/zmalloc.h +47 -0
  260. data/redis/redis-2.2.11/tests/assets/default.conf +308 -0
  261. data/redis/redis-2.2.11/tests/integration/aof.tcl +104 -0
  262. data/redis/redis-2.2.11/tests/integration/redis-cli.tcl +208 -0
  263. data/redis/redis-2.2.11/tests/integration/replication.tcl +98 -0
  264. data/redis/redis-2.2.11/tests/support/redis.tcl +241 -0
  265. data/redis/redis-2.2.11/tests/support/server.tcl +294 -0
  266. data/redis/redis-2.2.11/tests/support/test.tcl +190 -0
  267. data/redis/redis-2.2.11/tests/support/tmpfile.tcl +15 -0
  268. data/redis/redis-2.2.11/tests/support/util.tcl +296 -0
  269. data/redis/redis-2.2.11/tests/test_helper.tcl +221 -0
  270. data/redis/redis-2.2.11/tests/unit/auth.tcl +15 -0
  271. data/redis/redis-2.2.11/tests/unit/basic.tcl +616 -0
  272. data/redis/redis-2.2.11/tests/unit/cas.tcl +135 -0
  273. data/redis/redis-2.2.11/tests/unit/expire.tcl +74 -0
  274. data/redis/redis-2.2.11/tests/unit/other.tcl +240 -0
  275. data/redis/redis-2.2.11/tests/unit/printver.tcl +6 -0
  276. data/redis/redis-2.2.11/tests/unit/protocol.tcl +62 -0
  277. data/redis/redis-2.2.11/tests/unit/pubsub.tcl +195 -0
  278. data/redis/redis-2.2.11/tests/unit/quit.tcl +40 -0
  279. data/redis/redis-2.2.11/tests/unit/sort.tcl +189 -0
  280. data/redis/redis-2.2.11/tests/unit/type/hash.tcl +300 -0
  281. data/redis/redis-2.2.11/tests/unit/type/list.tcl +819 -0
  282. data/redis/redis-2.2.11/tests/unit/type/set.tcl +334 -0
  283. data/redis/redis-2.2.11/tests/unit/type/zset.tcl +587 -0
  284. data/redis/redis-2.2.11/utils/build-static-symbols.tcl +22 -0
  285. data/redis/redis-2.2.11/utils/generate-command-help.rb +112 -0
  286. data/redis/redis-2.2.11/utils/mktarball.sh +13 -0
  287. data/redis/redis-2.2.11/utils/redis-copy.rb +78 -0
  288. data/redis/redis-2.2.11/utils/redis-sha1.rb +52 -0
  289. data/redis/redis-2.2.11/utils/redis_init_script +42 -0
  290. metadata +362 -0
@@ -0,0 +1,6 @@
1
+ start_server {} {
2
+ set i [r info]
3
+ regexp {redis_version:(.*?)\r\n} $i - version
4
+ regexp {redis_git_sha1:(.*?)\r\n} $i - sha1
5
+ puts "Testing Redis version $version ($sha1)"
6
+ }
@@ -0,0 +1,62 @@
1
+ start_server {tags {"protocol"}} {
2
+ test "Handle an empty query" {
3
+ reconnect
4
+ r write "\r\n"
5
+ r flush
6
+ assert_equal "PONG" [r ping]
7
+ }
8
+
9
+ test "Negative multibulk length" {
10
+ reconnect
11
+ r write "*-10\r\n"
12
+ r flush
13
+ assert_equal PONG [r ping]
14
+ }
15
+
16
+ test "Out of range multibulk length" {
17
+ reconnect
18
+ r write "*20000000\r\n"
19
+ r flush
20
+ assert_error "*invalid multibulk length*" {r read}
21
+ }
22
+
23
+ test "Wrong multibulk payload header" {
24
+ reconnect
25
+ r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\nfooz\r\n"
26
+ r flush
27
+ assert_error "*expected '$', got 'f'*" {r read}
28
+ }
29
+
30
+ test "Negative multibulk payload length" {
31
+ reconnect
32
+ r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$-10\r\n"
33
+ r flush
34
+ assert_error "*invalid bulk length*" {r read}
35
+ }
36
+
37
+ test "Out of range multibulk payload length" {
38
+ reconnect
39
+ r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$2000000000\r\n"
40
+ r flush
41
+ assert_error "*invalid bulk length*" {r read}
42
+ }
43
+
44
+ test "Non-number multibulk payload length" {
45
+ reconnect
46
+ r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$blabla\r\n"
47
+ r flush
48
+ assert_error "*invalid bulk length*" {r read}
49
+ }
50
+
51
+ test "Multi bulk request not followed by bulk arguments" {
52
+ reconnect
53
+ r write "*1\r\nfoo\r\n"
54
+ r flush
55
+ assert_error "*expected '$', got 'f'*" {r read}
56
+ }
57
+
58
+ test "Generic wrong number of args" {
59
+ reconnect
60
+ assert_error "*wrong*arguments*ping*" {r ping x y z}
61
+ }
62
+ }
@@ -0,0 +1,195 @@
1
+ start_server {tags {"pubsub"}} {
2
+ proc __consume_subscribe_messages {client type channels} {
3
+ set numsub -1
4
+ set counts {}
5
+
6
+ for {set i [llength $channels]} {$i > 0} {incr i -1} {
7
+ set msg [$client read]
8
+ assert_equal $type [lindex $msg 0]
9
+
10
+ # when receiving subscribe messages the channels names
11
+ # are ordered. when receiving unsubscribe messages
12
+ # they are unordered
13
+ set idx [lsearch -exact $channels [lindex $msg 1]]
14
+ if {[string match "*unsubscribe" $type]} {
15
+ assert {$idx >= 0}
16
+ } else {
17
+ assert {$idx == 0}
18
+ }
19
+ set channels [lreplace $channels $idx $idx]
20
+
21
+ # aggregate the subscription count to return to the caller
22
+ lappend counts [lindex $msg 2]
23
+ }
24
+
25
+ # we should have received messages for channels
26
+ assert {[llength $channels] == 0}
27
+ return $counts
28
+ }
29
+
30
+ proc subscribe {client channels} {
31
+ $client subscribe {*}$channels
32
+ __consume_subscribe_messages $client subscribe $channels
33
+ }
34
+
35
+ proc unsubscribe {client {channels {}}} {
36
+ $client unsubscribe {*}$channels
37
+ __consume_subscribe_messages $client unsubscribe $channels
38
+ }
39
+
40
+ proc psubscribe {client channels} {
41
+ $client psubscribe {*}$channels
42
+ __consume_subscribe_messages $client psubscribe $channels
43
+ }
44
+
45
+ proc punsubscribe {client {channels {}}} {
46
+ $client punsubscribe {*}$channels
47
+ __consume_subscribe_messages $client punsubscribe $channels
48
+ }
49
+
50
+ test "PUBLISH/SUBSCRIBE basics" {
51
+ set rd1 [redis_deferring_client]
52
+
53
+ # subscribe to two channels
54
+ assert_equal {1 2} [subscribe $rd1 {chan1 chan2}]
55
+ assert_equal 1 [r publish chan1 hello]
56
+ assert_equal 1 [r publish chan2 world]
57
+ assert_equal {message chan1 hello} [$rd1 read]
58
+ assert_equal {message chan2 world} [$rd1 read]
59
+
60
+ # unsubscribe from one of the channels
61
+ unsubscribe $rd1 {chan1}
62
+ assert_equal 0 [r publish chan1 hello]
63
+ assert_equal 1 [r publish chan2 world]
64
+ assert_equal {message chan2 world} [$rd1 read]
65
+
66
+ # unsubscribe from the remaining channel
67
+ unsubscribe $rd1 {chan2}
68
+ assert_equal 0 [r publish chan1 hello]
69
+ assert_equal 0 [r publish chan2 world]
70
+
71
+ # clean up clients
72
+ $rd1 close
73
+ }
74
+
75
+ test "PUBLISH/SUBSCRIBE with two clients" {
76
+ set rd1 [redis_deferring_client]
77
+ set rd2 [redis_deferring_client]
78
+
79
+ assert_equal {1} [subscribe $rd1 {chan1}]
80
+ assert_equal {1} [subscribe $rd2 {chan1}]
81
+ assert_equal 2 [r publish chan1 hello]
82
+ assert_equal {message chan1 hello} [$rd1 read]
83
+ assert_equal {message chan1 hello} [$rd2 read]
84
+
85
+ # clean up clients
86
+ $rd1 close
87
+ $rd2 close
88
+ }
89
+
90
+ test "PUBLISH/SUBSCRIBE after UNSUBSCRIBE without arguments" {
91
+ set rd1 [redis_deferring_client]
92
+ assert_equal {1 2 3} [subscribe $rd1 {chan1 chan2 chan3}]
93
+ unsubscribe $rd1
94
+ assert_equal 0 [r publish chan1 hello]
95
+ assert_equal 0 [r publish chan2 hello]
96
+ assert_equal 0 [r publish chan3 hello]
97
+
98
+ # clean up clients
99
+ $rd1 close
100
+ }
101
+
102
+ test "SUBSCRIBE to one channel more than once" {
103
+ set rd1 [redis_deferring_client]
104
+ assert_equal {1 1 1} [subscribe $rd1 {chan1 chan1 chan1}]
105
+ assert_equal 1 [r publish chan1 hello]
106
+ assert_equal {message chan1 hello} [$rd1 read]
107
+
108
+ # clean up clients
109
+ $rd1 close
110
+ }
111
+
112
+ test "UNSUBSCRIBE from non-subscribed channels" {
113
+ set rd1 [redis_deferring_client]
114
+ assert_equal {0 0 0} [unsubscribe $rd1 {foo bar quux}]
115
+
116
+ # clean up clients
117
+ $rd1 close
118
+ }
119
+
120
+ test "PUBLISH/PSUBSCRIBE basics" {
121
+ set rd1 [redis_deferring_client]
122
+
123
+ # subscribe to two patterns
124
+ assert_equal {1 2} [psubscribe $rd1 {foo.* bar.*}]
125
+ assert_equal 1 [r publish foo.1 hello]
126
+ assert_equal 1 [r publish bar.1 hello]
127
+ assert_equal 0 [r publish foo1 hello]
128
+ assert_equal 0 [r publish barfoo.1 hello]
129
+ assert_equal 0 [r publish qux.1 hello]
130
+ assert_equal {pmessage foo.* foo.1 hello} [$rd1 read]
131
+ assert_equal {pmessage bar.* bar.1 hello} [$rd1 read]
132
+
133
+ # unsubscribe from one of the patterns
134
+ assert_equal {1} [punsubscribe $rd1 {foo.*}]
135
+ assert_equal 0 [r publish foo.1 hello]
136
+ assert_equal 1 [r publish bar.1 hello]
137
+ assert_equal {pmessage bar.* bar.1 hello} [$rd1 read]
138
+
139
+ # unsubscribe from the remaining pattern
140
+ assert_equal {0} [punsubscribe $rd1 {bar.*}]
141
+ assert_equal 0 [r publish foo.1 hello]
142
+ assert_equal 0 [r publish bar.1 hello]
143
+
144
+ # clean up clients
145
+ $rd1 close
146
+ }
147
+
148
+ test "PUBLISH/PSUBSCRIBE with two clients" {
149
+ set rd1 [redis_deferring_client]
150
+ set rd2 [redis_deferring_client]
151
+
152
+ assert_equal {1} [psubscribe $rd1 {chan.*}]
153
+ assert_equal {1} [psubscribe $rd2 {chan.*}]
154
+ assert_equal 2 [r publish chan.foo hello]
155
+ assert_equal {pmessage chan.* chan.foo hello} [$rd1 read]
156
+ assert_equal {pmessage chan.* chan.foo hello} [$rd2 read]
157
+
158
+ # clean up clients
159
+ $rd1 close
160
+ $rd2 close
161
+ }
162
+
163
+ test "PUBLISH/PSUBSCRIBE after PUNSUBSCRIBE without arguments" {
164
+ set rd1 [redis_deferring_client]
165
+ assert_equal {1 2 3} [psubscribe $rd1 {chan1.* chan2.* chan3.*}]
166
+ punsubscribe $rd1
167
+ assert_equal 0 [r publish chan1.hi hello]
168
+ assert_equal 0 [r publish chan2.hi hello]
169
+ assert_equal 0 [r publish chan3.hi hello]
170
+
171
+ # clean up clients
172
+ $rd1 close
173
+ }
174
+
175
+ test "PUNSUBSCRIBE from non-subscribed channels" {
176
+ set rd1 [redis_deferring_client]
177
+ assert_equal {0 0 0} [punsubscribe $rd1 {foo.* bar.* quux.*}]
178
+
179
+ # clean up clients
180
+ $rd1 close
181
+ }
182
+
183
+ test "Mix SUBSCRIBE and PSUBSCRIBE" {
184
+ set rd1 [redis_deferring_client]
185
+ assert_equal {1} [subscribe $rd1 {foo.bar}]
186
+ assert_equal {2} [psubscribe $rd1 {foo.*}]
187
+
188
+ assert_equal 2 [r publish foo.bar hello]
189
+ assert_equal {message foo.bar hello} [$rd1 read]
190
+ assert_equal {pmessage foo.* foo.bar hello} [$rd1 read]
191
+
192
+ # clean up clients
193
+ $rd1 close
194
+ }
195
+ }
@@ -0,0 +1,40 @@
1
+ start_server {tags {"quit"}} {
2
+ proc format_command {args} {
3
+ set cmd "*[llength $args]\r\n"
4
+ foreach a $args {
5
+ append cmd "$[string length $a]\r\n$a\r\n"
6
+ }
7
+ set _ $cmd
8
+ }
9
+
10
+ test "QUIT returns OK" {
11
+ reconnect
12
+ assert_equal OK [r quit]
13
+ assert_error * {r ping}
14
+ }
15
+
16
+ test "Pipelined commands after QUIT must not be executed" {
17
+ reconnect
18
+ r write [format_command quit]
19
+ r write [format_command set foo bar]
20
+ r flush
21
+ assert_equal OK [r read]
22
+ assert_error * {r read}
23
+
24
+ reconnect
25
+ assert_equal {} [r get foo]
26
+ }
27
+
28
+ test "Pipelined commands after QUIT that exceed read buffer size" {
29
+ reconnect
30
+ r write [format_command quit]
31
+ r write [format_command set foo [string repeat "x" 1024]]
32
+ r flush
33
+ assert_equal OK [r read]
34
+ assert_error * {r read}
35
+
36
+ reconnect
37
+ assert_equal {} [r get foo]
38
+
39
+ }
40
+ }
@@ -0,0 +1,189 @@
1
+ start_server {
2
+ tags {"sort"}
3
+ overrides {
4
+ "list-max-ziplist-value" 16
5
+ "list-max-ziplist-entries" 32
6
+ "set-max-intset-entries" 32
7
+ }
8
+ } {
9
+ proc create_random_dataset {num cmd} {
10
+ set tosort {}
11
+ set result {}
12
+ array set seenrand {}
13
+ r del tosort
14
+ for {set i 0} {$i < $num} {incr i} {
15
+ # Make sure all the weights are different because
16
+ # Redis does not use a stable sort but Tcl does.
17
+ while 1 {
18
+ randpath {
19
+ set rint [expr int(rand()*1000000)]
20
+ } {
21
+ set rint [expr rand()]
22
+ }
23
+ if {![info exists seenrand($rint)]} break
24
+ }
25
+ set seenrand($rint) x
26
+ r $cmd tosort $i
27
+ r set weight_$i $rint
28
+ r hset wobj_$i weight $rint
29
+ lappend tosort [list $i $rint]
30
+ }
31
+ set sorted [lsort -index 1 -real $tosort]
32
+ for {set i 0} {$i < $num} {incr i} {
33
+ lappend result [lindex $sorted $i 0]
34
+ }
35
+ set _ $result
36
+ }
37
+
38
+ foreach {num cmd enc title} {
39
+ 16 lpush ziplist "Ziplist"
40
+ 1000 lpush linkedlist "Linked list"
41
+ 10000 lpush linkedlist "Big Linked list"
42
+ 16 sadd intset "Intset"
43
+ 1000 sadd hashtable "Hash table"
44
+ 10000 sadd hashtable "Big Hash table"
45
+ } {
46
+ set result [create_random_dataset $num $cmd]
47
+ assert_encoding $enc tosort
48
+
49
+ test "$title: SORT BY key" {
50
+ assert_equal $result [r sort tosort BY weight_*]
51
+ }
52
+
53
+ test "$title: SORT BY hash field" {
54
+ assert_equal $result [r sort tosort BY wobj_*->weight]
55
+ }
56
+ }
57
+
58
+ set result [create_random_dataset 16 lpush]
59
+ test "SORT GET #" {
60
+ assert_equal [lsort -integer $result] [r sort tosort GET #]
61
+ }
62
+
63
+ test "SORT GET <const>" {
64
+ r del foo
65
+ set res [r sort tosort GET foo]
66
+ assert_equal 16 [llength $res]
67
+ foreach item $res { assert_equal {} $item }
68
+ }
69
+
70
+ test "SORT GET (key and hash) with sanity check" {
71
+ set l1 [r sort tosort GET # GET weight_*]
72
+ set l2 [r sort tosort GET # GET wobj_*->weight]
73
+ foreach {id1 w1} $l1 {id2 w2} $l2 {
74
+ assert_equal $id1 $id2
75
+ assert_equal $w1 [r get weight_$id1]
76
+ assert_equal $w2 [r get weight_$id1]
77
+ }
78
+ }
79
+
80
+ test "SORT BY key STORE" {
81
+ r sort tosort BY weight_* store sort-res
82
+ assert_equal $result [r lrange sort-res 0 -1]
83
+ assert_equal 16 [r llen sort-res]
84
+ assert_encoding ziplist sort-res
85
+ }
86
+
87
+ test "SORT BY hash field STORE" {
88
+ r sort tosort BY wobj_*->weight store sort-res
89
+ assert_equal $result [r lrange sort-res 0 -1]
90
+ assert_equal 16 [r llen sort-res]
91
+ assert_encoding ziplist sort-res
92
+ }
93
+
94
+ test "SORT DESC" {
95
+ assert_equal [lsort -decreasing -integer $result] [r sort tosort DESC]
96
+ }
97
+
98
+ test "SORT ALPHA against integer encoded strings" {
99
+ r del mylist
100
+ r lpush mylist 2
101
+ r lpush mylist 1
102
+ r lpush mylist 3
103
+ r lpush mylist 10
104
+ r sort mylist alpha
105
+ } {1 10 2 3}
106
+
107
+ test "SORT sorted set" {
108
+ r del zset
109
+ r zadd zset 1 a
110
+ r zadd zset 5 b
111
+ r zadd zset 2 c
112
+ r zadd zset 10 d
113
+ r zadd zset 3 e
114
+ r sort zset alpha desc
115
+ } {e d c b a}
116
+
117
+ test "SORT sorted set: +inf and -inf handling" {
118
+ r del zset
119
+ r zadd zset -100 a
120
+ r zadd zset 200 b
121
+ r zadd zset -300 c
122
+ r zadd zset 1000000 d
123
+ r zadd zset +inf max
124
+ r zadd zset -inf min
125
+ r zrange zset 0 -1
126
+ } {min c a b d max}
127
+
128
+ test "SORT regression for issue #19, sorting floats" {
129
+ r flushdb
130
+ set floats {1.1 5.10 3.10 7.44 2.1 5.75 6.12 0.25 1.15}
131
+ foreach x $floats {
132
+ r lpush mylist $x
133
+ }
134
+ assert_equal [lsort -real $floats] [r sort mylist]
135
+ }
136
+
137
+ tags {"slow"} {
138
+ set num 100
139
+ set res [create_random_dataset $num lpush]
140
+
141
+ test "SORT speed, $num element list BY key, 100 times" {
142
+ set start [clock clicks -milliseconds]
143
+ for {set i 0} {$i < 100} {incr i} {
144
+ set sorted [r sort tosort BY weight_* LIMIT 0 10]
145
+ }
146
+ set elapsed [expr [clock clicks -milliseconds]-$start]
147
+ if {$::verbose} {
148
+ puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
149
+ flush stdout
150
+ }
151
+ }
152
+
153
+ test "SORT speed, $num element list BY hash field, 100 times" {
154
+ set start [clock clicks -milliseconds]
155
+ for {set i 0} {$i < 100} {incr i} {
156
+ set sorted [r sort tosort BY wobj_*->weight LIMIT 0 10]
157
+ }
158
+ set elapsed [expr [clock clicks -milliseconds]-$start]
159
+ if {$::verbose} {
160
+ puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
161
+ flush stdout
162
+ }
163
+ }
164
+
165
+ test "SORT speed, $num element list directly, 100 times" {
166
+ set start [clock clicks -milliseconds]
167
+ for {set i 0} {$i < 100} {incr i} {
168
+ set sorted [r sort tosort LIMIT 0 10]
169
+ }
170
+ set elapsed [expr [clock clicks -milliseconds]-$start]
171
+ if {$::verbose} {
172
+ puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
173
+ flush stdout
174
+ }
175
+ }
176
+
177
+ test "SORT speed, $num element list BY <const>, 100 times" {
178
+ set start [clock clicks -milliseconds]
179
+ for {set i 0} {$i < 100} {incr i} {
180
+ set sorted [r sort tosort BY nokey LIMIT 0 10]
181
+ }
182
+ set elapsed [expr [clock clicks -milliseconds]-$start]
183
+ if {$::verbose} {
184
+ puts -nonewline "\n Average time to sort: [expr double($elapsed)/100] milliseconds "
185
+ flush stdout
186
+ }
187
+ }
188
+ }
189
+ }