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.
- data/LICENSE +38 -0
- data/README.md +33 -0
- data/bin/redis +114 -0
- data/redis/Makefile +5 -0
- data/redis/extconf.rb +3 -0
- data/redis/redis-2.2.11/00-RELEASENOTES +199 -0
- data/redis/redis-2.2.11/BUGS +1 -0
- data/redis/redis-2.2.11/CONTRIBUTING +13 -0
- data/redis/redis-2.2.11/COPYING +10 -0
- data/redis/redis-2.2.11/Changelog +1032 -0
- data/redis/redis-2.2.11/INSTALL +30 -0
- data/redis/redis-2.2.11/Makefile +22 -0
- data/redis/redis-2.2.11/README +83 -0
- data/redis/redis-2.2.11/TODO +4 -0
- data/redis/redis-2.2.11/client-libraries/README +11 -0
- data/redis/redis-2.2.11/deps/hiredis/COPYING +10 -0
- data/redis/redis-2.2.11/deps/hiredis/Makefile +115 -0
- data/redis/redis-2.2.11/deps/hiredis/README.md +311 -0
- data/redis/redis-2.2.11/deps/hiredis/TODO +2 -0
- data/redis/redis-2.2.11/deps/hiredis/adapters/ae.h +95 -0
- data/redis/redis-2.2.11/deps/hiredis/adapters/libev.h +113 -0
- data/redis/redis-2.2.11/deps/hiredis/adapters/libevent.h +76 -0
- data/redis/redis-2.2.11/deps/hiredis/async.c +321 -0
- data/redis/redis-2.2.11/deps/hiredis/async.h +112 -0
- data/redis/redis-2.2.11/deps/hiredis/example-ae.c +53 -0
- data/redis/redis-2.2.11/deps/hiredis/example-libev.c +47 -0
- data/redis/redis-2.2.11/deps/hiredis/example-libevent.c +48 -0
- data/redis/redis-2.2.11/deps/hiredis/example.c +67 -0
- data/redis/redis-2.2.11/deps/hiredis/fmacros.h +15 -0
- data/redis/redis-2.2.11/deps/hiredis/hiredis.c +1058 -0
- data/redis/redis-2.2.11/deps/hiredis/hiredis.h +170 -0
- data/redis/redis-2.2.11/deps/hiredis/net.c +170 -0
- data/redis/redis-2.2.11/deps/hiredis/net.h +43 -0
- data/redis/redis-2.2.11/deps/hiredis/sds.c +479 -0
- data/redis/redis-2.2.11/deps/hiredis/sds.h +77 -0
- data/redis/redis-2.2.11/deps/hiredis/test.c +479 -0
- data/redis/redis-2.2.11/deps/hiredis/util.h +40 -0
- data/redis/redis-2.2.11/deps/linenoise/Makefile +10 -0
- data/redis/redis-2.2.11/deps/linenoise/README.markdown +45 -0
- data/redis/redis-2.2.11/deps/linenoise/example.c +27 -0
- data/redis/redis-2.2.11/deps/linenoise/linenoise.c +609 -0
- data/redis/redis-2.2.11/deps/linenoise/linenoise.h +55 -0
- data/redis/redis-2.2.11/design-documents/REDIS-CLUSTER +214 -0
- data/redis/redis-2.2.11/design-documents/REDIS-CLUSTER-2 +343 -0
- data/redis/redis-2.2.11/doc/AppendCommand.html +48 -0
- data/redis/redis-2.2.11/doc/AppendOnlyFileHowto.html +41 -0
- data/redis/redis-2.2.11/doc/AuthCommand.html +39 -0
- data/redis/redis-2.2.11/doc/Benchmarks.html +129 -0
- data/redis/redis-2.2.11/doc/BgrewriteaofCommand.html +41 -0
- data/redis/redis-2.2.11/doc/BgsaveCommand.html +39 -0
- data/redis/redis-2.2.11/doc/BlpopCommand.html +51 -0
- data/redis/redis-2.2.11/doc/BrpoplpushCommand.html +39 -0
- data/redis/redis-2.2.11/doc/CommandReference.html +47 -0
- data/redis/redis-2.2.11/doc/Comparisons.html +42 -0
- data/redis/redis-2.2.11/doc/ConfigCommand.html +76 -0
- data/redis/redis-2.2.11/doc/Configuration.html +38 -0
- data/redis/redis-2.2.11/doc/ConnectionHandlingSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/ControlCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/Credits.html +38 -0
- data/redis/redis-2.2.11/doc/DbsizeCommand.html +38 -0
- data/redis/redis-2.2.11/doc/DelCommand.html +41 -0
- data/redis/redis-2.2.11/doc/DesignPatterns.html +37 -0
- data/redis/redis-2.2.11/doc/EventLibray.html +44 -0
- data/redis/redis-2.2.11/doc/ExistsCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ExpireCommand.html +96 -0
- data/redis/redis-2.2.11/doc/FAQ.html +70 -0
- data/redis/redis-2.2.11/doc/Features.html +38 -0
- data/redis/redis-2.2.11/doc/FlushallCommand.html +39 -0
- data/redis/redis-2.2.11/doc/FlushdbCommand.html +39 -0
- data/redis/redis-2.2.11/doc/FromSqlToDataStructures.html +37 -0
- data/redis/redis-2.2.11/doc/GenericCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/GetCommand.html +39 -0
- data/redis/redis-2.2.11/doc/GetbitCommand.html +39 -0
- data/redis/redis-2.2.11/doc/GetsetCommand.html +38 -0
- data/redis/redis-2.2.11/doc/HackingStrings.html +83 -0
- data/redis/redis-2.2.11/doc/HashCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/Hashes.html +37 -0
- data/redis/redis-2.2.11/doc/HdelCommand.html +39 -0
- data/redis/redis-2.2.11/doc/HexistsCommand.html +39 -0
- data/redis/redis-2.2.11/doc/HgetCommand.html +39 -0
- data/redis/redis-2.2.11/doc/HgetallCommand.html +40 -0
- data/redis/redis-2.2.11/doc/HincrbyCommand.html +45 -0
- data/redis/redis-2.2.11/doc/HlenCommand.html +38 -0
- data/redis/redis-2.2.11/doc/HmgetCommand.html +40 -0
- data/redis/redis-2.2.11/doc/HmsetCommand.html +40 -0
- data/redis/redis-2.2.11/doc/HsetCommand.html +40 -0
- data/redis/redis-2.2.11/doc/HsetnxCommand.html +41 -0
- data/redis/redis-2.2.11/doc/IncrCommand.html +43 -0
- data/redis/redis-2.2.11/doc/InfoCommand.html +48 -0
- data/redis/redis-2.2.11/doc/IntroductionToRedisDataTypes.html +152 -0
- data/redis/redis-2.2.11/doc/KeysCommand.html +43 -0
- data/redis/redis-2.2.11/doc/LastsaveCommand.html +39 -0
- data/redis/redis-2.2.11/doc/LindexCommand.html +40 -0
- data/redis/redis-2.2.11/doc/ListCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/Lists.html +42 -0
- data/redis/redis-2.2.11/doc/LlenCommand.html +41 -0
- data/redis/redis-2.2.11/doc/LpopCommand.html +41 -0
- data/redis/redis-2.2.11/doc/LrangeCommand.html +47 -0
- data/redis/redis-2.2.11/doc/LremCommand.html +41 -0
- data/redis/redis-2.2.11/doc/LsetCommand.html +38 -0
- data/redis/redis-2.2.11/doc/LtrimCommand.html +47 -0
- data/redis/redis-2.2.11/doc/MgetCommand.html +52 -0
- data/redis/redis-2.2.11/doc/MonitorCommand.html +63 -0
- data/redis/redis-2.2.11/doc/MoveCommand.html +42 -0
- data/redis/redis-2.2.11/doc/MsetCommand.html +44 -0
- data/redis/redis-2.2.11/doc/MultiExecCommand.html +166 -0
- data/redis/redis-2.2.11/doc/NonexistentCommands.html +51 -0
- data/redis/redis-2.2.11/doc/ObjectHashMappers.html +39 -0
- data/redis/redis-2.2.11/doc/Pipelining.html +36 -0
- data/redis/redis-2.2.11/doc/ProgrammingExamples.html +38 -0
- data/redis/redis-2.2.11/doc/ProtocolSpecification.html +137 -0
- data/redis/redis-2.2.11/doc/PublishSubscribe.html +115 -0
- data/redis/redis-2.2.11/doc/QuickStart.html +68 -0
- data/redis/redis-2.2.11/doc/QuitCommand.html +38 -0
- data/redis/redis-2.2.11/doc/README.html +119 -0
- data/redis/redis-2.2.11/doc/RandomkeyCommand.html +39 -0
- data/redis/redis-2.2.11/doc/Redis0100ChangeLog.html +67 -0
- data/redis/redis-2.2.11/doc/Redis0900ChangeLog.html +56 -0
- data/redis/redis-2.2.11/doc/RedisBigData.html +61 -0
- data/redis/redis-2.2.11/doc/RedisCLI.html +37 -0
- data/redis/redis-2.2.11/doc/RedisEventLibrary.html +70 -0
- data/redis/redis-2.2.11/doc/RedisGuides.html +37 -0
- data/redis/redis-2.2.11/doc/RedisInternals.html +38 -0
- data/redis/redis-2.2.11/doc/RedisPipelining.html +93 -0
- data/redis/redis-2.2.11/doc/RedisStatus.html +56 -0
- data/redis/redis-2.2.11/doc/Redis_1_2_0_Changelog.html +40 -0
- data/redis/redis-2.2.11/doc/Redis_2_0_0_Changelog.html +62 -0
- data/redis/redis-2.2.11/doc/Redis_2_0_Whats_new.html +59 -0
- data/redis/redis-2.2.11/doc/RenameCommand.html +39 -0
- data/redis/redis-2.2.11/doc/RenamenxCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ReplicationHowto.html +43 -0
- data/redis/redis-2.2.11/doc/ReplyTypes.html +42 -0
- data/redis/redis-2.2.11/doc/RoadMap.html +38 -0
- data/redis/redis-2.2.11/doc/RpoplpushCommand.html +44 -0
- data/redis/redis-2.2.11/doc/RpushCommand.html +40 -0
- data/redis/redis-2.2.11/doc/SaddCommand.html +41 -0
- data/redis/redis-2.2.11/doc/SaveCommand.html +39 -0
- data/redis/redis-2.2.11/doc/ScardCommand.html +41 -0
- data/redis/redis-2.2.11/doc/SdiffCommand.html +45 -0
- data/redis/redis-2.2.11/doc/SdiffstoreCommand.html +38 -0
- data/redis/redis-2.2.11/doc/SelectCommand.html +39 -0
- data/redis/redis-2.2.11/doc/SetCommand.html +39 -0
- data/redis/redis-2.2.11/doc/SetCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/SetbitCommand.html +45 -0
- data/redis/redis-2.2.11/doc/SetexCommand.html +42 -0
- data/redis/redis-2.2.11/doc/SetnxCommand.html +51 -0
- data/redis/redis-2.2.11/doc/SetrangeCommand.html +58 -0
- data/redis/redis-2.2.11/doc/Sets.html +36 -0
- data/redis/redis-2.2.11/doc/ShutdownCommand.html +39 -0
- data/redis/redis-2.2.11/doc/SideBar.html +36 -0
- data/redis/redis-2.2.11/doc/SinterCommand.html +40 -0
- data/redis/redis-2.2.11/doc/SinterstoreCommand.html +39 -0
- data/redis/redis-2.2.11/doc/SismemberCommand.html +42 -0
- data/redis/redis-2.2.11/doc/SlaveofCommand.html +41 -0
- data/redis/redis-2.2.11/doc/SmembersCommand.html +38 -0
- data/redis/redis-2.2.11/doc/SmoveCommand.html +44 -0
- data/redis/redis-2.2.11/doc/SortCommand.html +75 -0
- data/redis/redis-2.2.11/doc/SortedSetCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/SortedSets.html +36 -0
- data/redis/redis-2.2.11/doc/Speed.html +38 -0
- data/redis/redis-2.2.11/doc/SponsorshipHistory.html +38 -0
- data/redis/redis-2.2.11/doc/SpopCommand.html +40 -0
- data/redis/redis-2.2.11/doc/SrandmemberCommand.html +40 -0
- data/redis/redis-2.2.11/doc/SremCommand.html +42 -0
- data/redis/redis-2.2.11/doc/StringCommandsSidebar.html +36 -0
- data/redis/redis-2.2.11/doc/Strings.html +37 -0
- data/redis/redis-2.2.11/doc/StrlenCommand.html +39 -0
- data/redis/redis-2.2.11/doc/SubstrCommand.html +52 -0
- data/redis/redis-2.2.11/doc/SunionCommand.html +40 -0
- data/redis/redis-2.2.11/doc/SunionstoreCommand.html +38 -0
- data/redis/redis-2.2.11/doc/SupportedLanguages.html +60 -0
- data/redis/redis-2.2.11/doc/SupportedPlatforms.html +37 -0
- data/redis/redis-2.2.11/doc/TemplateCommand.html +38 -0
- data/redis/redis-2.2.11/doc/TtlCommand.html +38 -0
- data/redis/redis-2.2.11/doc/TwitterAlikeExample.html +250 -0
- data/redis/redis-2.2.11/doc/TypeCommand.html +46 -0
- data/redis/redis-2.2.11/doc/UnstableSource.html +39 -0
- data/redis/redis-2.2.11/doc/VirtualMemorySpecification.html +156 -0
- data/redis/redis-2.2.11/doc/VirtualMemoryUserGuide.html +66 -0
- data/redis/redis-2.2.11/doc/ZaddCommand.html +43 -0
- data/redis/redis-2.2.11/doc/ZcardCommand.html +41 -0
- data/redis/redis-2.2.11/doc/ZincrbyCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ZrangeCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ZrangebyscoreCommand.html +77 -0
- data/redis/redis-2.2.11/doc/ZrankCommand.html +43 -0
- data/redis/redis-2.2.11/doc/ZremCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ZremrangebyrankCommand.html +39 -0
- data/redis/redis-2.2.11/doc/ZremrangebyscoreCommand.html +39 -0
- data/redis/redis-2.2.11/doc/ZscoreCommand.html +41 -0
- data/redis/redis-2.2.11/doc/ZunionCommand.html +42 -0
- data/redis/redis-2.2.11/doc/ZunionstoreCommand.html +43 -0
- data/redis/redis-2.2.11/doc/index.html +43 -0
- data/redis/redis-2.2.11/doc/redis.png +0 -0
- data/redis/redis-2.2.11/doc/style.css +25 -0
- data/redis/redis-2.2.11/redis.conf +417 -0
- data/redis/redis-2.2.11/src/Makefile +177 -0
- data/redis/redis-2.2.11/src/adlist.c +325 -0
- data/redis/redis-2.2.11/src/adlist.h +92 -0
- data/redis/redis-2.2.11/src/ae.c +390 -0
- data/redis/redis-2.2.11/src/ae.h +117 -0
- data/redis/redis-2.2.11/src/ae_epoll.c +91 -0
- data/redis/redis-2.2.11/src/ae_kqueue.c +93 -0
- data/redis/redis-2.2.11/src/ae_select.c +72 -0
- data/redis/redis-2.2.11/src/anet.c +347 -0
- data/redis/redis-2.2.11/src/anet.h +57 -0
- data/redis/redis-2.2.11/src/aof.c +675 -0
- data/redis/redis-2.2.11/src/config.c +627 -0
- data/redis/redis-2.2.11/src/config.h +64 -0
- data/redis/redis-2.2.11/src/db.c +543 -0
- data/redis/redis-2.2.11/src/debug.c +314 -0
- data/redis/redis-2.2.11/src/dict.c +721 -0
- data/redis/redis-2.2.11/src/dict.h +156 -0
- data/redis/redis-2.2.11/src/fmacros.h +15 -0
- data/redis/redis-2.2.11/src/help.h +638 -0
- data/redis/redis-2.2.11/src/intset.c +422 -0
- data/redis/redis-2.2.11/src/intset.h +19 -0
- data/redis/redis-2.2.11/src/lzf.h +100 -0
- data/redis/redis-2.2.11/src/lzfP.h +159 -0
- data/redis/redis-2.2.11/src/lzf_c.c +295 -0
- data/redis/redis-2.2.11/src/lzf_d.c +150 -0
- data/redis/redis-2.2.11/src/mkreleasehdr.sh +9 -0
- data/redis/redis-2.2.11/src/multi.c +268 -0
- data/redis/redis-2.2.11/src/networking.c +899 -0
- data/redis/redis-2.2.11/src/object.c +484 -0
- data/redis/redis-2.2.11/src/pqsort.c +197 -0
- data/redis/redis-2.2.11/src/pqsort.h +15 -0
- data/redis/redis-2.2.11/src/pubsub.c +267 -0
- data/redis/redis-2.2.11/src/rdb.c +1020 -0
- data/redis/redis-2.2.11/src/redis-benchmark.c +530 -0
- data/redis/redis-2.2.11/src/redis-check-aof.c +185 -0
- data/redis/redis-2.2.11/src/redis-check-dump.c +681 -0
- data/redis/redis-2.2.11/src/redis-cli.c +773 -0
- data/redis/redis-2.2.11/src/redis.c +1677 -0
- data/redis/redis-2.2.11/src/redis.h +1022 -0
- data/redis/redis-2.2.11/src/release.c +13 -0
- data/redis/redis-2.2.11/src/replication.c +557 -0
- data/redis/redis-2.2.11/src/sds.c +639 -0
- data/redis/redis-2.2.11/src/sds.h +78 -0
- data/redis/redis-2.2.11/src/sha1.c +276 -0
- data/redis/redis-2.2.11/src/sha1.h +17 -0
- data/redis/redis-2.2.11/src/solarisfixes.h +22 -0
- data/redis/redis-2.2.11/src/sort.c +389 -0
- data/redis/redis-2.2.11/src/syncio.c +154 -0
- data/redis/redis-2.2.11/src/t_hash.c +476 -0
- data/redis/redis-2.2.11/src/t_list.c +986 -0
- data/redis/redis-2.2.11/src/t_set.c +610 -0
- data/redis/redis-2.2.11/src/t_string.c +438 -0
- data/redis/redis-2.2.11/src/t_zset.c +1084 -0
- data/redis/redis-2.2.11/src/testhelp.h +54 -0
- data/redis/redis-2.2.11/src/util.c +243 -0
- data/redis/redis-2.2.11/src/valgrind.sup +5 -0
- data/redis/redis-2.2.11/src/version.h +1 -0
- data/redis/redis-2.2.11/src/vm.c +1149 -0
- data/redis/redis-2.2.11/src/ziplist.c +1323 -0
- data/redis/redis-2.2.11/src/ziplist.h +15 -0
- data/redis/redis-2.2.11/src/zipmap.c +455 -0
- data/redis/redis-2.2.11/src/zipmap.h +48 -0
- data/redis/redis-2.2.11/src/zmalloc.c +278 -0
- data/redis/redis-2.2.11/src/zmalloc.h +47 -0
- data/redis/redis-2.2.11/tests/assets/default.conf +308 -0
- data/redis/redis-2.2.11/tests/integration/aof.tcl +104 -0
- data/redis/redis-2.2.11/tests/integration/redis-cli.tcl +208 -0
- data/redis/redis-2.2.11/tests/integration/replication.tcl +98 -0
- data/redis/redis-2.2.11/tests/support/redis.tcl +241 -0
- data/redis/redis-2.2.11/tests/support/server.tcl +294 -0
- data/redis/redis-2.2.11/tests/support/test.tcl +190 -0
- data/redis/redis-2.2.11/tests/support/tmpfile.tcl +15 -0
- data/redis/redis-2.2.11/tests/support/util.tcl +296 -0
- data/redis/redis-2.2.11/tests/test_helper.tcl +221 -0
- data/redis/redis-2.2.11/tests/unit/auth.tcl +15 -0
- data/redis/redis-2.2.11/tests/unit/basic.tcl +616 -0
- data/redis/redis-2.2.11/tests/unit/cas.tcl +135 -0
- data/redis/redis-2.2.11/tests/unit/expire.tcl +74 -0
- data/redis/redis-2.2.11/tests/unit/other.tcl +240 -0
- data/redis/redis-2.2.11/tests/unit/printver.tcl +6 -0
- data/redis/redis-2.2.11/tests/unit/protocol.tcl +62 -0
- data/redis/redis-2.2.11/tests/unit/pubsub.tcl +195 -0
- data/redis/redis-2.2.11/tests/unit/quit.tcl +40 -0
- data/redis/redis-2.2.11/tests/unit/sort.tcl +189 -0
- data/redis/redis-2.2.11/tests/unit/type/hash.tcl +300 -0
- data/redis/redis-2.2.11/tests/unit/type/list.tcl +819 -0
- data/redis/redis-2.2.11/tests/unit/type/set.tcl +334 -0
- data/redis/redis-2.2.11/tests/unit/type/zset.tcl +587 -0
- data/redis/redis-2.2.11/utils/build-static-symbols.tcl +22 -0
- data/redis/redis-2.2.11/utils/generate-command-help.rb +112 -0
- data/redis/redis-2.2.11/utils/mktarball.sh +13 -0
- data/redis/redis-2.2.11/utils/redis-copy.rb +78 -0
- data/redis/redis-2.2.11/utils/redis-sha1.rb +52 -0
- data/redis/redis-2.2.11/utils/redis_init_script +42 -0
- 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
|
+
}
|