You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2020/10/08 12:42:38 UTC
svn commit: r1882321 -
/subversion/trunk/subversion/tests/libsvn_repos/repos-test.c
Author: stsp
Date: Thu Oct 8 12:42:38 2020
New Revision: 1882321
URL: http://svn.apache.org/viewvc?rev=1882321&view=rev
Log:
Display the relevant authz ruleset if an authz test in repos-test fails.
This makes it easier to diagnose test failures.
* subversion/tests/libsvn_repos/repos-test.c
(authz_check_access): Add 'authz_contents' parameter. Display authz file
contents in the generated error message when a test fails.
(authz, test_authz_wildcards, test_authz_prefixes,
test_authz_recursive_override, test_authz_pattern_tests,
in_repo_authz, in_repo_groups_authz, groups_authz): Update callers.
Modified:
subversion/trunk/subversion/tests/libsvn_repos/repos-test.c
Modified: subversion/trunk/subversion/tests/libsvn_repos/repos-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_repos/repos-test.c?rev=1882321&r1=1882320&r2=1882321&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_repos/repos-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_repos/repos-test.c Thu Oct 8 12:42:38 2020
@@ -1181,6 +1181,7 @@ struct check_access_tests {
* as defined in TESTS. */
static svn_error_t *
authz_check_access(svn_authz_t *authz_cfg,
+ const char *authz_contents,
const struct check_access_tests *tests,
apr_pool_t *pool)
{
@@ -1202,7 +1203,7 @@ authz_check_access(svn_authz_t *authz_cf
{
return svn_error_createf(SVN_ERR_TEST_FAILED, NULL,
"Authz incorrectly %s %s%s access "
- "to %s%s%s for user %s",
+ "to %s%s%s for user %s\n%s",
access_granted ?
"grants" : "denies",
tests[i].required
@@ -1217,7 +1218,8 @@ authz_check_access(svn_authz_t *authz_cf
":" : "",
tests[i].path,
tests[i].user ?
- tests[i].user : "-");
+ tests[i].user : "-",
+ authz_contents);
}
}
@@ -1312,11 +1314,11 @@ authz(apr_pool_t *pool)
SVN_ERR(authz_get_handle(&authz_cfg, contents, FALSE, subpool));
/* Loop over the test array and test each case. */
- SVN_ERR(authz_check_access(authz_cfg, test_set, subpool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, subpool));
/* Repeat the previous test on disk */
SVN_ERR(authz_get_handle(&authz_cfg, contents, TRUE, subpool));
- SVN_ERR(authz_check_access(authz_cfg, test_set, subpool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, subpool));
/* The authz rules for the phase 2 tests, first case (cyclic
dependency). */
@@ -1496,7 +1498,7 @@ test_authz_wildcards(apr_pool_t *pool)
SVN_ERR(authz_get_handle(&authz_cfg, contents, FALSE, pool));
/* Loop over the test array and test each case. */
- SVN_ERR(authz_check_access(authz_cfg, test_set, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, pool));
return SVN_NO_ERROR;
}
@@ -1652,7 +1654,7 @@ test_authz_prefixes(apr_pool_t *pool)
test->path = test_paths[i];
/* Loop over the test array and test each case. */
- SVN_ERR(authz_check_access(authz_cfg, test_set, iterpool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, iterpool));
}
}
@@ -1719,7 +1721,7 @@ test_authz_recursive_override(apr_pool_t
SVN_ERR(authz_get_handle(&authz_cfg, contents, FALSE, pool));
/* Loop over the test array and test each case. */
- SVN_ERR(authz_check_access(authz_cfg, test_set, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, pool));
/* That's a wrap! */
return SVN_NO_ERROR;
@@ -1898,16 +1900,16 @@ test_authz_pattern_tests(apr_pool_t *poo
/* Verify that the rules are applies as expected. */
SVN_ERR(authz_get_handle(&authz_cfg, contents, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents, test_set, pool));
SVN_ERR(authz_get_handle(&authz_cfg, contents2, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set2, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents2, test_set2, pool));
SVN_ERR(authz_get_handle(&authz_cfg, contents3, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set3, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents3, test_set3, pool));
SVN_ERR(authz_get_handle(&authz_cfg, contents4, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set4, pool));
+ SVN_ERR(authz_check_access(authz_cfg, contents4, test_set4, pool));
/* That's a wrap! */
return SVN_NO_ERROR;
@@ -1984,7 +1986,7 @@ in_repo_authz(const svn_test_opts_t *opt
/* absolute file URL. */
SVN_ERR(svn_repos_authz_read2(&authz_cfg, authz_url, NULL, TRUE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set, pool));
/* Non-existent path in the repo with must_exist set to FALSE */
SVN_ERR(svn_repos_authz_read2(&authz_cfg, noent_authz_url, NULL,
@@ -2127,7 +2129,7 @@ in_repo_groups_authz(const svn_test_opts
/* absolute file URLs. */
SVN_ERR(svn_repos_authz_read2(&authz_cfg, authz_url, groups_url, TRUE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set, pool));
/* Non-existent path for the groups file with must_exist
* set to TRUE */
@@ -2318,12 +2320,12 @@ groups_authz(const svn_test_opts_t *opts
SVN_ERR(authz_groups_get_handle(&authz_cfg, authz_contents,
groups_contents, TRUE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set1, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set1, pool));
SVN_ERR(authz_groups_get_handle(&authz_cfg, authz_contents,
groups_contents, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set1, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set1, pool));
/* Access rights in the global groups file are forbidden. */
groups_contents =
@@ -2355,12 +2357,12 @@ groups_authz(const svn_test_opts_t *opts
SVN_ERR(authz_groups_get_handle(&authz_cfg, authz_contents,
groups_contents, TRUE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set2, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set2, pool));
SVN_ERR(authz_groups_get_handle(&authz_cfg, authz_contents,
groups_contents, FALSE, pool));
- SVN_ERR(authz_check_access(authz_cfg, test_set2, pool));
+ SVN_ERR(authz_check_access(authz_cfg, authz_contents, test_set2, pool));
/* Local groups cannot be used in conjunction with global groups. */
groups_contents =