[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: rev 5253 - in trunk: build subversion/tests/libsvn_subr

From: Daniel Rall <dlr_at_finemaltcoding.com>
Date: 2003-03-10 18:47:19 CET

Judging by Brane's commits, the config-test.cfg file couldn't be found
in some build setups. Having successfully run the config-test binary
from within my source tree and watched `make check` pass, I'm a bit
put off that I never experienced this problem myself. Any advice
which would help me avoid introducing this sort of badness in the
future (i.e. how did you guys trigger the test failure)?

Brane, thanks for fixing.

- Dan

brane@tigris.org writes:

> Author: brane
> Date: Sun Mar 9 15:20:48 2003
> New Revision: 5253
>
> Modified:
> trunk/build/run_tests.py
> trunk/subversion/tests/libsvn_subr/config-test.c
> Log:
> Fix config-test by always passing the test's source directory as a
> parameter.
>
> * build/run_tests.py (TestHarness::_run_test): For C tests, pass the test's
> source directory in a --srcdir= parameter.
>
> * subversion/tests/libsvn_subr/config-test.c: Declare test_argc and test_argv.
> (opt_def): New. Option definitions for apr_getopt_long.
> (init_params): New. Make --srcdir a required parameter.
> (test1): Use srcdir to look for config-test.cfg.
> (test_funcs): Enable test1.
>
>
> Modified: trunk/build/run_tests.py
> ==============================================================================
> --- trunk/build/run_tests.py (original)
> +++ trunk/build/run_tests.py Sun Mar 9 15:20:48 2003
> @@ -86,7 +86,8 @@
> quote(os.path.join(self.srcdir, progdir))]
> elif os.access(prog, os.X_OK):
> progname = './' + progbase
> - cmdline = [quote(progname)]
> + cmdline = [quote(progname),
> + quote('--srcdir=' + os.path.join(self.srcdir, progdir))]
> else:
> print 'Don\'t know what to do about ' + progbase
> sys.exit(1)
>
> Modified: trunk/subversion/tests/libsvn_subr/config-test.c
> ==============================================================================
> --- trunk/subversion/tests/libsvn_subr/config-test.c (original)
> +++ trunk/subversion/tests/libsvn_subr/config-test.c Sun Mar 9 15:20:48 2003
> @@ -25,6 +25,7 @@
>
> #include <string.h>
>
> +#include <apr_getopt.h>
> #include <apr_pools.h>
>
> #include "svn_error.h"
> @@ -32,6 +33,42 @@
> #include "svn_test.h"
>
>
> +/* Initialize parameters for the tests. */
> +extern int test_argc;
> +extern const char **test_argv;
> +
> +static const apr_getopt_option_t opt_def[] =
> + {
> + {"srcdir", 'S', 1, "the source directory for VPATH test runs"},
> + {0, 0, 0, 0}
> + };
> +static const char *srcdir = NULL;
> +
> +static svn_error_t *init_params (apr_pool_t *pool)
> +{
> + apr_getopt_t *opt;
> + int optch;
> + const char *opt_arg;
> + apr_status_t status;
> +
> + apr_getopt_init (&opt, pool, test_argc, test_argv);
> + while (!(status = apr_getopt_long (opt, opt_def, &optch, &opt_arg)))
> + {
> + switch (optch)
> + {
> + case 'S':
> + srcdir = opt_arg;
> + break;
> + }
> + }
> +
> + if (!srcdir)
> + return svn_error_create(SVN_ERR_TEST_FAILED, 0,
> + "missing required parameter '--srcdir'");
> +
> + return SVN_NO_ERROR;
> +}
> +
> /* A quick way to create error messages. */
> static svn_error_t *
> fail (apr_pool_t *pool, const char *fmt, ...)
> @@ -59,13 +96,18 @@
> svn_config_t *cfg;
> int i;
> char *key, *py_val, *c_val;
> + const char *cfg_file;
>
> *msg = "test svn_config";
>
> if (msg_only)
> return SVN_NO_ERROR;
>
> - SVN_ERR(svn_config_read(&cfg, "config-test.cfg", TRUE, pool));
> + if (!srcdir)
> + SVN_ERR(init_params(pool));
> +
> + cfg_file = apr_pstrcat(pool, srcdir, "/", "config-test.cfg", NULL);
> + SVN_ERR(svn_config_read(&cfg, cfg_file, TRUE, pool));
>
> /* Test values retrieved from our ConfigParser instance against
> values retrieved using svn_config. */
> @@ -94,7 +136,6 @@
> struct svn_test_descriptor_t test_funcs[] =
> {
> SVN_TEST_NULL,
> -/* ### disabled for now until locating config-test.cfg is fixed
> - SVN_TEST_PASS (test1), */
> + SVN_TEST_PASS (test1),
> SVN_TEST_NULL
> };

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Mar 10 18:47:57 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.