Fossil SCM

Add the --limit N option to the test-parse-all-blobs test command, so that we can easily limit the run-time of that command for cachegrind performance testing.

drh 2019-09-12 16:43 trunk
Commit 52211ccc2f90d333213cfd790458dcc16c5e471822d01d396a6dd9f735809885
1 file changed +8 -2
+8 -2
--- src/manifest.c
+++ src/manifest.c
@@ -1146,27 +1146,33 @@
11461146
}
11471147
11481148
/*
11491149
** COMMAND: test-parse-all-blobs
11501150
**
1151
-** Usage: %fossil test-parse-all-blobs
1151
+** Usage: %fossil test-parse-all-blobs [--limit N]
11521152
**
11531153
** Parse all entries in the BLOB table that are believed to be non-data
11541154
** artifacts and report any errors. Run this test command on historical
11551155
** repositories after making any changes to the manifest_parse()
11561156
** implementation to confirm that the changes did not break anything.
1157
+**
1158
+** If the --limit N argument is given, parse no more than N blobs
11571159
*/
11581160
void manifest_test_parse_all_blobs_cmd(void){
11591161
Manifest *p;
11601162
Blob err;
11611163
Stmt q;
11621164
int nTest = 0;
11631165
int nErr = 0;
1166
+ int N = 1000000000;
1167
+ const char *z;
11641168
db_find_and_open_repository(0, 0);
1169
+ z = find_option("limit", 0, 1);
1170
+ if( z ) N = atoi(z);
11651171
verify_all_options();
11661172
db_prepare(&q, "SELECT DISTINCT objid FROM EVENT");
1167
- while( db_step(&q)==SQLITE_ROW ){
1173
+ while( (N--)>0 && db_step(&q)==SQLITE_ROW ){
11681174
int id = db_column_int(&q,0);
11691175
fossil_print("Checking %d \r", id);
11701176
nTest++;
11711177
fflush(stdout);
11721178
blob_init(&err, 0, 0);
11731179
--- src/manifest.c
+++ src/manifest.c
@@ -1146,27 +1146,33 @@
1146 }
1147
1148 /*
1149 ** COMMAND: test-parse-all-blobs
1150 **
1151 ** Usage: %fossil test-parse-all-blobs
1152 **
1153 ** Parse all entries in the BLOB table that are believed to be non-data
1154 ** artifacts and report any errors. Run this test command on historical
1155 ** repositories after making any changes to the manifest_parse()
1156 ** implementation to confirm that the changes did not break anything.
 
 
1157 */
1158 void manifest_test_parse_all_blobs_cmd(void){
1159 Manifest *p;
1160 Blob err;
1161 Stmt q;
1162 int nTest = 0;
1163 int nErr = 0;
 
 
1164 db_find_and_open_repository(0, 0);
 
 
1165 verify_all_options();
1166 db_prepare(&q, "SELECT DISTINCT objid FROM EVENT");
1167 while( db_step(&q)==SQLITE_ROW ){
1168 int id = db_column_int(&q,0);
1169 fossil_print("Checking %d \r", id);
1170 nTest++;
1171 fflush(stdout);
1172 blob_init(&err, 0, 0);
1173
--- src/manifest.c
+++ src/manifest.c
@@ -1146,27 +1146,33 @@
1146 }
1147
1148 /*
1149 ** COMMAND: test-parse-all-blobs
1150 **
1151 ** Usage: %fossil test-parse-all-blobs [--limit N]
1152 **
1153 ** Parse all entries in the BLOB table that are believed to be non-data
1154 ** artifacts and report any errors. Run this test command on historical
1155 ** repositories after making any changes to the manifest_parse()
1156 ** implementation to confirm that the changes did not break anything.
1157 **
1158 ** If the --limit N argument is given, parse no more than N blobs
1159 */
1160 void manifest_test_parse_all_blobs_cmd(void){
1161 Manifest *p;
1162 Blob err;
1163 Stmt q;
1164 int nTest = 0;
1165 int nErr = 0;
1166 int N = 1000000000;
1167 const char *z;
1168 db_find_and_open_repository(0, 0);
1169 z = find_option("limit", 0, 1);
1170 if( z ) N = atoi(z);
1171 verify_all_options();
1172 db_prepare(&q, "SELECT DISTINCT objid FROM EVENT");
1173 while( (N--)>0 && db_step(&q)==SQLITE_ROW ){
1174 int id = db_column_int(&q,0);
1175 fossil_print("Checking %d \r", id);
1176 nTest++;
1177 fflush(stdout);
1178 blob_init(&err, 0, 0);
1179

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button