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

[PATCH]find_wc_root_test

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Thu, 25 Jun 2009 21:48:09 +0800

Hey Stefan,

log message:
     
    [[[
      
       * build.conf
         (find-wc-root-test): new test. It tests function
         svn_wc__find_wc_root() in subversion/libsvn_wc/update_editor.c.
       * subversion/tests/libsvn_wc/find-wc-root-test.c
         new file. It implement the 'find-wc-root-test' test. In this test the
         tested paths are not included in subversion, if you want to run this
         test, you need to change these paths to the real path on your
         machine.
    ]]]

Index: build.conf
===================================================================
--- build.conf (revision 38192)
+++ build.conf (working copy)
@@ -868,6 +868,14 @@
 install = test
 libs = libsvn_test libsvn_wc libsvn_subr apriconv apr
 
+[find-wc-root-test]
+description = Test the storage of tree conflict data
+type = exe
+path = subversion/tests/libsvn_wc
+sources = find-wc-root-test.c
+install = test
+libs = libsvn_test libsvn_wc libsvn_subr apriconv apr
+
 # ----------------------------------------------------------------------------
 # These are not unit tests at all, they are small programs that exercise
 # parts of the libsvn_delta API from the command line. They are stuck here
Index: subversion/tests/libsvn_wc/find-wc-root-test.c
===================================================================
--- subversion/tests/libsvn_wc/find-wc-root-test.c (revision 0)
+++ subversion/tests/libsvn_wc/find-wc-root-test.c (revision 0)
@@ -0,0 +1,93 @@
+/*
+ * find-wc-root-test.c -- test svn_wc__find_wc_root()
+ */
+
+#include <stdio.h>
+
+#include "svn_pools.h"
+#include "private/svn_wc_private.h"
+#include "../svn_test.h"
+
+/* A quick way to create error messages. */
+static svn_error_t *
+fail(apr_pool_t *pool, const char *fmt, ...)
+{
+ va_list ap;
+ char *msg;
+
+ va_start(ap, fmt);
+ msg = apr_pvsprintf(pool, fmt, ap);
+ va_end(ap);
+
+ return svn_error_create(SVN_ERR_TEST_FAILED, 0, msg);
+}
+
+/* These paths are not included in subversion, so if you want to run this
+ * test, you need to change these paths to the real path on your machine. */
+static const char* path[] = {
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/C",
+ /* Windows style path */
+ "E:\\subversion\\Release\\subversion\\tests\\cmdline\\svn-test-work"
+ "\\working_copies\\commit_tests-1\\A\\C",
+ /* The path is a file */
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/mu",
+ /* Nested wc path */
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/wc2/A/B",
+ /* Relative path */
+ "subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/C",
+ NULL
+};
+
+/* These are wc root paths corresponding to above paths */
+static const char *wc_root[] = {
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ "E:/subversion/Release/subversion/tests/cmdline/svn-test-work/"
+ "working_copies/commit_tests-1/A/wc2",
+ "E:/subversion/Release/subversion/tests/cmdline/"
+ "svn-test-work/working_copies/commit_tests-1",
+ NULL
+};
+
+static svn_error_t *
+test_find_wc_root(apr_pool_t *pool)
+{
+ const char *root_path;
+ apr_pool_t *scratch_pool;
+ int i;
+
+ scratch_pool = svn_pool_create(pool);
+ svn_pool_clear(scratch_pool);
+
+ for (i = 0; path[i] != NULL; i++)
+ {
+ SVN_ERR(svn_wc__find_wc_root(&root_path, path[i], pool, scratch_pool));
+
+ if (svn_path_compare_paths(root_path, wc_root[i]) != 0)
+ return fail(pool, "%d: %s is not wc root", i, root_path);
+ }
+
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
+}
+
+
+/* The test table. */
+
+struct svn_test_descriptor_t test_funcs[] =
+ {
+ SVN_TEST_NULL,
+ SVN_TEST_PASS2(test_find_wc_root,
+ "find wc root of a given path"),
+ SVN_TEST_NULL
+ };
+

Huihuang
------------------
yellow.flying
2009-06-25

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365286
Received on 2009-06-25 15:48:34 CEST

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.