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,294 @@
|
|
1
|
+
set ::global_overrides {}
|
2
|
+
set ::tags {}
|
3
|
+
|
4
|
+
proc error_and_quit {config_file error} {
|
5
|
+
puts "!!COULD NOT START REDIS-SERVER\n"
|
6
|
+
puts "CONFIGURATION:"
|
7
|
+
puts [exec cat $config_file]
|
8
|
+
puts "\nERROR:"
|
9
|
+
puts [string trim $error]
|
10
|
+
exit 1
|
11
|
+
}
|
12
|
+
|
13
|
+
proc check_valgrind_errors stderr {
|
14
|
+
set fd [open $stderr]
|
15
|
+
set buf [read $fd]
|
16
|
+
close $fd
|
17
|
+
|
18
|
+
if {![regexp -- {ERROR SUMMARY: 0 errors} $buf] ||
|
19
|
+
![regexp -- {definitely lost: 0 bytes} $buf]} {
|
20
|
+
puts "*** VALGRIND ERRORS ***"
|
21
|
+
puts $buf
|
22
|
+
puts "--- press enter to continue ---"
|
23
|
+
gets stdin
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
proc kill_server config {
|
28
|
+
# nothing to kill when running against external server
|
29
|
+
if {$::external} return
|
30
|
+
|
31
|
+
# nevermind if its already dead
|
32
|
+
if {![is_alive $config]} { return }
|
33
|
+
set pid [dict get $config pid]
|
34
|
+
|
35
|
+
# check for leaks
|
36
|
+
if {![dict exists $config "skipleaks"]} {
|
37
|
+
catch {
|
38
|
+
if {[string match {*Darwin*} [exec uname -a]]} {
|
39
|
+
tags {"leaks"} {
|
40
|
+
test "Check for memory leaks (pid $pid)" {
|
41
|
+
exec leaks $pid
|
42
|
+
} {*0 leaks*}
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
# kill server and wait for the process to be totally exited
|
49
|
+
while {[is_alive $config]} {
|
50
|
+
if {[incr wait 10] % 1000 == 0} {
|
51
|
+
puts "Waiting for process $pid to exit..."
|
52
|
+
}
|
53
|
+
catch {exec kill $pid}
|
54
|
+
after 10
|
55
|
+
}
|
56
|
+
|
57
|
+
# Check valgrind errors if needed
|
58
|
+
if {$::valgrind} {
|
59
|
+
check_valgrind_errors [dict get $config stderr]
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
proc is_alive config {
|
64
|
+
set pid [dict get $config pid]
|
65
|
+
if {[catch {exec ps -p $pid} err]} {
|
66
|
+
return 0
|
67
|
+
} else {
|
68
|
+
return 1
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
proc ping_server {host port} {
|
73
|
+
set retval 0
|
74
|
+
if {[catch {
|
75
|
+
set fd [socket $::host $::port]
|
76
|
+
fconfigure $fd -translation binary
|
77
|
+
puts $fd "PING\r\n"
|
78
|
+
flush $fd
|
79
|
+
set reply [gets $fd]
|
80
|
+
if {[string range $reply 0 4] eq {+PONG} ||
|
81
|
+
[string range $reply 0 3] eq {-ERR}} {
|
82
|
+
set retval 1
|
83
|
+
}
|
84
|
+
close $fd
|
85
|
+
} e]} {
|
86
|
+
if {$::verbose} {
|
87
|
+
puts -nonewline "."
|
88
|
+
}
|
89
|
+
} else {
|
90
|
+
if {$::verbose} {
|
91
|
+
puts -nonewline "ok"
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return $retval
|
95
|
+
}
|
96
|
+
|
97
|
+
# doesn't really belong here, but highly coupled to code in start_server
|
98
|
+
proc tags {tags code} {
|
99
|
+
set ::tags [concat $::tags $tags]
|
100
|
+
uplevel 1 $code
|
101
|
+
set ::tags [lrange $::tags 0 end-[llength $tags]]
|
102
|
+
}
|
103
|
+
|
104
|
+
proc start_server {options {code undefined}} {
|
105
|
+
# If we are runnign against an external server, we just push the
|
106
|
+
# host/port pair in the stack the first time
|
107
|
+
if {$::external} {
|
108
|
+
if {[llength $::servers] == 0} {
|
109
|
+
set srv {}
|
110
|
+
dict set srv "host" $::host
|
111
|
+
dict set srv "port" $::port
|
112
|
+
set client [redis $::host $::port]
|
113
|
+
dict set srv "client" $client
|
114
|
+
$client select 9
|
115
|
+
|
116
|
+
# append the server to the stack
|
117
|
+
lappend ::servers $srv
|
118
|
+
}
|
119
|
+
uplevel 1 $code
|
120
|
+
return
|
121
|
+
}
|
122
|
+
|
123
|
+
# setup defaults
|
124
|
+
set baseconfig "default.conf"
|
125
|
+
set overrides {}
|
126
|
+
set tags {}
|
127
|
+
|
128
|
+
# parse options
|
129
|
+
foreach {option value} $options {
|
130
|
+
switch $option {
|
131
|
+
"config" {
|
132
|
+
set baseconfig $value }
|
133
|
+
"overrides" {
|
134
|
+
set overrides $value }
|
135
|
+
"tags" {
|
136
|
+
set tags $value
|
137
|
+
set ::tags [concat $::tags $value] }
|
138
|
+
default {
|
139
|
+
error "Unknown option $option" }
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
set data [split [exec cat "tests/assets/$baseconfig"] "\n"]
|
144
|
+
set config {}
|
145
|
+
foreach line $data {
|
146
|
+
if {[string length $line] > 0 && [string index $line 0] ne "#"} {
|
147
|
+
set elements [split $line " "]
|
148
|
+
set directive [lrange $elements 0 0]
|
149
|
+
set arguments [lrange $elements 1 end]
|
150
|
+
dict set config $directive $arguments
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
# use a different directory every time a server is started
|
155
|
+
dict set config dir [tmpdir server]
|
156
|
+
|
157
|
+
# start every server on a different port
|
158
|
+
dict set config port [incr ::port]
|
159
|
+
|
160
|
+
# apply overrides from global space and arguments
|
161
|
+
foreach {directive arguments} [concat $::global_overrides $overrides] {
|
162
|
+
dict set config $directive $arguments
|
163
|
+
}
|
164
|
+
|
165
|
+
# write new configuration to temporary file
|
166
|
+
set config_file [tmpfile redis.conf]
|
167
|
+
set fp [open $config_file w+]
|
168
|
+
foreach directive [dict keys $config] {
|
169
|
+
puts -nonewline $fp "$directive "
|
170
|
+
puts $fp [dict get $config $directive]
|
171
|
+
}
|
172
|
+
close $fp
|
173
|
+
|
174
|
+
set stdout [format "%s/%s" [dict get $config "dir"] "stdout"]
|
175
|
+
set stderr [format "%s/%s" [dict get $config "dir"] "stderr"]
|
176
|
+
|
177
|
+
if {$::valgrind} {
|
178
|
+
exec valgrind --suppressions=src/valgrind.sup src/redis-server $config_file > $stdout 2> $stderr &
|
179
|
+
} else {
|
180
|
+
exec src/redis-server $config_file > $stdout 2> $stderr &
|
181
|
+
}
|
182
|
+
|
183
|
+
# check that the server actually started
|
184
|
+
# ugly but tries to be as fast as possible...
|
185
|
+
set retrynum 20
|
186
|
+
set serverisup 0
|
187
|
+
|
188
|
+
if {$::verbose} {
|
189
|
+
puts -nonewline "=== ($tags) Starting server ${::host}:${::port} "
|
190
|
+
}
|
191
|
+
|
192
|
+
after 10
|
193
|
+
if {$code ne "undefined"} {
|
194
|
+
while {[incr retrynum -1]} {
|
195
|
+
catch {
|
196
|
+
if {[ping_server $::host $::port]} {
|
197
|
+
set serverisup 1
|
198
|
+
}
|
199
|
+
}
|
200
|
+
if {$serverisup} break
|
201
|
+
after 50
|
202
|
+
}
|
203
|
+
} else {
|
204
|
+
set serverisup 1
|
205
|
+
}
|
206
|
+
|
207
|
+
if {$::verbose} {
|
208
|
+
puts ""
|
209
|
+
}
|
210
|
+
|
211
|
+
if {!$serverisup} {
|
212
|
+
error_and_quit $config_file [exec cat $stderr]
|
213
|
+
}
|
214
|
+
|
215
|
+
# find out the pid
|
216
|
+
while {![info exists pid]} {
|
217
|
+
regexp {^\[(\d+)\]} [exec head -n1 $stdout] _ pid
|
218
|
+
after 100
|
219
|
+
}
|
220
|
+
|
221
|
+
# setup properties to be able to initialize a client object
|
222
|
+
set host $::host
|
223
|
+
set port $::port
|
224
|
+
if {[dict exists $config bind]} { set host [dict get $config bind] }
|
225
|
+
if {[dict exists $config port]} { set port [dict get $config port] }
|
226
|
+
|
227
|
+
# setup config dict
|
228
|
+
dict set srv "config_file" $config_file
|
229
|
+
dict set srv "config" $config
|
230
|
+
dict set srv "pid" $pid
|
231
|
+
dict set srv "host" $host
|
232
|
+
dict set srv "port" $port
|
233
|
+
dict set srv "stdout" $stdout
|
234
|
+
dict set srv "stderr" $stderr
|
235
|
+
|
236
|
+
# if a block of code is supplied, we wait for the server to become
|
237
|
+
# available, create a client object and kill the server afterwards
|
238
|
+
if {$code ne "undefined"} {
|
239
|
+
set line [exec head -n1 $stdout]
|
240
|
+
if {[string match {*already in use*} $line]} {
|
241
|
+
error_and_quit $config_file $line
|
242
|
+
}
|
243
|
+
|
244
|
+
while 1 {
|
245
|
+
# check that the server actually started and is ready for connections
|
246
|
+
if {[exec cat $stdout | grep "ready to accept" | wc -l] > 0} {
|
247
|
+
break
|
248
|
+
}
|
249
|
+
after 10
|
250
|
+
}
|
251
|
+
|
252
|
+
# append the server to the stack
|
253
|
+
lappend ::servers $srv
|
254
|
+
|
255
|
+
# connect client (after server dict is put on the stack)
|
256
|
+
reconnect
|
257
|
+
|
258
|
+
# execute provided block
|
259
|
+
set num_tests $::num_tests
|
260
|
+
if {[catch { uplevel 1 $code } error]} {
|
261
|
+
set backtrace $::errorInfo
|
262
|
+
|
263
|
+
# Kill the server without checking for leaks
|
264
|
+
dict set srv "skipleaks" 1
|
265
|
+
kill_server $srv
|
266
|
+
|
267
|
+
# Print warnings from log
|
268
|
+
puts [format "\nLogged warnings (pid %d):" [dict get $srv "pid"]]
|
269
|
+
set warnings [warnings_from_file [dict get $srv "stdout"]]
|
270
|
+
if {[string length $warnings] > 0} {
|
271
|
+
puts "$warnings"
|
272
|
+
} else {
|
273
|
+
puts "(none)"
|
274
|
+
}
|
275
|
+
puts ""
|
276
|
+
|
277
|
+
error $error $backtrace
|
278
|
+
}
|
279
|
+
|
280
|
+
# Don't do the leak check when no tests were run
|
281
|
+
if {$num_tests == $::num_tests} {
|
282
|
+
dict set srv "skipleaks" 1
|
283
|
+
}
|
284
|
+
|
285
|
+
# pop the server object
|
286
|
+
set ::servers [lrange $::servers 0 end-1]
|
287
|
+
|
288
|
+
set ::tags [lrange $::tags 0 end-[llength $tags]]
|
289
|
+
kill_server $srv
|
290
|
+
} else {
|
291
|
+
set ::tags [lrange $::tags 0 end-[llength $tags]]
|
292
|
+
set _ $srv
|
293
|
+
}
|
294
|
+
}
|
@@ -0,0 +1,190 @@
|
|
1
|
+
set ::num_tests 0
|
2
|
+
set ::num_passed 0
|
3
|
+
set ::num_failed 0
|
4
|
+
set ::tests_failed {}
|
5
|
+
|
6
|
+
proc assert {condition} {
|
7
|
+
if {![uplevel 1 expr $condition]} {
|
8
|
+
error "assertion:Expected '$value' to be true"
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
proc assert_match {pattern value} {
|
13
|
+
if {![string match $pattern $value]} {
|
14
|
+
error "assertion:Expected '$value' to match '$pattern'"
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
proc assert_equal {expected value} {
|
19
|
+
if {$expected ne $value} {
|
20
|
+
error "assertion:Expected '$value' to be equal to '$expected'"
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
proc assert_error {pattern code} {
|
25
|
+
if {[catch {uplevel 1 $code} error]} {
|
26
|
+
assert_match $pattern $error
|
27
|
+
} else {
|
28
|
+
error "assertion:Expected an error but nothing was catched"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
proc assert_encoding {enc key} {
|
33
|
+
# Swapped out values don't have an encoding, so make sure that
|
34
|
+
# the value is swapped in before checking the encoding.
|
35
|
+
set dbg [r debug object $key]
|
36
|
+
while {[string match "* swapped at:*" $dbg]} {
|
37
|
+
r debug swapin $key
|
38
|
+
set dbg [r debug object $key]
|
39
|
+
}
|
40
|
+
assert_match "* encoding:$enc *" $dbg
|
41
|
+
}
|
42
|
+
|
43
|
+
proc assert_type {type key} {
|
44
|
+
assert_equal $type [r type $key]
|
45
|
+
}
|
46
|
+
|
47
|
+
# Test if TERM looks like to support colors
|
48
|
+
proc color_term {} {
|
49
|
+
expr {[info exists ::env(TERM)] && [string match *xterm* $::env(TERM)]}
|
50
|
+
}
|
51
|
+
|
52
|
+
# This is called before starting the test
|
53
|
+
proc announce_test {s} {
|
54
|
+
if {[color_term]} {
|
55
|
+
puts -nonewline "$s\033\[0K"
|
56
|
+
flush stdout
|
57
|
+
set ::backward_count [string length $s]
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
# This is called after the test finished
|
62
|
+
proc colored_dot {tags passed} {
|
63
|
+
if {[color_term]} {
|
64
|
+
# Go backward and delete what announc_test function printed.
|
65
|
+
puts -nonewline "\033\[${::backward_count}D\033\[0K\033\[J"
|
66
|
+
|
67
|
+
# Print a coloured char, accordingly to test outcome and tags.
|
68
|
+
if {[lsearch $tags list] != -1} {
|
69
|
+
set colorcode {31}
|
70
|
+
set ch L
|
71
|
+
} elseif {[lsearch $tags hash] != -1} {
|
72
|
+
set colorcode {32}
|
73
|
+
set ch H
|
74
|
+
} elseif {[lsearch $tags set] != -1} {
|
75
|
+
set colorcode {33}
|
76
|
+
set ch S
|
77
|
+
} elseif {[lsearch $tags zset] != -1} {
|
78
|
+
set colorcode {34}
|
79
|
+
set ch Z
|
80
|
+
} elseif {[lsearch $tags basic] != -1} {
|
81
|
+
set colorcode {35}
|
82
|
+
set ch B
|
83
|
+
} else {
|
84
|
+
set colorcode {37}
|
85
|
+
set ch .
|
86
|
+
}
|
87
|
+
if {$colorcode ne {}} {
|
88
|
+
if {$passed} {
|
89
|
+
puts -nonewline "\033\[0;${colorcode};40m"
|
90
|
+
} else {
|
91
|
+
puts -nonewline "\033\[7;${colorcode};40m"
|
92
|
+
}
|
93
|
+
puts -nonewline $ch
|
94
|
+
puts -nonewline "\033\[0m"
|
95
|
+
flush stdout
|
96
|
+
}
|
97
|
+
} else {
|
98
|
+
if {$passed} {
|
99
|
+
puts -nonewline .
|
100
|
+
} else {
|
101
|
+
puts -nonewline F
|
102
|
+
}
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
proc test {name code {okpattern undefined}} {
|
107
|
+
# abort if tagged with a tag to deny
|
108
|
+
foreach tag $::denytags {
|
109
|
+
if {[lsearch $::tags $tag] >= 0} {
|
110
|
+
return
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
# check if tagged with at least 1 tag to allow when there *is* a list
|
115
|
+
# of tags to allow, because default policy is to run everything
|
116
|
+
if {[llength $::allowtags] > 0} {
|
117
|
+
set matched 0
|
118
|
+
foreach tag $::allowtags {
|
119
|
+
if {[lsearch $::tags $tag] >= 0} {
|
120
|
+
incr matched
|
121
|
+
}
|
122
|
+
}
|
123
|
+
if {$matched < 1} {
|
124
|
+
return
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
incr ::num_tests
|
129
|
+
set details {}
|
130
|
+
lappend details $::curfile
|
131
|
+
lappend details $::tags
|
132
|
+
lappend details $name
|
133
|
+
|
134
|
+
if {$::verbose} {
|
135
|
+
puts -nonewline [format "#%03d %-68s " $::num_tests $name]
|
136
|
+
flush stdout
|
137
|
+
} else {
|
138
|
+
announce_test $name
|
139
|
+
}
|
140
|
+
|
141
|
+
if {[catch {set retval [uplevel 1 $code]} error]} {
|
142
|
+
if {[string match "assertion:*" $error]} {
|
143
|
+
set msg [string range $error 10 end]
|
144
|
+
lappend details $msg
|
145
|
+
lappend ::tests_failed $details
|
146
|
+
|
147
|
+
incr ::num_failed
|
148
|
+
if {$::verbose} {
|
149
|
+
puts "FAILED"
|
150
|
+
puts "$msg\n"
|
151
|
+
} else {
|
152
|
+
colored_dot $::tags 0
|
153
|
+
}
|
154
|
+
} else {
|
155
|
+
# Re-raise, let handler up the stack take care of this.
|
156
|
+
error $error $::errorInfo
|
157
|
+
}
|
158
|
+
} else {
|
159
|
+
if {$okpattern eq "undefined" || $okpattern eq $retval || [string match $okpattern $retval]} {
|
160
|
+
incr ::num_passed
|
161
|
+
if {$::verbose} {
|
162
|
+
puts "PASSED"
|
163
|
+
} else {
|
164
|
+
colored_dot $::tags 1
|
165
|
+
}
|
166
|
+
} else {
|
167
|
+
set msg "Expected '$okpattern' to equal or match '$retval'"
|
168
|
+
lappend details $msg
|
169
|
+
lappend ::tests_failed $details
|
170
|
+
|
171
|
+
incr ::num_failed
|
172
|
+
if {$::verbose} {
|
173
|
+
puts "FAILED"
|
174
|
+
puts "$msg\n"
|
175
|
+
} else {
|
176
|
+
colored_dot $::tags 0
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
|
+
flush stdout
|
181
|
+
|
182
|
+
if {$::traceleaks} {
|
183
|
+
set output [exec leaks redis-server]
|
184
|
+
if {![string match {*0 leaks*} $output]} {
|
185
|
+
puts "--- Test \"$name\" leaked! ---"
|
186
|
+
puts $output
|
187
|
+
exit 1
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|