⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻
字号:
                ================================                 A Subversion Testing Framework                ================================The three goals of Subversion's automated test-suite:      1.  It must be easy to run.      2.  It must be easy to understand the results.      3.  It must be easy to add new tests.Definition of an SVN "test program"-----------------------------------A Subversion test program is any executable that contains a number ofsub-tests it can run.  It has a standard interface:1.  If run with a numeric argument N, the program runs sub-test N.2.  If run with the argument `list', it will list the names of all sub-tests.3.  If run with no arguments, the program runs *all* sub-tests.4.  The program returns either 0 (success) or 1 (if any sub-test failed).5.  Upon finishing a test, the program reports the results in a format    which is both machine-readable (for the benefit of automatic    regression tracking scripts), and human-readable (for the sake of    painstaking grovelling by hand in the dead of night):      (PASS | FAIL): (argv[0]) (argv[1]): (description)For example,  [sussman@newton:~] ./frobtest 2  PASS: frobtest 2: frobnicating fragile data  [sussman@newton:~] Note that no particular programming language is required to write aset of tests;  they just needs to export this user interface.How to write new C tests------------------------The C test framework tests library APIs, both internal and external.All test programs use a standard `main' function.  You write .c filesthat contain only test functions --- you should not define your own`main' function.Instead, your code should define an externally visible array`test_funcs', like this:    /* The test table.  */    struct svn_test_descriptor_t test_funcs[] =    {      SVN_TEST_NULL,      SVN_TEST_PASS(test_a),      SVN_TEST_PASS(test_b),      SVN_TEST_PASS(test_c),      SVN_TEST_NULL    };In this example, `test_a', `test_b', and `test_c' are the names oftest functions.  The first and last elements of the array must beSVN_TEST_NULL.  The first SVN_TEST_NULL is there to leave room forBuddha.  The standard `main' function searches for the finalSVN_TEST_NULL to determine the size of the array.Instead of SVN_TEST_PASS, you can use SVN_TEST_XFAIL to declare that atest is expected to fail. The status of such tests is then no longermarked as PASS or FAIL, but rather as XFAIL (eXpected FAILure) orXPASS (uneXpected PASS).The purpose of XFAIL tests is to confirm that a known bug stillexists. When you see such a test uneXpectedly PASS, you've probablyfixed the bug it tests for, even if that wasn't your intention. :-)XFAIL is not to be used as a way of testing a deliberately invalidoperation that is expected to fail when Subversion is workingcorrectly, nor as a place-holder for a test that is not yet written.Each test function conforms to the svn_test_driver_t prototype:	svn_error_t *f (const char **MSG,                        svn_boolean_t MSG_ONLY                        apr_pool_t *POOL);When called, a test function should first set *MSG to a brief (as in,half-line) description of the test.  Then, if MSG_ONLY is TRUE, thetest should immediately return SVN_NO_ERROR.  Else it should perform atest.  If the test passes, the function should return SVN_NO_ERROR;otherwise, it should return an error object, built using the functionsin svn_error.h.Once you've got a .c file with a bunch of tests and a `test_funcs'array, you should link it against the `libsvn_tests_main.la' libtoollibrary, in this directory, `subversion/tests'.  That library providesa `main' function which will check the command-line arguments, pickthe appropriate tests to run from your `test_funcs' array, and printthe results in the standard way.How to write new Python tests-----------------------------The python test framework exercises the command-line client as a"black box".To write python tests, please look at the README file inside thecmdline/ subdirectory.When to write new tests-----------------------In the world of CVS development, people have noticed that the samebugs tend to recur over and over.  Thus the CVS community has adopteda hard-and-fast rule that whenever somebody fixes a bug, a *new* testis added to the suite to specifically check for it.  It's a commoncase that in the process of fixing a bug, several old bugs areaccidentally resurrected... and then quickly revealed by the testsuite.This same rule applies to Subversion development: ** If you fix abug, write a test for it. **What not to test----------------Regression tests are for testing interface promises.  This mightinclude semi-private interfaces (such as the non-public .h filesinside module subdirs), but does not include implementation detailsbehind the interfaces.  For example, this is a good way to testsvn_fs_txn_name:      /* Test that svn_fs_txn_name fulfills its promise. */      char *txn_name = NULL;      SVN_ERR = svn_fs_txn_name (&txn_name, txn, pool);      if (txn_name == NULL)        return fail();But this is not:      /* Test that the txn got id "0", since it's the first txn. */      char *txn_name = NULL;      SVN_ERR = svn_fs_txn_name (&txn_name, txn, pool);      if (txn_name && (strcmp (txn_name, "0") != 0))        return fail();During development, it may sometimes be very convenient to*temporarily* test implementation details via the regular test suite.It's okay to do that, but please remove the test when you're done andmake sure it's clearly marked in the meantime.  Since implementationdetails are not interface promises, they might legitimately change --and when they change, that test will break.  At which point whoeverencountered the problem will look into the test suite and find thetemporary test you forgot to remove.  As long as it's marked likethis...      /* Temporary test for debugging only: Test that the txn got id       * "0", since it's the first txn.        * NOTE: If the test suite is failing because of this test, then       * just remove the test.  It was written to help me debug an       * implementation detail that might have changed by now, so its       * failure does not necessarily mean there's anything wrong with       * Subversion. */      char *txn_name = NULL;      SVN_ERR = svn_fs_txn_name (&txn_name, txn, pool);      if (txn_name && (strcmp (txn_name, "0") != 0))        return fail();...then they won't have wasted much time.What's here-----------   * svn_test_main.c     [shared library "libsvn_tests_main"]     A standardized main() function to drive tests.  Link this into     your automated test-programs.   * svn_test_editor.c     [shared library "libsvn_tests_editor"]     An editor for testing drivers of svn_delta_edit_fns_t.  This     editor's functions simply print information to stdout.   * cmdline/     A collection of python scripts to test the command-line client.`make check`------------The file `build.conf' (at the top level of the tree) defines a[test-scripts] section.  These are a list of scripts that will be runwhenever someone types `make check`.Each script is expected to output sub-test information as described inthe first section of this document;  the `make check` rule scans forFAIL codes, and logs all the sub-test output into a top-level filecalled `tests.log'.If you write a new C executable that contains subtests, be sure to adda build "target" under the TESTING TARGETS section of build.conf.If you write a new python-script, be sure to add to the [test-scripts]section.Testing Over DAV----------------Please see subversion/tests/cmdline/README for how to run thecommand-line client test suite against a remote repository.Conclusion----------Our test suite...  1.  ...must be easy to run.      * run `make check`  2.  ...must be easy to understand the results.      * test programs output standardized messages      * all messages are logged      * `make check` only displays errors (not successes!)  3.  ...must be easy to add new tests.      * add your own sub-test to an existing test program, or      * add a new test program using template C or python code.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -