You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by HuiHuang <ye...@yahoo.com.cn> on 2009/06/25 13:48:09 UTC

[PATCH]find_wc_root_test

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

Re: [PATCH]find_wc_root_test

Posted by HuiHuang <ye...@yahoo.com.cn>.
>Well, I'd say he just copy/pasted that entry and didn't tweak
>the description.

>Anyway, this does not matter, this patch is not meant to be
>committed right now because it has no general way of creating
>a test working copy.

Sorry about this, I will pay much more attendion~~
Thanks all!

Huihuang

------------------				 
yellow.flying
2009-06-26



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

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365549

Re: [PATCH]find_wc_root_test

Posted by HuiHuang <ye...@yahoo.com.cn>.
>Anyway, this does not matter, this patch is not meant to be
>committed right now because it has no general way of creating
>a test working copy.
Although it will not be committed, I have modified the mistake
I made. Sorry for what have happened:(

New patch: 

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 function svn_wc__find_wc_root()
+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
+  };
+ 

------------------				 
yellow.flying
2009-06-26

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

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365551

Re: [PATCH]find_wc_root_test

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Jun 25, 2009 at 04:11:27PM +0200, Neels J Hofmeyr wrote:
> C. Michael Pilato wrote:
> > HuiHuang wrote:
> >> +[find-wc-root-test]
> >> +description = Test the storage of tree conflict data
> > 
> > "Tree conflict data"?  Really?
> > 
> 
> yea.
> AFAIK it's about storing the information on existing tree-conflicts in the
> WC metadata / loggy log.
> 
> Don't know what HuiHuang is adding there though.

Well, I'd say he just copy/pasted that entry and didn't tweak
the description.

Anyway, this does not matter, this patch is not meant to be
committed right now because it has no general way of creating
a test working copy.

Stefan


Re: [PATCH]find_wc_root_test

Posted by Neels Janosch Hofmeyr <ne...@elego.de>.
C. Michael Pilato wrote:
> HuiHuang wrote:
>> +[find-wc-root-test]
>> +description = Test the storage of tree conflict data
> 
> "Tree conflict data"?  Really?
> 

yea.
AFAIK it's about storing the information on existing tree-conflicts in the
WC metadata / loggy log.

Don't know what HuiHuang is adding there though.

~Neels

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365299

Re: [PATCH]find_wc_root_test

Posted by "C. Michael Pilato" <cm...@collab.net>.
HuiHuang wrote:
> +[find-wc-root-test]
> +description = Test the storage of tree conflict data

"Tree conflict data"?  Really?

-- 
C. Michael Pilato <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365295

Re: [PATCH]find_wc_root_test

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Jun 25, 2009 at 09:48:09PM +0800, yellow.flying wrote:
> 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.
>     ]]]

To clarify for the general dev@ audcience:

It's not trivial to add this nwe test to Subversion right now because
we have no easy way to create working copies from within a C test.

This patch has been posted so people can see how the new function
was unit tested.

Stefan

> 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