OLD | NEW |
1 /* | 1 /* |
2 ** This program tests the ability of SQLite database to recover from a crash. | 2 ** This program tests the ability of SQLite database to recover from a crash. |
3 ** This program runs under Unix only, but the results are applicable to all | 3 ** This program runs under Unix only, but the results are applicable to all |
4 ** systems. | 4 ** systems. |
5 ** | 5 ** |
6 ** The main process first constructs a test database, then starts creating | 6 ** The main process first constructs a test database, then starts creating |
7 ** subprocesses that write to that database. Each subprocess is killed off, | 7 ** subprocesses that write to that database. Each subprocess is killed off, |
8 ** without a chance to clean up its database connection, after a random | 8 ** without a chance to clean up its database connection, after a random |
9 ** delay. This killing of the subprocesses simulates a crash or power | 9 ** delay. This killing of the subprocesses simulates a crash or power |
10 ** failure. The next subprocess to open the database should rollback | 10 ** failure. The next subprocess to open the database should rollback |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 do_some_sql(parent); | 87 do_some_sql(parent); |
88 return 0; | 88 return 0; |
89 } | 89 } |
90 printf("test %d, pid=%d\n", i, pid); | 90 printf("test %d, pid=%d\n", i, pid); |
91 usleep(rand()%10000 + 1000); | 91 usleep(rand()%10000 + 1000); |
92 kill(pid, SIGKILL); | 92 kill(pid, SIGKILL); |
93 waitpid(pid, &status, 0); | 93 waitpid(pid, &status, 0); |
94 } | 94 } |
95 return 0; | 95 return 0; |
96 } | 96 } |
OLD | NEW |