| Bug #18312 | mysqltest: --sleep=0 doesn't disable sleep | ||
|---|---|---|---|
| Submitted: | 17 Mar 2006 16:58 | Modified: | 2 May 2006 22:29 |
| Reporter: | Paul DuBois | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | 4.1, 5.0, 5.1 | OS: | |
| Assigned to: | Jim Winstead | CPU Architecture: | Any |
[17 Mar 2006 16:59]
Paul DuBois
patch file in case pasted-in patch loses tabs
Attachment: mysqltest.c.patch (application/octet-stream, text), 1.18 KiB.
[21 Apr 2006 17:47]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/5313
[2 May 2006 18:27]
Jim Winstead
Fixed in 5.0.22 and 5.1.10.
[2 May 2006 22:29]
Paul DuBois
Noted in 5.0.22, 5.1.10 changelogs. In <command>mysqltest</command>, <option>--sleep=0</option> had no effect. Now it correctly causes <literal>sleep</literal> commands in test case files to sleep for 0 seconds. (Bug #18312)

Description: The mysqltest client has a --sleep=N option that overrides sleep commands in test case files so that all sleep commands sleep for N seconds. However, --sleep=0 has no effect. That is, it does not cause sleep commands to sleep for 0 seconds. They are unaffected. How to repeat: Invoke mysqltest --sleep=0 and feed it this input: sleep 10; Result: The sleep command sleeps for 10 seconds, not 0 seconds. Suggested fix: Change the default opt_sleep value from 0 to -1 so that --sleep=0 can be detected properly. Following patch does this: ===== mysqltest.c 1.227 vs edited ===== --- 1.227/client/mysqltest.c 2006-03-07 07:34:15 -06:00 +++ edited/mysqltest.c 2006-03-17 10:25:20 -06:00 @@ -153,7 +153,7 @@ /* ************************************************************************ */ -static int record = 0, opt_sleep=0; +static int record = 0, opt_sleep=-1; static char *db = 0, *pass=0; const char *user = 0, *host = 0, *unix_sock = 0, *opt_basedir="./"; static int port = 0; @@ -1713,7 +1713,7 @@ query->first_argument); /* Fixed sleep time selected by --sleep option */ - if (opt_sleep && !real_sleep) + if (opt_sleep>=0 && !real_sleep) sleep_val= opt_sleep; DBUG_PRINT("info", ("sleep_val: %f", sleep_val)); @@ -2924,7 +2924,7 @@ "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"sleep", 'T', "Sleep always this many seconds on sleep commands.", - (gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, + (gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0}, {"socket", 'S', "Socket file to use for connection.", (gptr*) &unix_sock, (gptr*) &unix_sock, 0, GET_STR, REQUIRED_ARG, 0, 0, 0,