Bug #37832 Parallel-running mtr --help prints usage many times
Submitted: 3 Jul 2008 9:34 Modified: 30 Jan 2009 17:13
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:6.0-rpl, 5.1 OS:Any
Assigned to: Magnus BlÄudd CPU Architecture:Any
Tags: --help, 51rpl, mtr, mysql-test-run, parallel test execution, usage

[3 Jul 2008 9:34] Sven Sandberg
Description:
When running 'mtr --help' using the new version of mtr that can run test cases in parallel, it prints the usage many times, one per thread it started.

Moreover, the main process stops before the child processes, so that the usage is printed after the new bash prompt is printed.

How to repeat:
$ cd mysql-6.0-rpl/mysql-test-run
$ ./mtr --help

Suggested fix:
Print usage only in the main thread.
[24 Jul 2008 10:47] Sven Sandberg
proposed fix:

=== modified file 'mysql-test/mysql-test-run.pl'
--- mysql-test/mysql-test-run.pl	2008-07-22 18:55:20 +0000
+++ mysql-test/mysql-test-run.pl	2008-07-24 10:50:58 +0000
@@ -793,7 +793,15 @@ sub command_line_setup {
              'help|h'                   => \$opt_usage,
             ) or usage("Can't read options");
 
-  usage("") if $opt_usage;
+  # print usage only in main thread
+  if ($opt_usage) {  
+    if ($thread_num == 0) {  
+      usage("");
+    }
+    else {  
+      exit(1);
+    }
+  }
 
   # --------------------------------------------------------------------------
   # Setup verbosity
[24 Jul 2008 20:58] 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/50459

2636 Magnus Svensson	2008-07-24
      BUG#37832 Parallel-running mtr --help prints usage many times
[30 Jan 2009 13:29] Bugs System
Pushed into 6.0.10-alpha (revid:luis.soares@sun.com-20090129165607-wiskabxm948yx463) (version source revid:luis.soares@sun.com-20090129163120-e2ntks4wgpqde6zt) (merge vers: 6.0.10-alpha) (pib:6)
[30 Jan 2009 15:09] Bugs System
Pushed into 5.1.32 (revid:luis.soares@sun.com-20090129165946-d6jnnfqfokuzr09y) (version source revid:msvensson@mysql.com-20080724205818-hatwi07h1dqkyrqp) (merge vers: 5.1.28) (pib:6)
[30 Jan 2009 17:13] Paul DuBois
Test suite changes. No changelog entry needed.
[17 Feb 2009 14:57] Bugs System
Pushed into 5.1.32-ndb-6.3.23 (revid:tomas.ulin@sun.com-20090217131017-6u8qz1edkjfiobef) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 16:45] Bugs System
Pushed into 5.1.32-ndb-6.4.3 (revid:tomas.ulin@sun.com-20090217134419-5ha6xg4dpedrbmau) (version source revid:tomas.ulin@sun.com-20090203133556-9rclp06ol19bmzs4) (merge vers: 5.1.32-ndb-6.3.22) (pib:6)
[17 Feb 2009 18:21] Bugs System
Pushed into 5.1.32-ndb-6.2.17 (revid:tomas.ulin@sun.com-20090217134216-5699eq74ws4oxa0j) (version source revid:tomas.ulin@sun.com-20090201210519-vehobc4sy3g9s38e) (merge vers: 5.1.32-ndb-6.2.17) (pib:6)