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,15 @@
1
+ set ::tmpcounter 0
2
+ set ::tmproot "./tests/tmp"
3
+ file mkdir $::tmproot
4
+
5
+ # returns a dirname unique to this process to write to
6
+ proc tmpdir {basename} {
7
+ set dir [file join $::tmproot $basename.[pid].[incr ::tmpcounter]]
8
+ file mkdir $dir
9
+ set _ $dir
10
+ }
11
+
12
+ # return a filename unique to this process to write to
13
+ proc tmpfile {basename} {
14
+ file join $::tmproot $basename.[pid].[incr ::tmpcounter]
15
+ }
@@ -0,0 +1,296 @@
1
+ proc randstring {min max {type binary}} {
2
+ set len [expr {$min+int(rand()*($max-$min+1))}]
3
+ set output {}
4
+ if {$type eq {binary}} {
5
+ set minval 0
6
+ set maxval 255
7
+ } elseif {$type eq {alpha}} {
8
+ set minval 48
9
+ set maxval 122
10
+ } elseif {$type eq {compr}} {
11
+ set minval 48
12
+ set maxval 52
13
+ }
14
+ while {$len} {
15
+ append output [format "%c" [expr {$minval+int(rand()*($maxval-$minval+1))}]]
16
+ incr len -1
17
+ }
18
+ return $output
19
+ }
20
+
21
+ # Useful for some test
22
+ proc zlistAlikeSort {a b} {
23
+ if {[lindex $a 0] > [lindex $b 0]} {return 1}
24
+ if {[lindex $a 0] < [lindex $b 0]} {return -1}
25
+ string compare [lindex $a 1] [lindex $b 1]
26
+ }
27
+
28
+ # Return all log lines starting with the first line that contains a warning.
29
+ # Generally, this will be an assertion error with a stack trace.
30
+ proc warnings_from_file {filename} {
31
+ set lines [split [exec cat $filename] "\n"]
32
+ set matched 0
33
+ set result {}
34
+ foreach line $lines {
35
+ if {[regexp {^\[\d+\]\s+\d+\s+\w+\s+\d{2}:\d{2}:\d{2} \#} $line]} {
36
+ set matched 1
37
+ }
38
+ if {$matched} {
39
+ lappend result $line
40
+ }
41
+ }
42
+ join $result "\n"
43
+ }
44
+
45
+ # Return value for INFO property
46
+ proc status {r property} {
47
+ if {[regexp "\r\n$property:(.*?)\r\n" [{*}$r info] _ value]} {
48
+ set _ $value
49
+ }
50
+ }
51
+
52
+ proc waitForBgsave r {
53
+ while 1 {
54
+ if {[status r bgsave_in_progress] eq 1} {
55
+ if {$::verbose} {
56
+ puts -nonewline "\nWaiting for background save to finish... "
57
+ flush stdout
58
+ }
59
+ after 1000
60
+ } else {
61
+ break
62
+ }
63
+ }
64
+ }
65
+
66
+ proc waitForBgrewriteaof r {
67
+ while 1 {
68
+ if {[status r bgrewriteaof_in_progress] eq 1} {
69
+ if {$::verbose} {
70
+ puts -nonewline "\nWaiting for background AOF rewrite to finish... "
71
+ flush stdout
72
+ }
73
+ after 1000
74
+ } else {
75
+ break
76
+ }
77
+ }
78
+ }
79
+
80
+ proc wait_for_sync r {
81
+ while 1 {
82
+ if {[status r master_link_status] eq "down"} {
83
+ after 10
84
+ } else {
85
+ break
86
+ }
87
+ }
88
+ }
89
+
90
+ proc randomInt {max} {
91
+ expr {int(rand()*$max)}
92
+ }
93
+
94
+ proc randpath args {
95
+ set path [expr {int(rand()*[llength $args])}]
96
+ uplevel 1 [lindex $args $path]
97
+ }
98
+
99
+ proc randomValue {} {
100
+ randpath {
101
+ # Small enough to likely collide
102
+ randomInt 1000
103
+ } {
104
+ # 32 bit compressible signed/unsigned
105
+ randpath {randomInt 2000000000} {randomInt 4000000000}
106
+ } {
107
+ # 64 bit
108
+ randpath {randomInt 1000000000000}
109
+ } {
110
+ # Random string
111
+ randpath {randstring 0 256 alpha} \
112
+ {randstring 0 256 compr} \
113
+ {randstring 0 256 binary}
114
+ }
115
+ }
116
+
117
+ proc randomKey {} {
118
+ randpath {
119
+ # Small enough to likely collide
120
+ randomInt 1000
121
+ } {
122
+ # 32 bit compressible signed/unsigned
123
+ randpath {randomInt 2000000000} {randomInt 4000000000}
124
+ } {
125
+ # 64 bit
126
+ randpath {randomInt 1000000000000}
127
+ } {
128
+ # Random string
129
+ randpath {randstring 1 256 alpha} \
130
+ {randstring 1 256 compr}
131
+ }
132
+ }
133
+
134
+ proc findKeyWithType {r type} {
135
+ for {set j 0} {$j < 20} {incr j} {
136
+ set k [{*}$r randomkey]
137
+ if {$k eq {}} {
138
+ return {}
139
+ }
140
+ if {[{*}$r type $k] eq $type} {
141
+ return $k
142
+ }
143
+ }
144
+ return {}
145
+ }
146
+
147
+ proc createComplexDataset {r ops {opt {}}} {
148
+ for {set j 0} {$j < $ops} {incr j} {
149
+ set k [randomKey]
150
+ set k2 [randomKey]
151
+ set f [randomValue]
152
+ set v [randomValue]
153
+
154
+ if {[lsearch -exact $opt useexpire] != -1} {
155
+ if {rand() < 0.1} {
156
+ {*}$r expire [randomKey] [randomInt 2]
157
+ }
158
+ }
159
+
160
+ randpath {
161
+ set d [expr {rand()}]
162
+ } {
163
+ set d [expr {rand()}]
164
+ } {
165
+ set d [expr {rand()}]
166
+ } {
167
+ set d [expr {rand()}]
168
+ } {
169
+ set d [expr {rand()}]
170
+ } {
171
+ randpath {set d +inf} {set d -inf}
172
+ }
173
+ set t [{*}$r type $k]
174
+
175
+ if {$t eq {none}} {
176
+ randpath {
177
+ {*}$r set $k $v
178
+ } {
179
+ {*}$r lpush $k $v
180
+ } {
181
+ {*}$r sadd $k $v
182
+ } {
183
+ {*}$r zadd $k $d $v
184
+ } {
185
+ {*}$r hset $k $f $v
186
+ } {
187
+ {*}$r del $k
188
+ }
189
+ set t [{*}$r type $k]
190
+ }
191
+
192
+ switch $t {
193
+ {string} {
194
+ # Nothing to do
195
+ }
196
+ {list} {
197
+ randpath {{*}$r lpush $k $v} \
198
+ {{*}$r rpush $k $v} \
199
+ {{*}$r lrem $k 0 $v} \
200
+ {{*}$r rpop $k} \
201
+ {{*}$r lpop $k}
202
+ }
203
+ {set} {
204
+ randpath {{*}$r sadd $k $v} \
205
+ {{*}$r srem $k $v} \
206
+ {
207
+ set otherset [findKeyWithType {*}$r set]
208
+ if {$otherset ne {}} {
209
+ randpath {
210
+ {*}$r sunionstore $k2 $k $otherset
211
+ } {
212
+ {*}$r sinterstore $k2 $k $otherset
213
+ } {
214
+ {*}$r sdiffstore $k2 $k $otherset
215
+ }
216
+ }
217
+ }
218
+ }
219
+ {zset} {
220
+ randpath {{*}$r zadd $k $d $v} \
221
+ {{*}$r zrem $k $v} \
222
+ {
223
+ set otherzset [findKeyWithType {*}$r zset]
224
+ if {$otherzset ne {}} {
225
+ randpath {
226
+ {*}$r zunionstore $k2 2 $k $otherzset
227
+ } {
228
+ {*}$r zinterstore $k2 2 $k $otherzset
229
+ }
230
+ }
231
+ }
232
+ }
233
+ {hash} {
234
+ randpath {{*}$r hset $k $f $v} \
235
+ {{*}$r hdel $k $f}
236
+ }
237
+ }
238
+ }
239
+ }
240
+
241
+ proc formatCommand {args} {
242
+ set cmd "*[llength $args]\r\n"
243
+ foreach a $args {
244
+ append cmd "$[string length $a]\r\n$a\r\n"
245
+ }
246
+ set _ $cmd
247
+ }
248
+
249
+ proc csvdump r {
250
+ set o {}
251
+ foreach k [lsort [{*}$r keys *]] {
252
+ set type [{*}$r type $k]
253
+ append o [csvstring $k] , [csvstring $type] ,
254
+ switch $type {
255
+ string {
256
+ append o [csvstring [{*}$r get $k]] "\n"
257
+ }
258
+ list {
259
+ foreach e [{*}$r lrange $k 0 -1] {
260
+ append o [csvstring $e] ,
261
+ }
262
+ append o "\n"
263
+ }
264
+ set {
265
+ foreach e [lsort [{*}$r smembers $k]] {
266
+ append o [csvstring $e] ,
267
+ }
268
+ append o "\n"
269
+ }
270
+ zset {
271
+ foreach e [{*}$r zrange $k 0 -1 withscores] {
272
+ append o [csvstring $e] ,
273
+ }
274
+ append o "\n"
275
+ }
276
+ hash {
277
+ set fields [{*}$r hgetall $k]
278
+ set newfields {}
279
+ foreach {k v} $fields {
280
+ lappend newfields [list $k $v]
281
+ }
282
+ set fields [lsort -index 0 $newfields]
283
+ foreach kv $fields {
284
+ append o [csvstring [lindex $kv 0]] ,
285
+ append o [csvstring [lindex $kv 1]] ,
286
+ }
287
+ append o "\n"
288
+ }
289
+ }
290
+ }
291
+ return $o
292
+ }
293
+
294
+ proc csvstring s {
295
+ return "\"$s\""
296
+ }
@@ -0,0 +1,221 @@
1
+ # Redis test suite. Copyright (C) 2009 Salvatore Sanfilippo antirez@gmail.com
2
+ # This softare is released under the BSD License. See the COPYING file for
3
+ # more information.
4
+
5
+ set tcl_precision 17
6
+ source tests/support/redis.tcl
7
+ source tests/support/server.tcl
8
+ source tests/support/tmpfile.tcl
9
+ source tests/support/test.tcl
10
+ source tests/support/util.tcl
11
+
12
+ set ::host 127.0.0.1
13
+ set ::port 16379
14
+ set ::traceleaks 0
15
+ set ::valgrind 0
16
+ set ::verbose 0
17
+ set ::denytags {}
18
+ set ::allowtags {}
19
+ set ::external 0; # If "1" this means, we are running against external instance
20
+ set ::file ""; # If set, runs only the tests in this comma separated list
21
+ set ::curfile ""; # Hold the filename of the current suite
22
+
23
+ proc execute_tests name {
24
+ set path "tests/$name.tcl"
25
+ set ::curfile $path
26
+ source $path
27
+ }
28
+
29
+ # Setup a list to hold a stack of server configs. When calls to start_server
30
+ # are nested, use "srv 0 pid" to get the pid of the inner server. To access
31
+ # outer servers, use "srv -1 pid" etcetera.
32
+ set ::servers {}
33
+ proc srv {args} {
34
+ set level 0
35
+ if {[string is integer [lindex $args 0]]} {
36
+ set level [lindex $args 0]
37
+ set property [lindex $args 1]
38
+ } else {
39
+ set property [lindex $args 0]
40
+ }
41
+ set srv [lindex $::servers end+$level]
42
+ dict get $srv $property
43
+ }
44
+
45
+ # Provide easy access to the client for the inner server. It's possible to
46
+ # prepend the argument list with a negative level to access clients for
47
+ # servers running in outer blocks.
48
+ proc r {args} {
49
+ set level 0
50
+ if {[string is integer [lindex $args 0]]} {
51
+ set level [lindex $args 0]
52
+ set args [lrange $args 1 end]
53
+ }
54
+ [srv $level "client"] {*}$args
55
+ }
56
+
57
+ proc reconnect {args} {
58
+ set level [lindex $args 0]
59
+ if {[string length $level] == 0 || ![string is integer $level]} {
60
+ set level 0
61
+ }
62
+
63
+ set srv [lindex $::servers end+$level]
64
+ set host [dict get $srv "host"]
65
+ set port [dict get $srv "port"]
66
+ set config [dict get $srv "config"]
67
+ set client [redis $host $port]
68
+ dict set srv "client" $client
69
+
70
+ # select the right db when we don't have to authenticate
71
+ if {![dict exists $config "requirepass"]} {
72
+ $client select 9
73
+ }
74
+
75
+ # re-set $srv in the servers list
76
+ set ::servers [lreplace $::servers end+$level 1 $srv]
77
+ }
78
+
79
+ proc redis_deferring_client {args} {
80
+ set level 0
81
+ if {[llength $args] > 0 && [string is integer [lindex $args 0]]} {
82
+ set level [lindex $args 0]
83
+ set args [lrange $args 1 end]
84
+ }
85
+
86
+ # create client that defers reading reply
87
+ set client [redis [srv $level "host"] [srv $level "port"] 1]
88
+
89
+ # select the right db and read the response (OK)
90
+ $client select 9
91
+ $client read
92
+ return $client
93
+ }
94
+
95
+ # Provide easy access to INFO properties. Same semantic as "proc r".
96
+ proc s {args} {
97
+ set level 0
98
+ if {[string is integer [lindex $args 0]]} {
99
+ set level [lindex $args 0]
100
+ set args [lrange $args 1 end]
101
+ }
102
+ status [srv $level "client"] [lindex $args 0]
103
+ }
104
+
105
+ proc cleanup {} {
106
+ catch {exec rm -rf {*}[glob tests/tmp/redis.conf.*]}
107
+ catch {exec rm -rf {*}[glob tests/tmp/server.*]}
108
+ }
109
+
110
+ proc execute_everything {} {
111
+ execute_tests "unit/printver"
112
+ execute_tests "unit/auth"
113
+ execute_tests "unit/protocol"
114
+ execute_tests "unit/basic"
115
+ execute_tests "unit/type/list"
116
+ execute_tests "unit/type/set"
117
+ execute_tests "unit/type/zset"
118
+ execute_tests "unit/type/hash"
119
+ execute_tests "unit/sort"
120
+ execute_tests "unit/expire"
121
+ execute_tests "unit/other"
122
+ execute_tests "unit/cas"
123
+ execute_tests "unit/quit"
124
+ execute_tests "integration/replication"
125
+ execute_tests "integration/aof"
126
+ # execute_tests "integration/redis-cli"
127
+ execute_tests "unit/pubsub"
128
+
129
+ # run tests with VM enabled
130
+ set ::global_overrides {vm-enabled yes}
131
+ execute_tests "unit/protocol"
132
+ execute_tests "unit/basic"
133
+ execute_tests "unit/type/list"
134
+ execute_tests "unit/type/set"
135
+ execute_tests "unit/type/zset"
136
+ execute_tests "unit/type/hash"
137
+ execute_tests "unit/sort"
138
+ execute_tests "unit/expire"
139
+ execute_tests "unit/other"
140
+ execute_tests "unit/cas"
141
+ }
142
+
143
+ proc main {} {
144
+ cleanup
145
+
146
+ if {[string length $::file] > 0} {
147
+ foreach {file} [split $::file ,] {
148
+ execute_tests $file
149
+ }
150
+ } else {
151
+ execute_everything
152
+ }
153
+
154
+ cleanup
155
+ puts "\n[expr $::num_tests] tests, $::num_passed passed, $::num_failed failed\n"
156
+ if {$::num_failed > 0} {
157
+ set curheader ""
158
+ puts "Failures:"
159
+ foreach {test} $::tests_failed {
160
+ set header [lindex $test 0]
161
+ append header " ("
162
+ append header [join [lindex $test 1] ","]
163
+ append header ")"
164
+
165
+ if {$curheader ne $header} {
166
+ set curheader $header
167
+ puts "\n$curheader:"
168
+ }
169
+
170
+ set name [lindex $test 2]
171
+ set msg [lindex $test 3]
172
+ puts "- $name: $msg"
173
+ }
174
+
175
+ puts ""
176
+ exit 1
177
+ }
178
+ }
179
+
180
+ # parse arguments
181
+ for {set j 0} {$j < [llength $argv]} {incr j} {
182
+ set opt [lindex $argv $j]
183
+ set arg [lindex $argv [expr $j+1]]
184
+ if {$opt eq {--tags}} {
185
+ foreach tag $arg {
186
+ if {[string index $tag 0] eq "-"} {
187
+ lappend ::denytags [string range $tag 1 end]
188
+ } else {
189
+ lappend ::allowtags $tag
190
+ }
191
+ }
192
+ incr j
193
+ } elseif {$opt eq {--valgrind}} {
194
+ set ::valgrind 1
195
+ } elseif {$opt eq {--file}} {
196
+ set ::file $arg
197
+ incr j
198
+ } elseif {$opt eq {--host}} {
199
+ set ::external 1
200
+ set ::host $arg
201
+ incr j
202
+ } elseif {$opt eq {--port}} {
203
+ set ::port $arg
204
+ incr j
205
+ } elseif {$opt eq {--verbose}} {
206
+ set ::verbose 1
207
+ } else {
208
+ puts "Wrong argument: $opt"
209
+ exit 1
210
+ }
211
+ }
212
+
213
+ if {[catch { main } err]} {
214
+ if {[string length $err] > 0} {
215
+ # only display error when not generated by the test suite
216
+ if {$err ne "exception"} {
217
+ puts $::errorInfo
218
+ }
219
+ exit 1
220
+ }
221
+ }