You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ko...@apache.org on 2022/11/23 10:49:18 UTC
svn commit: r1905474 - in /subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc: db-test.c entries-compat.c pristine-store-test.c utils.c
Author: kotkov
Date: Wed Nov 23 10:49:17 2022
New Revision: 1905474
URL: http://svn.apache.org/viewvc?rev=1905474&view=rev
Log:
On the 'pristines-on-demand-on-mwf' branch: In the C test suite, make a step
towards less parametrized tests for two supported working copy formats.
I'll try to avoid having format-specific sets of initial data, helpers and
intertwined expectations that have different outcomes depending on the format.
* subversion/tests/libsvn_wc/db-test.c
(testing_wc_format_32): Remove.
(TESTING_DATA_F31, TESTING_DATA_F32): Convert to…
(TESTING_DATA): …this.
(create_open): Use `TESTING_DATA`.
* subversion/tests/libsvn_wc/entries-compat.c
(testing_wc_format_32): Remove.
(TESTING_DATA_F31, TESTING_DATA_F32): Convert to…
(TESTING_DATA): …this.
(create_fake_wc): Use `TESTING_DATA`.
* subversion/tests/libsvn_wc/pristine-store-test.c
(testing_wc_format_32): Remove.
(pristine_install_dehydrated, pristine_dehydrate): Skip these tests
with a capability check. Remove all conditional test expectations.
* subversion/tests/libsvn_wc/utils.c
(svn_test__create_fake_wc): Upgrade the working copy after running the extra
statements, to allow using the same initial data set.
Modified:
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/db-test.c
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/entries-compat.c
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/pristine-store-test.c
subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/utils.c
Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/db-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/db-test.c?rev=1905474&r1=1905473&r2=1905474&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/db-test.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/db-test.c Wed Nov 23 10:49:17 2022
@@ -78,7 +78,7 @@
#define F_TC_DATA "(conflict F file update edited deleted (version 22 " ROOT_ONE " 1 2 branch1/ft/F none) (version 22 " ROOT_ONE " 1 3 branch1/ft/F file))"
#define G_TC_DATA "(conflict G file update edited deleted (version 22 " ROOT_ONE " 1 2 branch1/ft/F none) (version 22 " ROOT_ONE " 1 3 branch1/ft/F file))"
-static const char * const TESTING_DATA_F31 = (
+static const char * const TESTING_DATA = (
/* Load our test data.
Note: do not use named-column insertions. This allows us to test
@@ -91,19 +91,6 @@ static const char * const TESTING_DATA_F
"insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "'); "
);
-static const char * const TESTING_DATA_F32 = (
- /* Load our test data.
-
- Note: do not use named-column insertions. This allows us to test
- the column count in the schema matches our expectation here. */
-
- "insert into repository values (1, '" ROOT_ONE "', '" UUID_ONE "'); "
- "insert into repository values (2, '" ROOT_TWO "', '" UUID_TWO "'); "
- "insert into wcroot values (1, null); "
-
- "insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "', 1); "
- );
-
#define NOT_MOVED FALSE, NULL
#define NO_COPY_FROM 0, NULL, SVN_INVALID_REVNUM
@@ -302,13 +289,6 @@ static const svn_test__actual_data_t act
{ 0 }
};
-/* Are we testing WC format 32+? */
-static svn_boolean_t
-testing_wc_format_32(const svn_test_opts_t *opts)
-{
- return opts->wc_format_version->minor >= 15;
-}
-
static svn_error_t *
create_open(svn_wc__db_t **db,
const char **local_abspath,
@@ -325,9 +305,7 @@ create_open(svn_wc__db_t **db,
SVN_ERR(svn_io_remove_dir2(*local_abspath, TRUE, NULL, NULL, pool));
SVN_ERR(svn_wc__db_open(db, NULL, FALSE, TRUE, pool, pool));
- SVN_ERR(svn_test__create_fake_wc(*local_abspath,
- testing_wc_format_32(opts)
- ? TESTING_DATA_F32 : TESTING_DATA_F31,
+ SVN_ERR(svn_test__create_fake_wc(*local_abspath, TESTING_DATA,
nodes_init_data, actual_init_data,
opts->wc_format_version, pool));
Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/entries-compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/entries-compat.c?rev=1905474&r1=1905473&r2=1905474&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/entries-compat.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/entries-compat.c Wed Nov 23 10:49:17 2022
@@ -77,7 +77,7 @@
#define F_TC_DATA "(conflict F file update edited deleted (version 22 " ROOT_ONE " 1 2 branch1/ft/F none) (version 22 " ROOT_ONE " 1 3 branch1/ft/F file))"
#define G_TC_DATA "(conflict G file update edited deleted (version 22 " ROOT_ONE " 1 2 branch1/ft/F none) (version 22 " ROOT_ONE " 1 3 branch1/ft/F file))"
-static const char * const TESTING_DATA_F31 = (
+static const char * const TESTING_DATA = (
/* Load our test data.
Note: do not use named-column insertions. This allows us to test
@@ -90,19 +90,6 @@ static const char * const TESTING_DATA_F
"insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "'); "
);
-static const char * const TESTING_DATA_F32 = (
- /* Load our test data.
-
- Note: do not use named-column insertions. This allows us to test
- the column count in the schema matches our expectation here. */
-
- "insert into repository values (1, '" ROOT_ONE "', '" UUID_ONE "'); "
- "insert into repository values (2, '" ROOT_TWO "', '" UUID_TWO "'); "
- "insert into wcroot values (1, null); "
-
- "insert into pristine values ('$sha1$" SHA1_1 "', NULL, 15, 1, '$md5 $" MD5_1 "', 1); "
- );
-
#define NOT_MOVED FALSE, NULL
#define NO_COPY_FROM 0, NULL, SVN_INVALID_REVNUM
@@ -300,13 +287,6 @@ static const char * const M_TESTING_DATA
);
-/* Are we testing WC format 32+? */
-static svn_boolean_t
-testing_wc_format_32(const svn_test_opts_t *opts)
-{
- return opts->wc_format_version->minor >= 15;
-}
-
static svn_error_t *
create_fake_wc(const char *subdir,
const svn_test_opts_t *opts,
@@ -320,10 +300,7 @@ create_fake_wc(const char *subdir,
SVN_ERR(svn_io_remove_dir2(root, TRUE, NULL, NULL, pool));
SVN_ERR(svn_dirent_get_absolute(&wc_abspath, root, pool));
- SVN_ERR(svn_test__create_fake_wc(wc_abspath,
- testing_wc_format_32(opts)
- ? TESTING_DATA_F32 : TESTING_DATA_F31,
- nodes, actuals,
+ SVN_ERR(svn_test__create_fake_wc(wc_abspath, TESTING_DATA, nodes, actuals,
opts->wc_format_version, pool));
return SVN_NO_ERROR;
Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/pristine-store-test.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/pristine-store-test.c?rev=1905474&r1=1905473&r2=1905474&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/pristine-store-test.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/pristine-store-test.c Wed Nov 23 10:49:17 2022
@@ -53,13 +53,6 @@
#include "../svn_test.h"
-/* Are we testing WC format 32+? */
-static svn_boolean_t
-testing_wc_format_32(const svn_test_opts_t *opts)
-{
- return opts->wc_format_version->minor >= 15;
-}
-
/* Create repos and WC, set *WC_ABSPATH to the WC path, and set *DB to a new
* DB context. */
static svn_error_t *
@@ -336,6 +329,14 @@ pristine_install_dehydrated(const svn_te
const char data[] = "Blah";
svn_checksum_t *data_sha1, *data_md5;
+ int wc_format;
+
+ SVN_ERR(svn_wc__format_from_version(&wc_format, opts->wc_format_version, pool));
+
+ if (wc_format < SVN_WC__PRISTINES_ON_DEMAND_VERSION)
+ return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
+ "Not supported in WC format under test");
+
SVN_ERR(create_repos_and_wc(&wc_abspath, &db,
"pristine_install_dehydrated", opts, pool));
@@ -374,7 +375,7 @@ pristine_install_dehydrated(const svn_te
SVN_ERR(svn_wc__db_pristine_check(&present, &hydrated, db, wc_abspath,
data_sha1, pool));
SVN_TEST_ASSERT(present);
- SVN_TEST_ASSERT(hydrated == !testing_wc_format_32(opts));
+ SVN_TEST_ASSERT(! hydrated);
}
/* Look up its MD-5 from its SHA-1, and check it's the same MD-5. */
@@ -394,10 +395,7 @@ pristine_install_dehydrated(const svn_te
SVN_ERR(svn_wc__db_pristine_read(&actual_contents, &actual_size,
db, wc_abspath, data_sha1, pool, pool));
- if (testing_wc_format_32(opts))
- SVN_TEST_ASSERT(actual_contents == NULL);
- else
- SVN_TEST_ASSERT(actual_contents != NULL);
+ SVN_TEST_ASSERT(actual_contents == NULL);
SVN_TEST_INT_ASSERT(actual_size, sz);
}
@@ -442,9 +440,13 @@ pristine_dehydrate(const svn_test_opts_t
svn_string_t *data_string = svn_string_create(data, pool);
svn_checksum_t *data_sha1, *data_md5;
- if (!testing_wc_format_32(opts))
+ int wc_format;
+
+ SVN_ERR(svn_wc__format_from_version(&wc_format, opts->wc_format_version, pool));
+
+ if (wc_format < SVN_WC__PRISTINES_ON_DEMAND_VERSION)
return svn_error_create(SVN_ERR_TEST_SKIPPED, NULL,
- "dehydrate not available in WC format under test");
+ "Not supported in WC format under test");
SVN_ERR(create_repos_and_wc(&wc_abspath, &db,
"pristine_dehydrate", opts, pool));
Modified: subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/utils.c
URL: http://svn.apache.org/viewvc/subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/utils.c?rev=1905474&r1=1905473&r2=1905474&view=diff
==============================================================================
--- subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/utils.c (original)
+++ subversion/branches/pristines-on-demand-on-mwf/subversion/tests/libsvn_wc/utils.c Wed Nov 23 10:49:17 2022
@@ -146,10 +146,10 @@ svn_test__create_fake_wc(const char *wc_
my_statements = apr_palloc(scratch_pool, 7 * sizeof(const char *));
i = 0;
my_statements[i++] = statements[STMT_CREATE_SCHEMA];
+ my_statements[i++] = extra_statements;
if (target_format >= 32)
my_statements[i++] = statements[STMT_UPGRADE_TO_32];
my_statements[i++] = statements[STMT_INSTALL_SCHEMA_STATISTICS];
- my_statements[i++] = extra_statements;
my_statements[i++] = NULL;
/* Create fake-wc/SUBDIR/.svn/ for placing the metadata. */