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.
Commit
52211ccc2f90d333213cfd790458dcc16c5e471822d01d396a6dd9f735809885
Parent
3d802ec514f6e48…
1 file changed
+8
-2
+8
-2
| --- src/manifest.c | ||
| +++ src/manifest.c | ||
| @@ -1146,27 +1146,33 @@ | ||
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | /* |
| 1149 | 1149 | ** COMMAND: test-parse-all-blobs |
| 1150 | 1150 | ** |
| 1151 | -** Usage: %fossil test-parse-all-blobs | |
| 1151 | +** Usage: %fossil test-parse-all-blobs [--limit N] | |
| 1152 | 1152 | ** |
| 1153 | 1153 | ** Parse all entries in the BLOB table that are believed to be non-data |
| 1154 | 1154 | ** artifacts and report any errors. Run this test command on historical |
| 1155 | 1155 | ** repositories after making any changes to the manifest_parse() |
| 1156 | 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 | |
| 1157 | 1159 | */ |
| 1158 | 1160 | void manifest_test_parse_all_blobs_cmd(void){ |
| 1159 | 1161 | Manifest *p; |
| 1160 | 1162 | Blob err; |
| 1161 | 1163 | Stmt q; |
| 1162 | 1164 | int nTest = 0; |
| 1163 | 1165 | int nErr = 0; |
| 1166 | + int N = 1000000000; | |
| 1167 | + const char *z; | |
| 1164 | 1168 | db_find_and_open_repository(0, 0); |
| 1169 | + z = find_option("limit", 0, 1); | |
| 1170 | + if( z ) N = atoi(z); | |
| 1165 | 1171 | verify_all_options(); |
| 1166 | 1172 | db_prepare(&q, "SELECT DISTINCT objid FROM EVENT"); |
| 1167 | - while( db_step(&q)==SQLITE_ROW ){ | |
| 1173 | + while( (N--)>0 && db_step(&q)==SQLITE_ROW ){ | |
| 1168 | 1174 | int id = db_column_int(&q,0); |
| 1169 | 1175 | fossil_print("Checking %d \r", id); |
| 1170 | 1176 | nTest++; |
| 1171 | 1177 | fflush(stdout); |
| 1172 | 1178 | blob_init(&err, 0, 0); |
| 1173 | 1179 |
| --- 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 |