OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 ** The code in this file runs a few multi-threaded test cases using the | 3 ** The code in this file runs a few multi-threaded test cases using the |
4 ** SQLite library. It can be compiled to an executable on unix using the | 4 ** SQLite library. It can be compiled to an executable on unix using the |
5 ** following command: | 5 ** following command: |
6 ** | 6 ** |
7 ** gcc -O2 threadtest3.c sqlite3.c -ldl -lpthread -lm | 7 ** gcc -O2 threadtest3.c sqlite3.c -ldl -lpthread -lm |
8 ** | 8 ** |
9 ** Then run the compiled program. The exit status is non-zero if any tests | 9 ** Then run the compiled program. The exit status is non-zero if any tests |
10 ** failed (hopefully there is also some output to stdout to clarify what went | 10 ** failed (hopefully there is also some output to stdout to clarify what went |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 sleep(2); | 1387 sleep(2); |
1388 | 1388 |
1389 launch_thread(&err, &threads, dynamic_triggers_2, 0); | 1389 launch_thread(&err, &threads, dynamic_triggers_2, 0); |
1390 launch_thread(&err, &threads, dynamic_triggers_1, 0); | 1390 launch_thread(&err, &threads, dynamic_triggers_1, 0); |
1391 | 1391 |
1392 join_all_threads(&err, &threads); | 1392 join_all_threads(&err, &threads); |
1393 | 1393 |
1394 print_and_free_err(&err); | 1394 print_and_free_err(&err); |
1395 } | 1395 } |
1396 | 1396 |
| 1397 |
| 1398 |
1397 #include "tt3_checkpoint.c" | 1399 #include "tt3_checkpoint.c" |
| 1400 #include "tt3_index.c" |
1398 | 1401 |
1399 int main(int argc, char **argv){ | 1402 int main(int argc, char **argv){ |
1400 struct ThreadTest { | 1403 struct ThreadTest { |
1401 void (*xTest)(int); | 1404 void (*xTest)(int); |
1402 const char *zTest; | 1405 const char *zTest; |
1403 int nMs; | 1406 int nMs; |
1404 } aTest[] = { | 1407 } aTest[] = { |
1405 { walthread1, "walthread1", 20000 }, | 1408 { walthread1, "walthread1", 20000 }, |
1406 { walthread2, "walthread2", 20000 }, | 1409 { walthread2, "walthread2", 20000 }, |
1407 { walthread3, "walthread3", 20000 }, | 1410 { walthread3, "walthread3", 20000 }, |
1408 { walthread4, "walthread4", 20000 }, | 1411 { walthread4, "walthread4", 20000 }, |
1409 { walthread5, "walthread5", 1000 }, | 1412 { walthread5, "walthread5", 1000 }, |
1410 { walthread5, "walthread5", 1000 }, | 1413 { walthread5, "walthread5", 1000 }, |
1411 | 1414 |
1412 { cgt_pager_1, "cgt_pager_1", 0 }, | 1415 { cgt_pager_1, "cgt_pager_1", 0 }, |
1413 { dynamic_triggers, "dynamic_triggers", 20000 }, | 1416 { dynamic_triggers, "dynamic_triggers", 20000 }, |
1414 | 1417 |
1415 { checkpoint_starvation_1, "checkpoint_starvation_1", 10000 }, | 1418 { checkpoint_starvation_1, "checkpoint_starvation_1", 10000 }, |
1416 { checkpoint_starvation_2, "checkpoint_starvation_2", 10000 }, | 1419 { checkpoint_starvation_2, "checkpoint_starvation_2", 10000 }, |
| 1420 |
| 1421 { create_drop_index_1, "create_drop_index_1", 10000 }, |
1417 }; | 1422 }; |
1418 | 1423 |
1419 int i; | 1424 int i; |
1420 char *zTest = 0; | 1425 char *zTest = 0; |
1421 int nTest = 0; | 1426 int nTest = 0; |
1422 int bTestfound = 0; | 1427 int bTestfound = 0; |
1423 int bPrefix = 0; | 1428 int bPrefix = 0; |
1424 | 1429 |
1425 if( argc>2 ) goto usage; | 1430 if( argc>2 ) goto usage; |
1426 if( argc==2 ){ | 1431 if( argc==2 ){ |
(...skipping 25 matching lines...) Expand all Loading... |
1452 printf("Usage: %s [testname|testprefix*]\n", argv[0]); | 1457 printf("Usage: %s [testname|testprefix*]\n", argv[0]); |
1453 printf("Available tests are:\n"); | 1458 printf("Available tests are:\n"); |
1454 for(i=0; i<sizeof(aTest)/sizeof(aTest[0]); i++){ | 1459 for(i=0; i<sizeof(aTest)/sizeof(aTest[0]); i++){ |
1455 printf(" %s\n", aTest[i].zTest); | 1460 printf(" %s\n", aTest[i].zTest); |
1456 } | 1461 } |
1457 | 1462 |
1458 return 254; | 1463 return 254; |
1459 } | 1464 } |
1460 | 1465 |
1461 | 1466 |
OLD | NEW |