Use symbolic names for tasks in mptester.

FossilOrigin-Name: f0d95afc73f8dbce8943dceb4a14b7de650c8823
This commit is contained in:
drh 2013-04-10 12:01:21 +00:00
parent 21c9b6bdc9
commit 4c5298f352
5 changed files with 47 additions and 34 deletions

View File

@ -1,5 +1,5 @@
C Fix\stypo\sin\sname\sof\smptest\sexecutable\sfiles\sin\sclean\stargets.
D 2013-04-10T03:06:43.090
C Use\ssymbolic\snames\sfor\stasks\sin\smptester.
D 2013-04-10T12:01:21.074
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in 3dd3fcb87b70c78d99b2c8a03e44ec86d6ca9ce2
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@ -113,9 +113,9 @@ F mkso.sh fd21c06b063bb16a5d25deea1752c2da6ac3ed83
F mptest/config01.test 3f4ddeb152a4f83872f0fa7fcb48d9fd609893da
F mptest/config02.test 962913ed2b537d60de4126db7fe54716865cdd22
F mptest/crash01.test a5f31998ed48de8267d6620e8af107ec148e5f12
F mptest/crash02.subtest 86641730725895da7baf6443bc26aa1c8e781711
F mptest/mptest.c c9fc81464dcd2de18ceb5317c5e1b075cb3b9fce
F mptest/multiwrite01.test 8fa273e97284edaa855f0b0e99d78216e204be15
F mptest/crash02.subtest f4ef05adcd15d60e5d2bd654204f2c008b519df8
F mptest/mptest.c d5228be2db65634783b302423704b3928284adb5
F mptest/multiwrite01.test 81fbc17657964889b60750bd7bbb1deffe8f4d42
F spec.template 86a4a43b99ebb3e75e6b9a735d5fd293a24e90ca
F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc
@ -1050,7 +1050,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
P 0adf8a3a4f2ca370568b35c9e8ce0e18f18701a2
R 87c959156377d2c80b90d9a959edeb9c
U mistachkin
Z f06e039212bcf2d4f3c2b172131c9afb
P 4c7d9e1ed8722e0c75b5fdbeffb9030ccef0bd64
R f44444aacae5f7c52822e030959d44b9
U drh
Z f26dfaa28d7c4e704618af941a7b95f6

View File

@ -1 +1 @@
4c7d9e1ed8722e0c75b5fdbeffb9030ccef0bd64
f0d95afc73f8dbce8943dceb4a14b7de650c8823

View File

@ -4,7 +4,7 @@
** journal in client 1, then crash client 1.
** Then in the other clients, do an integrity check.
*/
--task 1
--task 1 leave-hot-journal
--sleep 5
--finish
PRAGMA cache_size=10;
@ -22,36 +22,32 @@
--print Task one crashing an incomplete transaction
--exit 1
--end
--task 2
--task 2 integrity_check-2
SELECT count(*) FROM t1;
--match 64
--sleep 100
PRAGMA integrity_check(10);
--output
--match ok
--end
--task 3
--task 3 integrity_check-3
SELECT count(*) FROM t1;
--match 64
--sleep 100
PRAGMA integrity_check(10);
--output
--match ok
--end
--task 4
--task 4 integrity_check-4
SELECT count(*) FROM t1;
--match 64
--sleep 100
PRAGMA integrity_check(10);
--output
--match ok
--end
--task 5
--task 5 integrity_check-5
SELECT count(*) FROM t1;
--match 64
--sleep 100
PRAGMA integrity_check(10);
--output
--match ok
--end
--wait all

View File

@ -520,7 +520,8 @@ static void evalFunc(
static int startScript(
int iClient, /* The client number */
char **pzScript, /* Write task script here */
int *pTaskId /* Write task number here */
int *pTaskId, /* Write task number here */
char **pzTaskName /* Name of the task */
){
sqlite3_stmt *pStmt = 0;
int taskId;
@ -555,7 +556,7 @@ static int startScript(
return SQLITE_DONE;
}
pStmt = prepareSql(
"SELECT script, id FROM task"
"SELECT script, id, name FROM task"
" WHERE client=%d AND starttime IS NULL"
" ORDER BY id LIMIT 1", iClient);
rc = sqlite3_step(pStmt);
@ -564,6 +565,7 @@ static int startScript(
*pzScript = sqlite3_malloc(n+1);
strcpy(*pzScript, (const char*)sqlite3_column_text(pStmt, 0));
*pTaskId = taskId = sqlite3_column_int(pStmt, 1);
*pzTaskName = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 2));
sqlite3_finalize(pStmt);
runSql("UPDATE task"
" SET starttime=strftime('%%Y-%%m-%%d %%H:%%M:%%f','now')"
@ -804,6 +806,14 @@ static void waitForClient(int iClient, int iTimeout, char *zErrPrefix){
}
}
/* Return a pointer to the tail of a filename
*/
static char *filenameTail(char *z){
int i, j;
for(i=j=0; z[i]; i++) if( z[i]=='/' ) j = i+1;
return z+j;
}
/* Maximum number of arguments to a --command */
#define MX_ARG 2
@ -1039,16 +1049,23 @@ static void runScript(
int iTarget = atoi(azArg[0]);
int iEnd;
char *zTask;
char *zTName;
iEnd = findEnd(zScript+ii+len, &lineno);
if( iTarget<0 ){
errorMessage("line %d of %s: bad client number: %d",
prevLine, zFilename, iTarget);
}else{
zTask = sqlite3_mprintf("%.*s", iEnd, zScript+ii+len);
if( nArg>1 ){
zTName = sqlite3_mprintf("%s", azArg[1]);
}else{
zTName = sqlite3_mprintf("%s:%d", filenameTail(zFilename), prevLine);
}
startClient(iTarget);
runSql("INSERT INTO task(client,script)"
" VALUES(%d,'%q')", iTarget, zTask);
runSql("INSERT INTO task(client,script,name)"
" VALUES(%d,'%q',%Q)", iTarget, zTask, zTName);
sqlite3_free(zTask);
sqlite3_free(zTName);
}
iEnd += tokenLength(zScript+ii+len+iEnd, &lineno);
len += iEnd;
@ -1217,15 +1234,14 @@ int main(int argc, char **argv){
if( n>0 ) unrecognizedArguments(argv[0], n, argv+2);
if( g.iTrace ) logMessage("start-client");
while(1){
char zTaskName[50];
rc = startScript(iClient, &zScript, &taskId);
char *zTaskName = 0;
rc = startScript(iClient, &zScript, &taskId, &zTaskName);
if( rc==SQLITE_DONE ) break;
sqlite3_snprintf(sizeof(zTaskName), zTaskName, "client%02d-task-%d",
iClient, taskId);
if( g.iTrace ) logMessage("begin %s", zTaskName);
if( g.iTrace ) logMessage("begin %s (%d)", zTaskName, taskId);
runScript(iClient, taskId, zScript, zTaskName);
if( g.iTrace ) logMessage("end %s", zTaskName);
if( g.iTrace ) logMessage("end %s (%d)", zTaskName, taskId);
finishScript(iClient, taskId, 0);
sqlite3_free(zTaskName);
sqlite3_sleep(10);
}
if( g.iTrace ) logMessage("end-client");
@ -1239,6 +1255,7 @@ int main(int argc, char **argv){
runSql(
"CREATE TABLE task(\n"
" id INTEGER PRIMARY KEY,\n"
" name TEXT,\n"
" client INTEGER,\n"
" starttime DATE,\n"
" endtime DATE,\n"

View File

@ -2,7 +2,7 @@
** This script sets up five different tasks all writing and updating
** the database at the same time, but each in its own table.
*/
--task 1
--task 1 build-t1
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INTEGER PRIMARY KEY, b);
--sleep 1
@ -34,7 +34,7 @@
--end
--task 2
--task 2 build-t2
DROP TABLE IF EXISTS t2;
CREATE TABLE t2(a INTEGER PRIMARY KEY, b);
--sleep 1
@ -65,7 +65,7 @@
--match 29 28 27 26 25
--end
--task 3
--task 3 build-t3
DROP TABLE IF EXISTS t3;
CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
--sleep 1
@ -96,7 +96,7 @@
--match 29 28 27 26 25
--end
--task 4
--task 4 build-t4
DROP TABLE IF EXISTS t4;
CREATE TABLE t4(a INTEGER PRIMARY KEY, b);
--sleep 1
@ -127,7 +127,7 @@
--match 29 28 27 26 25
--end
--task 5
--task 5 build-t5
DROP TABLE IF EXISTS t5;
CREATE TABLE t5(a INTEGER PRIMARY KEY, b);
--sleep 1