You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2015/04/21 13:47:34 UTC
svn commit: r1675099 - in /subversion/trunk: build/run_tests.py
subversion/tests/libsvn_subr/cache-test.c subversion/tests/svn_test.h
subversion/tests/svn_test_main.c win-tests.py
Author: rhuijben
Date: Tue Apr 21 11:47:33 2015
New Revision: 1675099
URL: http://svn.apache.org/r1675099
Log:
Make it a bit easier to test the memcached support from the cache C tests
and fix a few Windows testsuite runner problems in recent changes.
* build/run_tests.py
(_run_c_test): Pass --memcached-server if available.
* subversion/tests/libsvn_subr/cache-test.c
(create_memcache): New function.
(test_memcache_basic,
test_memcache_long_key): Use create_memcache.
* subversion/tests/svn_test.h
(svn_test_opts_t): Add option.
* subversion/tests/svn_test_main.c
(test_options_e): Add value.
(cl_options): Declare option.
(svn_test_main): Parse option.
* win-tests.py
(): Following up on r1674783, add missing ',' to separate arguments
and parse the right argument names.
Modified:
subversion/trunk/build/run_tests.py
subversion/trunk/subversion/tests/libsvn_subr/cache-test.c
subversion/trunk/subversion/tests/svn_test.h
subversion/trunk/subversion/tests/svn_test_main.c
subversion/trunk/win-tests.py
Modified: subversion/trunk/build/run_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/run_tests.py?rev=1675099&r1=1675098&r2=1675099&view=diff
==============================================================================
--- subversion/trunk/build/run_tests.py (original)
+++ subversion/trunk/build/run_tests.py Tue Apr 21 11:47:33 2015
@@ -386,6 +386,8 @@ class TestHarness:
'--srcdir=' + os.path.join(self.srcdir, progdir)]
if self.config_file is not None:
cmdline.append('--config-file=' + self.config_file)
+ elif self.memcached_server is not None:
+ cmdline.append('--memcached-server=' + self.memcached_server)
if self.base_url is not None:
subdir = 'subversion/tests/cmdline/svn-test-work'
Modified: subversion/trunk/subversion/tests/libsvn_subr/cache-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/cache-test.c?rev=1675099&r1=1675098&r2=1675099&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/cache-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/cache-test.c Tue Apr 21 11:47:33 2015
@@ -34,6 +34,39 @@
#include "../svn_test.h"
+/* Create memcached cache if configured */
+static svn_error_t *
+create_memcache(svn_memcache_t **memcache,
+ const svn_test_opts_t *opts,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_config_t *config = NULL;
+ if (opts->config_file)
+ {
+ SVN_ERR(svn_config_read3(&config, opts->config_file,
+ TRUE, FALSE, FALSE, scratch_pool));
+ }
+ else if (opts->memcached_server)
+ {
+ SVN_ERR(svn_config_create2(&config, FALSE, FALSE, scratch_pool));
+
+ svn_config_set(config, SVN_CACHE_CONFIG_CATEGORY_MEMCACHED_SERVERS,
+ "key" /* some value; ignored*/,
+ opts->memcached_server);
+ }
+
+ if (config)
+ {
+ SVN_ERR(svn_cache__make_memcache_from_config(memcache, config,
+ result_pool, scratch_pool));
+ }
+ else
+ *memcache = NULL;
+
+ return SVN_NO_ERROR;
+}
+
/* Implements svn_cache__serialize_func_t */
static svn_error_t *
serialize_revnum(void **data,
@@ -147,20 +180,12 @@ test_memcache_basic(const svn_test_opts_
apr_pool_t *pool)
{
svn_cache__t *cache;
- svn_config_t *config;
svn_memcache_t *memcache = NULL;
const char *prefix = apr_psprintf(pool,
"test_memcache_basic-%" APR_TIME_T_FMT,
apr_time_now());
- if (opts->config_file)
- {
- SVN_ERR(svn_config_read3(&config, opts->config_file,
- TRUE, FALSE, FALSE, pool));
- SVN_ERR(svn_cache__make_memcache_from_config(&memcache, config,
- pool, pool));
- }
-
+ SVN_ERR(create_memcache(&memcache, opts, pool, pool));
if (! memcache)
return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
"not configured to use memcached");
@@ -303,7 +328,6 @@ test_memcache_long_key(const svn_test_op
apr_pool_t *pool)
{
svn_cache__t *cache;
- svn_config_t *config;
svn_memcache_t *memcache = NULL;
svn_revnum_t fifty = 50, *answer;
svn_boolean_t found = FALSE;
@@ -319,13 +343,7 @@ test_memcache_long_key(const svn_test_op
"0123456789" "0123456789" "0123456789" "0123456789" "0123456789" /* 300 */
;
- if (opts->config_file)
- {
- SVN_ERR(svn_config_read3(&config, opts->config_file,
- TRUE, FALSE, FALSE, pool));
- SVN_ERR(svn_cache__make_memcache_from_config(&memcache, config,
- pool, pool));
- }
+ SVN_ERR(create_memcache(&memcache, opts, pool, pool));
if (! memcache)
return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
Modified: subversion/trunk/subversion/tests/svn_test.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test.h?rev=1675099&r1=1675098&r2=1675099&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test.h (original)
+++ subversion/trunk/subversion/tests/svn_test.h Tue Apr 21 11:47:33 2015
@@ -149,6 +149,8 @@ typedef struct svn_test_opts_t
const char *repos_dir;
/* Repository url: The url to access REPOS_DIR as */
const char *repos_url;
+ /* Memcached server. */
+ const char *memcached_server;
/* Repository template: pre-created repository to copy for tests */
const char *repos_template;
/* Minor version to use for servers and FS backends, or zero to use
Modified: subversion/trunk/subversion/tests/svn_test_main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/svn_test_main.c?rev=1675099&r1=1675098&r2=1675099&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/svn_test_main.c (original)
+++ subversion/trunk/subversion/tests/svn_test_main.c Tue Apr 21 11:47:33 2015
@@ -104,6 +104,7 @@ enum test_options_e {
reposdir_opt,
reposurl_opt,
repostemplate_opt,
+ memcached_server_opt,
mode_filter_opt,
sqlite_log_opt,
parallel_opt,
@@ -144,6 +145,8 @@ static const apr_getopt_option_t cl_opti
N_("the url to access reposdir as")},
{"repos-template",repostemplate_opt, 1,
N_("the repository to use as template")},
+ {"memcached-server", memcached_server_opt, 1,
+ N_("the memcached server to use")},
{"sqlite-logging", sqlite_log_opt, 0,
N_("enable SQLite logging")},
{"parallel", parallel_opt, 0,
@@ -915,6 +918,10 @@ svn_test_main(int argc, const char *argv
opts.repos_template = svn_dirent_internal_style(opts.repos_template,
pool);
break;
+ case memcached_server_opt:
+ SVN_INT_ERR(svn_utf_cstring_to_utf8(&opts.memcached_server, opt_arg,
+ pool));
+ break;
case list_opt:
list_mode = TRUE;
break;
Modified: subversion/trunk/win-tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/win-tests.py?rev=1675099&r1=1675098&r2=1675099&view=diff
==============================================================================
--- subversion/trunk/win-tests.py (original)
+++ subversion/trunk/win-tests.py Tue Apr 21 11:47:33 2015
@@ -133,7 +133,7 @@ opts, args = my_getopt(sys.argv[1:], 'hr
'list', 'enable-sasl', 'bin=', 'parallel',
'config-file=', 'server-minor-version=', 'log-level=',
'log-to-stdout', 'mode-filter=', 'milestone-filter=',
- 'ssl-cert=', 'exclusive-wc-locks', 'memcached-server='
+ 'ssl-cert=', 'exclusive-wc-locks', 'memcached-server=',
'skip-c-tests', 'dump-load-cross-check'
])
if len(args) > 1:
@@ -250,13 +250,13 @@ for opt, val in opts:
log_level = val
elif opt == '--ssl-cert':
ssl_cert = val
- elif opt == '--exclusive_wc_locks':
+ elif opt == '--exclusive-wc-locks':
exclusive_wc_locks = 1
- elif opt == 'memcached-server':
+ elif opt == '--memcached-server':
memcached_server = val
- elif opt == 'skip-c-tests':
+ elif opt == '--skip-c-tests':
skip_c_tests = 1
- elif opt == 'dump-load-cross-check':
+ elif opt == '--dump-load-cross-check':
dump_load_cross_check = 1
# Calculate the source and test directory names