memcached 1.2.6 → 1.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +206 -12
- data/Rakefile +32 -1
- data/ext/extconf.rb +10 -35
- data/ext/libmemcached-0.32/AUTHORS +7 -0
- data/ext/libmemcached-0.32/COPYING +32 -0
- data/ext/libmemcached-0.32/ChangeLog +303 -0
- data/ext/libmemcached-0.32/INSTALL +302 -0
- data/ext/libmemcached-0.32/Makefile.am +36 -0
- data/ext/libmemcached-0.32/Makefile.in +828 -0
- data/ext/libmemcached-0.32/NEWS +1 -0
- data/ext/libmemcached-0.32/README +33 -0
- data/ext/libmemcached-0.32/THANKS +14 -0
- data/ext/libmemcached-0.32/TODO +11 -0
- data/ext/libmemcached-0.32/aclocal.m4 +1852 -0
- data/ext/libmemcached-0.32/clients/Makefile.am +73 -0
- data/ext/libmemcached-0.32/clients/Makefile.in +770 -0
- data/ext/libmemcached-0.32/clients/client_options.h +32 -0
- data/ext/libmemcached-0.32/clients/execute.c +64 -0
- data/ext/libmemcached-0.32/clients/execute.h +5 -0
- data/ext/libmemcached-0.32/clients/generator.c +74 -0
- data/ext/libmemcached-0.32/clients/generator.h +20 -0
- data/ext/libmemcached-0.32/clients/memcat.c +178 -0
- data/ext/libmemcached-0.32/clients/memcp.c +251 -0
- data/ext/libmemcached-0.32/clients/memdump.c +170 -0
- data/ext/libmemcached-0.32/clients/memerror.c +80 -0
- data/ext/libmemcached-0.32/clients/memflush.c +143 -0
- data/ext/libmemcached-0.32/clients/memrm.c +160 -0
- data/ext/libmemcached-0.32/clients/memslap.c +441 -0
- data/ext/libmemcached-0.32/clients/memstat.c +326 -0
- data/ext/libmemcached-0.32/clients/utilities.c +207 -0
- data/ext/libmemcached-0.32/clients/utilities.h +41 -0
- data/ext/libmemcached-0.32/config.h.in +252 -0
- data/ext/libmemcached-0.32/config/compile +143 -0
- data/ext/libmemcached-0.32/config/config.guess +1561 -0
- data/ext/libmemcached-0.32/config/config.rpath +666 -0
- data/ext/libmemcached-0.32/config/config.sub +1686 -0
- data/ext/libmemcached-0.32/config/depcomp +630 -0
- data/ext/libmemcached-0.32/config/install-sh +520 -0
- data/ext/libmemcached-0.32/config/ltmain.sh +8406 -0
- data/ext/libmemcached-0.32/config/missing +376 -0
- data/ext/libmemcached-0.32/configure +23048 -0
- data/ext/libmemcached-0.32/configure.ac +122 -0
- data/ext/libmemcached-0.32/docs/Makefile.am +415 -0
- data/ext/libmemcached-0.32/docs/Makefile.in +918 -0
- data/ext/libmemcached-0.32/docs/libmemcached.pod +123 -0
- data/ext/libmemcached-0.32/docs/libmemcached_examples.pod +115 -0
- data/ext/libmemcached-0.32/docs/libmemcachedutil.pod +40 -0
- data/ext/libmemcached-0.32/docs/memcached_analyze.pod +52 -0
- data/ext/libmemcached-0.32/docs/memcached_auto.pod +97 -0
- data/ext/libmemcached-0.32/docs/memcached_behavior.pod +224 -0
- data/ext/libmemcached-0.32/docs/memcached_callback.pod +123 -0
- data/ext/libmemcached-0.32/docs/memcached_create.pod +61 -0
- data/ext/libmemcached-0.32/docs/memcached_delete.pod +54 -0
- data/ext/libmemcached-0.32/docs/memcached_dump.pod +53 -0
- data/ext/libmemcached-0.32/docs/memcached_flush.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_flush_buffers.pod +42 -0
- data/ext/libmemcached-0.32/docs/memcached_generate_hash_value.pod +57 -0
- data/ext/libmemcached-0.32/docs/memcached_get.pod +161 -0
- data/ext/libmemcached-0.32/docs/memcached_memory_allocators.pod +73 -0
- data/ext/libmemcached-0.32/docs/memcached_pool.pod +77 -0
- data/ext/libmemcached-0.32/docs/memcached_quit.pod +47 -0
- data/ext/libmemcached-0.32/docs/memcached_sasl.pod +63 -0
- data/ext/libmemcached-0.32/docs/memcached_server_st.pod +75 -0
- data/ext/libmemcached-0.32/docs/memcached_servers.pod +102 -0
- data/ext/libmemcached-0.32/docs/memcached_set.pod +187 -0
- data/ext/libmemcached-0.32/docs/memcached_stats.pod +82 -0
- data/ext/libmemcached-0.32/docs/memcached_strerror.pod +46 -0
- data/ext/libmemcached-0.32/docs/memcached_user_data.pod +49 -0
- data/ext/libmemcached-0.32/docs/memcached_verbosity.pod +41 -0
- data/ext/libmemcached-0.32/docs/memcached_version.pod +56 -0
- data/ext/libmemcached-0.32/docs/memcat.pod +37 -0
- data/ext/libmemcached-0.32/docs/memcp.pod +40 -0
- data/ext/libmemcached-0.32/docs/memdump.pod +31 -0
- data/ext/libmemcached-0.32/docs/memerror.pod +30 -0
- data/ext/libmemcached-0.32/docs/memflush.pod +35 -0
- data/ext/libmemcached-0.32/docs/memrm.pod +34 -0
- data/ext/libmemcached-0.32/docs/memslap.pod +33 -0
- data/ext/libmemcached-0.32/docs/memstat.pod +35 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.am +107 -0
- data/ext/libmemcached-0.32/libmemcached/Makefile.in +1050 -0
- data/ext/libmemcached-0.32/libmemcached/byteorder.c +31 -0
- data/ext/libmemcached-0.32/libmemcached/common.h +183 -0
- data/ext/libmemcached-0.32/libmemcached/crc.c +86 -0
- data/ext/libmemcached-0.32/libmemcached/hsieh_hash.c +68 -0
- data/ext/libmemcached-0.32/libmemcached/jenkins_hash.c +213 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached.ver +1 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.d +28 -0
- data/ext/libmemcached-0.32/libmemcached/libmemcached_probes.h +78 -0
- data/ext/libmemcached-0.32/libmemcached/md5.c +354 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.c +152 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.h +302 -0
- data/ext/libmemcached-0.32/libmemcached/memcached.hpp +799 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/README.txt +7 -0
- data/ext/libmemcached-0.32/libmemcached/memcached/protocol_binary.h +366 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_allocators.c +72 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_analyze.c +100 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_auto.c +207 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_behavior.c +285 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_callback.c +175 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_configure.h.in +23 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_connect.c +361 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_constants.h +145 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_delete.c +0 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_do.c +34 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_dump.c +79 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_fetch.c +102 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush.c +89 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_flush_buffers.c +22 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.c +495 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_get.h +87 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hash.c +252 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_hosts.c +510 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_internal.h +31 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.c +547 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_io.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_key.c +28 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_parse.c +74 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_pool.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_purge.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_quit.c +75 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_response.c +528 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.c +57 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_result.h +59 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.c +225 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_sasl.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.c +159 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_server.h +93 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_stats.c +454 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.c +514 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_storage.h +107 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_strerror.c +92 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.c +138 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_string.h +53 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_types.h +44 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_util.h +15 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_verbosity.c +36 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_version.c +112 -0
- data/ext/libmemcached-0.32/libmemcached/memcached_watchpoint.h +38 -0
- data/ext/libmemcached-0.32/libmemcached/murmur_hash.c +76 -0
- data/ext/libmemcached-0.32/libmemcached/visibility.h +51 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.am +11 -0
- data/ext/libmemcached-0.32/libmemcachedutil/Makefile.in +602 -0
- data/ext/libmemcached-0.32/libmemcachedutil/libmemcachedutil.ver +1 -0
- data/ext/libmemcached-0.32/libmemcachedutil/memcached_pool.c +170 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_compile_stdcxx_0x.m4 +103 -0
- data/ext/libmemcached-0.32/m4/ac_cxx_header_stdcxx_98.m4 +67 -0
- data/ext/libmemcached-0.32/m4/acx_pthread.m4 +276 -0
- data/ext/libmemcached-0.32/m4/byteorder.m4 +40 -0
- data/ext/libmemcached-0.32/m4/deprecated.m4 +17 -0
- data/ext/libmemcached-0.32/m4/enable_utillib.m4 +16 -0
- data/ext/libmemcached-0.32/m4/extensions.m4 +94 -0
- data/ext/libmemcached-0.32/m4/hsieh.m4 +18 -0
- data/ext/libmemcached-0.32/m4/lib-prefix.m4 +221 -0
- data/ext/libmemcached-0.32/m4/libtool.m4 +7360 -0
- data/ext/libmemcached-0.32/m4/ltoptions.m4 +368 -0
- data/ext/libmemcached-0.32/m4/ltsugar.m4 +123 -0
- data/ext/libmemcached-0.32/m4/ltversion.m4 +23 -0
- data/ext/libmemcached-0.32/m4/lt~obsolete.m4 +92 -0
- data/ext/libmemcached-0.32/m4/memcached.m4 +30 -0
- data/ext/libmemcached-0.32/m4/pandora_64bit.m4 +55 -0
- data/ext/libmemcached-0.32/m4/pandora_canonical.m4 +151 -0
- data/ext/libmemcached-0.32/m4/pandora_check_compiler_version.m4 +37 -0
- data/ext/libmemcached-0.32/m4/pandora_check_cxx_standard.m4 +16 -0
- data/ext/libmemcached-0.32/m4/pandora_enable_dtrace.m4 +41 -0
- data/ext/libmemcached-0.32/m4/pandora_ensure_gcc_version.m4 +36 -0
- data/ext/libmemcached-0.32/m4/pandora_have_better_malloc.m4 +54 -0
- data/ext/libmemcached-0.32/m4/pandora_have_sasl.m4 +133 -0
- data/ext/libmemcached-0.32/m4/pandora_header_assert.m4 +23 -0
- data/ext/libmemcached-0.32/m4/pandora_libtool.m4 +15 -0
- data/ext/libmemcached-0.32/m4/pandora_optimize.m4 +79 -0
- data/ext/libmemcached-0.32/m4/pandora_shared_ptr.m4 +56 -0
- data/ext/libmemcached-0.32/m4/pandora_vc_build.m4 +32 -0
- data/ext/libmemcached-0.32/m4/pandora_warnings.m4 +262 -0
- data/ext/libmemcached-0.32/m4/pod2man.m4 +7 -0
- data/ext/libmemcached-0.32/m4/protocol_binary.m4 +23 -0
- data/ext/libmemcached-0.32/m4/setsockopt.m4 +57 -0
- data/ext/libmemcached-0.32/m4/visibility.m4 +52 -0
- data/ext/libmemcached-0.32/support/Makefile.am +4 -0
- data/ext/libmemcached-0.32/support/Makefile.in +485 -0
- data/ext/libmemcached-0.32/support/libmemcached-fc.spec.in +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.pc.in +10 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec +105 -0
- data/ext/libmemcached-0.32/support/libmemcached.spec.in +105 -0
- data/ext/libmemcached-0.32/support/set_benchmark.sh +5 -0
- data/ext/libmemcached-0.32/tests/Makefile.am +105 -0
- data/ext/libmemcached-0.32/tests/Makefile.in +748 -0
- data/ext/libmemcached-0.32/tests/atomsmasher.c +245 -0
- data/ext/libmemcached-0.32/tests/function.c +4781 -0
- data/ext/libmemcached-0.32/tests/ketama_test_cases.h +108 -0
- data/ext/libmemcached-0.32/tests/output.cmp +7 -0
- data/ext/libmemcached-0.32/tests/output.res +7 -0
- data/ext/libmemcached-0.32/tests/output2.res +46 -0
- data/ext/libmemcached-0.32/tests/plus.cpp +293 -0
- data/ext/libmemcached-0.32/tests/r/memcat.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memcp.res +27 -0
- data/ext/libmemcached-0.32/tests/r/memrm.res +19 -0
- data/ext/libmemcached-0.32/tests/r/memslap.res +33 -0
- data/ext/libmemcached-0.32/tests/r/memstat.res +33 -0
- data/ext/libmemcached-0.32/tests/server.c +118 -0
- data/ext/libmemcached-0.32/tests/server.h +25 -0
- data/ext/libmemcached-0.32/tests/start.c +16 -0
- data/ext/libmemcached-0.32/tests/t/memcat.test +4 -0
- data/ext/libmemcached-0.32/tests/t/memcp.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memrm.test +3 -0
- data/ext/libmemcached-0.32/tests/t/memslap.test +5 -0
- data/ext/libmemcached-0.32/tests/t/memstat.test +3 -0
- data/ext/libmemcached-0.32/tests/test.c +137 -0
- data/ext/libmemcached-0.32/tests/test.h +46 -0
- data/ext/libmemcached-0.32/tests/udp.c +76 -0
- data/memcached.gemspec +4 -4
- data/test/unit/memcached_test.rb +30 -0
- metadata +213 -16
- data/ext/libmemcached-0.32.tar.gz +0 -0
- data/ext/libmemcached-1.patch +0 -270
- data/ext/libmemcached-10.patch +0 -12
- data/ext/libmemcached-2.patch +0 -116
- data/ext/libmemcached-3.patch +0 -8
- data/ext/libmemcached-4.patch +0 -40
- data/ext/libmemcached-5.patch +0 -832
- data/ext/libmemcached-6.patch +0 -20
- data/ext/libmemcached-7.patch +0 -2989
- data/ext/libmemcached-8.patch +0 -137
- data/ext/libmemcached-9.patch +0 -13
- data/ext/sasl.patch +0 -29283
@@ -0,0 +1,19 @@
|
|
1
|
+
memcat v1.0
|
2
|
+
|
3
|
+
Cat a set of key values to stdout.
|
4
|
+
|
5
|
+
Current options. A '=' means the option takes a value.
|
6
|
+
|
7
|
+
--version
|
8
|
+
Display the version of the application and then exit.
|
9
|
+
--help
|
10
|
+
Diplay this message and then exit.
|
11
|
+
--verbose
|
12
|
+
Give more details on the progression of the application.
|
13
|
+
--debug
|
14
|
+
Provide output only useful for debugging.
|
15
|
+
--servers=
|
16
|
+
List which servers you wish to connect to.
|
17
|
+
--flag
|
18
|
+
Provide flag information for storage operation.
|
19
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
memcp v1.0
|
2
|
+
|
3
|
+
Copy a set of files to a memcached cluster.
|
4
|
+
|
5
|
+
Current options. A '=' means the option takes a value.
|
6
|
+
|
7
|
+
--version
|
8
|
+
Display the version of the application and then exit.
|
9
|
+
--help
|
10
|
+
Diplay this message and then exit.
|
11
|
+
--verbose
|
12
|
+
Give more details on the progression of the application.
|
13
|
+
--debug
|
14
|
+
Provide output only useful for debugging.
|
15
|
+
--servers=
|
16
|
+
List which servers you wish to connect to.
|
17
|
+
--flag=
|
18
|
+
Provide flag information for storage operation.
|
19
|
+
--expire=
|
20
|
+
Set the expire option for the object.
|
21
|
+
--set
|
22
|
+
Use set command with memcached when storing.
|
23
|
+
--add
|
24
|
+
Use add command with memcached when storing.
|
25
|
+
--replace
|
26
|
+
Use replace command with memcached when storing.
|
27
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
memrm v1.0
|
2
|
+
|
3
|
+
Erase a key or set of keys from a memcached cluster.
|
4
|
+
|
5
|
+
Current options. A '=' means the option takes a value.
|
6
|
+
|
7
|
+
--version
|
8
|
+
Display the version of the application and then exit.
|
9
|
+
--help
|
10
|
+
Diplay this message and then exit.
|
11
|
+
--verbose
|
12
|
+
Give more details on the progression of the application.
|
13
|
+
--debug
|
14
|
+
Provide output only useful for debugging.
|
15
|
+
--servers=
|
16
|
+
List which servers you wish to connect to.
|
17
|
+
--expire=
|
18
|
+
Set the expire option for the object.
|
19
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
memslap v1.0
|
2
|
+
|
3
|
+
Generates a load against a memcached custer of servers.
|
4
|
+
|
5
|
+
Current options. A '=' means the option takes a value.
|
6
|
+
|
7
|
+
--concurrency=
|
8
|
+
Number of users to simulate with load.
|
9
|
+
--debug
|
10
|
+
Provide output only useful for debugging.
|
11
|
+
--execute-number=
|
12
|
+
Number of times to execute the given test.
|
13
|
+
--flag
|
14
|
+
Provide flag information for storage operation.
|
15
|
+
--flush
|
16
|
+
Flush servers before running tests.
|
17
|
+
--help
|
18
|
+
Diplay this message and then exit.
|
19
|
+
--initial-load=
|
20
|
+
Number of key pairs to load before executing tests.
|
21
|
+
--non-blocking
|
22
|
+
Set TCP up to use non-blocking IO.
|
23
|
+
--servers=
|
24
|
+
List which servers you wish to connect to.
|
25
|
+
--tcp-nodelay
|
26
|
+
Set TCP socket up to use nodelay.
|
27
|
+
--test=
|
28
|
+
Test to run.
|
29
|
+
--verbose
|
30
|
+
Give more details on the progression of the application.
|
31
|
+
--version
|
32
|
+
Display the version of the application and then exit.
|
33
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
memslap v1.0
|
2
|
+
|
3
|
+
Generates a load against a memcached custer of servers.
|
4
|
+
|
5
|
+
Current options. A '=' means the option takes a value.
|
6
|
+
|
7
|
+
--concurrency=
|
8
|
+
Number of users to simulate with load.
|
9
|
+
--debug
|
10
|
+
Provide output only useful for debugging.
|
11
|
+
--execute-number=
|
12
|
+
Number of times to execute the given test.
|
13
|
+
--flag
|
14
|
+
Provide flag information for storage operation.
|
15
|
+
--flush
|
16
|
+
Flush servers before running tests.
|
17
|
+
--help
|
18
|
+
Diplay this message and then exit.
|
19
|
+
--initial-load=
|
20
|
+
Number of key pairs to load before executing tests.
|
21
|
+
--non-blocking
|
22
|
+
Set TCP up to use non-blocking IO.
|
23
|
+
--servers=
|
24
|
+
List which servers you wish to connect to.
|
25
|
+
--tcp-nodelay
|
26
|
+
Set TCP socket up to use nodelay.
|
27
|
+
--test=
|
28
|
+
Test to run.
|
29
|
+
--verbose
|
30
|
+
Give more details on the progression of the application.
|
31
|
+
--version
|
32
|
+
Display the version of the application and then exit.
|
33
|
+
|
@@ -0,0 +1,118 @@
|
|
1
|
+
/*
|
2
|
+
Startup, and shutdown the memcached servers.
|
3
|
+
*/
|
4
|
+
|
5
|
+
#define TEST_PORT_BASE MEMCACHED_DEFAULT_PORT+10
|
6
|
+
|
7
|
+
#include "config.h"
|
8
|
+
|
9
|
+
#include <stdio.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include <string.h>
|
12
|
+
#include <time.h>
|
13
|
+
#include <assert.h>
|
14
|
+
#include <signal.h>
|
15
|
+
#include <libmemcached/memcached.h>
|
16
|
+
#include <unistd.h>
|
17
|
+
#include "server.h"
|
18
|
+
|
19
|
+
void server_startup(server_startup_st *construct)
|
20
|
+
{
|
21
|
+
unsigned int x;
|
22
|
+
|
23
|
+
if ((construct->server_list= getenv("MEMCACHED_SERVERS")))
|
24
|
+
{
|
25
|
+
printf("servers %s\n", construct->server_list);
|
26
|
+
construct->servers= memcached_servers_parse(construct->server_list);
|
27
|
+
construct->server_list= NULL;
|
28
|
+
construct->count= 0;
|
29
|
+
}
|
30
|
+
else
|
31
|
+
{
|
32
|
+
{
|
33
|
+
char server_string_buffer[8096];
|
34
|
+
char *end_ptr;
|
35
|
+
end_ptr= server_string_buffer;
|
36
|
+
|
37
|
+
for (x= 0; x < construct->count; x++)
|
38
|
+
{
|
39
|
+
char buffer[1024]; /* Nothing special for number */
|
40
|
+
int count;
|
41
|
+
int status;
|
42
|
+
|
43
|
+
sprintf(buffer, "/tmp/%umemc.pid", x);
|
44
|
+
if (access(buffer, F_OK) == 0)
|
45
|
+
{
|
46
|
+
FILE *fp= fopen(buffer, "r");
|
47
|
+
remove(buffer);
|
48
|
+
|
49
|
+
if (fp != NULL)
|
50
|
+
{
|
51
|
+
if (fgets(buffer, sizeof(buffer), fp) != NULL)
|
52
|
+
{
|
53
|
+
pid_t pid = (pid_t)atol(buffer);
|
54
|
+
if (pid != 0)
|
55
|
+
kill(pid, SIGTERM);
|
56
|
+
}
|
57
|
+
|
58
|
+
fclose(fp);
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
if (x == 0)
|
63
|
+
{
|
64
|
+
sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u -m 128",
|
65
|
+
MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE);
|
66
|
+
}
|
67
|
+
else
|
68
|
+
{
|
69
|
+
sprintf(buffer, "%s -d -P /tmp/%umemc.pid -t 1 -p %u -U %u",
|
70
|
+
MEMCACHED_BINARY, x, x + TEST_PORT_BASE, x + TEST_PORT_BASE);
|
71
|
+
}
|
72
|
+
fprintf(stderr, "STARTING SERVER: %s\n", buffer);
|
73
|
+
status= system(buffer);
|
74
|
+
count= sprintf(end_ptr, "localhost:%u,", x + TEST_PORT_BASE);
|
75
|
+
end_ptr+= count;
|
76
|
+
}
|
77
|
+
*end_ptr= 0;
|
78
|
+
|
79
|
+
construct->server_list= strdup(server_string_buffer);
|
80
|
+
}
|
81
|
+
printf("servers %s\n", construct->server_list);
|
82
|
+
construct->servers= memcached_servers_parse(construct->server_list);
|
83
|
+
}
|
84
|
+
|
85
|
+
assert(construct->servers);
|
86
|
+
|
87
|
+
srandom((unsigned int)time(NULL));
|
88
|
+
|
89
|
+
for (x= 0; x < memcached_server_list_count(construct->servers); x++)
|
90
|
+
{
|
91
|
+
printf("\t%s : %u\n", construct->servers[x].hostname, construct->servers[x].port);
|
92
|
+
assert(construct->servers[x].fd == -1);
|
93
|
+
assert(construct->servers[x].cursor_active == 0);
|
94
|
+
}
|
95
|
+
|
96
|
+
printf("\n");
|
97
|
+
}
|
98
|
+
|
99
|
+
void server_shutdown(server_startup_st *construct)
|
100
|
+
{
|
101
|
+
unsigned int x;
|
102
|
+
|
103
|
+
if (construct->server_list)
|
104
|
+
{
|
105
|
+
for (x= 0; x < construct->count; x++)
|
106
|
+
{
|
107
|
+
char buffer[1024]; /* Nothing special for number */
|
108
|
+
sprintf(buffer, "cat /tmp/%umemc.pid | xargs kill", x);
|
109
|
+
/* We have to check the return value of this or the compiler will yell */
|
110
|
+
int sys_ret= system(buffer);
|
111
|
+
assert(sys_ret != -1);
|
112
|
+
sprintf(buffer, "/tmp/%umemc.pid", x);
|
113
|
+
unlink(buffer);
|
114
|
+
}
|
115
|
+
|
116
|
+
free(construct->server_list);
|
117
|
+
}
|
118
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/*
|
2
|
+
Server startup and shutdown functions.
|
3
|
+
*/
|
4
|
+
#ifdef __cplusplus
|
5
|
+
extern "C" {
|
6
|
+
#endif
|
7
|
+
|
8
|
+
#include <libmemcached/memcached.h>
|
9
|
+
|
10
|
+
typedef struct server_startup_st server_startup_st;
|
11
|
+
|
12
|
+
struct server_startup_st
|
13
|
+
{
|
14
|
+
uint8_t count;
|
15
|
+
uint8_t udp;
|
16
|
+
memcached_server_st *servers;
|
17
|
+
char *server_list;
|
18
|
+
};
|
19
|
+
|
20
|
+
void server_startup(server_startup_st *construct);
|
21
|
+
void server_shutdown(server_startup_st *construct);
|
22
|
+
|
23
|
+
#ifdef __cplusplus
|
24
|
+
}
|
25
|
+
#endif
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <string.h>
|
3
|
+
#include "server.h"
|
4
|
+
|
5
|
+
int main(void)
|
6
|
+
{
|
7
|
+
server_startup_st construct;
|
8
|
+
|
9
|
+
memset(&construct, 0, sizeof(server_startup_st));
|
10
|
+
|
11
|
+
construct.count= 4;
|
12
|
+
|
13
|
+
server_startup(&construct);
|
14
|
+
|
15
|
+
return 0;
|
16
|
+
}
|
@@ -0,0 +1,137 @@
|
|
1
|
+
/*
|
2
|
+
Sample test application.
|
3
|
+
*/
|
4
|
+
#include <assert.h>
|
5
|
+
#include <stdlib.h>
|
6
|
+
#include <string.h>
|
7
|
+
#include <sys/time.h>
|
8
|
+
#include <sys/types.h>
|
9
|
+
#include <sys/stat.h>
|
10
|
+
#include <unistd.h>
|
11
|
+
#include <time.h>
|
12
|
+
#include <fnmatch.h>
|
13
|
+
#include "server.h"
|
14
|
+
|
15
|
+
#include "test.h"
|
16
|
+
|
17
|
+
static long int timedif(struct timeval a, struct timeval b)
|
18
|
+
{
|
19
|
+
register int us, s;
|
20
|
+
|
21
|
+
us = (int)(a.tv_usec - b.tv_usec);
|
22
|
+
us /= 1000;
|
23
|
+
s = (int)(a.tv_sec - b.tv_sec);
|
24
|
+
s *= 1000;
|
25
|
+
return s + us;
|
26
|
+
}
|
27
|
+
|
28
|
+
int main(int argc, char *argv[])
|
29
|
+
{
|
30
|
+
unsigned int x;
|
31
|
+
char *collection_to_run= NULL;
|
32
|
+
char *wildcard= NULL;
|
33
|
+
server_startup_st *startup_ptr;
|
34
|
+
memcached_server_st *servers;
|
35
|
+
world_st world;
|
36
|
+
collection_st *collection;
|
37
|
+
collection_st *next;
|
38
|
+
uint8_t failed;
|
39
|
+
void *world_ptr;
|
40
|
+
|
41
|
+
memset(&world, 0, sizeof(world_st));
|
42
|
+
get_world(&world);
|
43
|
+
collection= world.collections;
|
44
|
+
|
45
|
+
if (world.create)
|
46
|
+
world_ptr= world.create();
|
47
|
+
else
|
48
|
+
world_ptr= NULL;
|
49
|
+
|
50
|
+
startup_ptr= (server_startup_st *)world_ptr;
|
51
|
+
servers= (memcached_server_st *)startup_ptr->servers;
|
52
|
+
|
53
|
+
if (argc > 1)
|
54
|
+
collection_to_run= argv[1];
|
55
|
+
|
56
|
+
if (argc == 3)
|
57
|
+
wildcard= argv[2];
|
58
|
+
|
59
|
+
for (next= collection; next->name; next++)
|
60
|
+
{
|
61
|
+
test_st *run;
|
62
|
+
|
63
|
+
run= next->tests;
|
64
|
+
if (collection_to_run && fnmatch(collection_to_run, next->name, 0))
|
65
|
+
continue;
|
66
|
+
|
67
|
+
fprintf(stderr, "\n%s\n\n", next->name);
|
68
|
+
|
69
|
+
for (x= 0; run->name; run++)
|
70
|
+
{
|
71
|
+
unsigned int loop;
|
72
|
+
memcached_st *memc;
|
73
|
+
memcached_return rc;
|
74
|
+
struct timeval start_time, end_time;
|
75
|
+
long int load_time;
|
76
|
+
|
77
|
+
if (wildcard && fnmatch(wildcard, run->name, 0))
|
78
|
+
continue;
|
79
|
+
|
80
|
+
fprintf(stderr, "Testing %s", run->name);
|
81
|
+
|
82
|
+
memc= memcached_create(NULL);
|
83
|
+
assert(memc);
|
84
|
+
|
85
|
+
rc= memcached_server_push(memc, servers);
|
86
|
+
assert(rc == MEMCACHED_SUCCESS);
|
87
|
+
|
88
|
+
if (run->requires_flush)
|
89
|
+
{
|
90
|
+
memcached_flush(memc, 0);
|
91
|
+
memcached_quit(memc);
|
92
|
+
}
|
93
|
+
|
94
|
+
for (loop= 0; loop < memcached_server_list_count(servers); loop++)
|
95
|
+
{
|
96
|
+
assert(memc->hosts[loop].fd == -1);
|
97
|
+
assert(memc->hosts[loop].cursor_active == 0);
|
98
|
+
}
|
99
|
+
|
100
|
+
if (next->pre)
|
101
|
+
{
|
102
|
+
rc= next->pre(memc);
|
103
|
+
|
104
|
+
if (rc != MEMCACHED_SUCCESS)
|
105
|
+
{
|
106
|
+
fprintf(stderr, "\t\t\t\t\t [ skipping ]\n");
|
107
|
+
goto error;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
gettimeofday(&start_time, NULL);
|
112
|
+
failed= run->function(memc);
|
113
|
+
gettimeofday(&end_time, NULL);
|
114
|
+
load_time= timedif(end_time, start_time);
|
115
|
+
if (failed)
|
116
|
+
fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ failed ]\n", load_time / 1000,
|
117
|
+
load_time % 1000);
|
118
|
+
else
|
119
|
+
fprintf(stderr, "\t\t\t\t\t %ld.%03ld [ ok ]\n", load_time / 1000,
|
120
|
+
load_time % 1000);
|
121
|
+
|
122
|
+
if (next->post)
|
123
|
+
(void)next->post(memc);
|
124
|
+
|
125
|
+
assert(memc);
|
126
|
+
error:
|
127
|
+
memcached_free(memc);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
fprintf(stderr, "All tests completed successfully\n\n");
|
132
|
+
|
133
|
+
if (world.destroy)
|
134
|
+
world.destroy(world_ptr);
|
135
|
+
|
136
|
+
return 0;
|
137
|
+
}
|