Bug #59182 output of mysql-test-run.pl - mismatch between col names and actual col contents
Submitted: 27 Dec 2010 10:45 Modified: 28 Jan 2011 15:43
Reporter: Santo Leto Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.5-bzr OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any
Tags: intuitiveness, mysqltestrun, Output, usability

[27 Dec 2010 10:45] Santo Leto
Description:
The output produced by mysql-test-run.pl includes a summary table:

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

where it is possible to see names of the test being executed (TEST), test results (RESULT) and execution time (TIME (ms)).

Typically, an entry of this table has the following form:

rpl.rpl_incident                         [ skipped ]  Test needs debug binaries

However, often it is possible to find entries which have 4 columns (and not just 3), like for example the following:

main.plugin_auth                         w3 [ pass ]   2365
sys_vars.all_vars                        w2 [ pass ]   2257
rpl.rpl_plugin_load 'mix'                w1 [ skipped ]  Test requires: 'not_windows'
main.ctype_cp1251                        w3 [ fail ]
main.create_not_windows                  w3 [ skipped ]  Test requires: 'not_windows'

So it's seems that we have a fourth column which can have - as far as I've noted - the following values: empty, w1, w2, w3.

We could be interested in:
- adding the name of this new column while printing header (so that it would be more intuitive to understand what w1, w2 and w3 mean)
- change the name of the col TIME (ms) in TIME (ms) / COMMENT so that name of this col is more inline with its content (when timer option is used)
- show a colum named "COMMENT" when timer option is not used (it seems that we always have a comment)
- make sure that the two lines (above and below col names) have the same length
- make sure that we have a space both below and above col names (and not just above)

How to repeat:
perl mysql-test-run.pl --force [with --timer or --notimer option]

Suggested fix:
Please act on mtr_print_header function included in the file lib/mtr_report.pm

For example:

sub mtr_print_header () {
  print "\n";
  printf "TEST";
  print " " x 38;
  print "NEWCOL "; #for the new col
  print "RESULT   ";
  #a 'comment' column is always present, whether we use timer option or not, so we could use an if block here:
  if ( $timer )
  { 
    print "TIME (ms) / COMMENT" ;
  }else{
    print "COMMENT" ;
  }
  print "\n";
  print "\n"; #now we have a space even below the row which contains the col names (and not just above)
  mtr_print_thick_line(); #mysql-test-run.pl call mtr_print_thick_line() before calling mtr_print_header(). If we call here mtr_print_thick_line() (instead of mtr_print_line(), as it was previously) we fix the length mismatch between the two lines
  print "\n";
}

Result with timer option:

==============================================================================

TEST                                      NEWCOL RESULT   TIME (ms) / COMMENT

============================================================================== 

Result with notimer option:

==============================================================================

TEST                                      NEWCOL RESULT   COMMENT

==============================================================================
[27 Dec 2010 13:05] MySQL Verification Team
Thank you for the bug report.
[30 Dec 2010 12:35] 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/127716

3135 Bjorn Munch	2010-12-30
      Bug #59182 output of mysql-test-run.pl - mismatch between col names and actual col contents
      Added optional WORKERID in header, and COMMENT
      Extended print_line to 74 chars, which is max length of header
[11 Jan 2011 8:56] Magnus Blåudd
Hi,

I think that: 
1) making $parallel global should be avoided.
2) The user interface should be constant, ie. always have four columns even if 
--parallel=1(this would also remove the need for a global $parallel), to make it easier to parse the output.
[11 Jan 2011 9:40] Bjørn Munch
I haven't had any complaints about difficulty in parsing due to the optional WID, I know only one parser that had to adapt (and it had to anyway, whether or not the WID was optional).

When not running with parallel, the constant 'w1' would not provide any real information, but its absence makes it very obvious to whoever looks at the logs that parallel is not being used. I think we also need to keep human readers in mind.

I do agree that making $opt_parallel global may not be a good idea, an alternative may be to write (WORKERID) in parens in the header to indicate it's optional.
[11 Jan 2011 14:38] 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/128435

3137 Bjorn Munch	2011-01-11
      Bug #59182 output of mysql-test-run.pl - mismatch between col names and actual col contents
      New patch, avoid global $opt_parallel
      I still prefer not to print workerid when not doing parallel
[12 Jan 2011 9:48] 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/128487

3141 Bjorn Munch	2011-01-12
      Bug #59182 output of mysql-test-run.pl - mismatch between col names and actual col contents
      New patch, avoid global $opt_parallel
      I still prefer not to print workerid when not doing parallel
[12 Jan 2011 10:29] Bjørn Munch
Pushed to 5.5-mtr and trunk-mtr
[12 Jan 2011 23:24] Bugs System
Pushed into mysql-trunk 5.6.2 (revid:bjorn.munch@oracle.com-20110112231827-w6nuz7qcr3f2zylq) (version source revid:bjorn.munch@oracle.com-20110112225756-g2nv4mukrmvnl3uz) (merge vers: 5.6.2) (pib:24)
[12 Jan 2011 23:26] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:bjorn.munch@oracle.com-20110112225418-3zw6jvo3jywfqsva) (version source revid:bjorn.munch@oracle.com-20110112223239-fep31owswretsv6w) (merge vers: 5.5.9) (pib:24)
[14 Jan 2011 17:25] Paul DuBois
Changes to test suite. No changelog entry needed.