Bug #39542 main.trigger_compat fails sporadically on windows
Submitted: 19 Sep 2008 18:55 Modified: 5 Jun 17:29
Reporter: Alexander Nozdrin
Status: Closed
Category:Tests: Server Severity:S3 (Non-critical)
Version:5.1-TRUNK OS:Microsoft Windows
Assigned to: Alexander Nozdrin Target Version:5.1+
Tags: sporadic, test failure, pushbuild
Triage: D3 (Medium)

[19 Sep 2008 18:55] Alexander Nozdrin
Description:
main.trigger_compat test fails sporadically on windows.

The problem is that it uses 'grep' and 'mv', which seem to be
not reliable on Windows.

There are two different symptoms of this failure.

Symptom 1 (http://tinyurl.com/3foy33):
-----------------------------------------------------------------
mysqltest: At line 63: command "grep -v 'definers='
$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG > $MYSQLTEST_VARDIR/tmp/t1.TRG"
failed
-----------------------------------------------------------------

Symptom 2 (http://tinyurl.com/4he94y):
-----------------------------------------------------------------
mysqltest: At line 64: command "mv $MYSQLTEST_VARDIR/tmp/t1.TRG
$MYSQLTEST_VARDIR/master-data/mysqltest_db1/t1.TRG" failed
-----------------------------------------------------------------

How to repeat:
http://tinyurl.com/3foy33
http://tinyurl.com/4he94y
[13 Mar 17:25] 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/69172

2745 Alexander Nozdrin	2009-03-13
      Patch for Bug#39542: main.trigger_compat fails sporadically on windows.
      
      The problem is that the test case used 'grep' and 'mv' UNIX tools,
      which can be not available on Windows.
      
      The fix is to
        - enhance mysqltest set of directive -- introduce 'move_file' directive.
        - replace 'grep' by a perl script.
      modified:
        client/mysqltest.cc
        mysql-test/r/mysqltest.result
        mysql-test/t/mysqltest.test
        mysql-test/t/trigger-compat.test
[16 Mar 15:01] Bjorn Munch
In the move_file test, under "Check that if source file does not
exist, nothing will be created.", you have twice twice:

+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;
+--error 1
+file_exists $MYSQLTEST_VARDIR/tmp/file1.tmp;

I presume the last one should be file2.tmp ?

Then, under "Check that if destination file exists, everything works
properly", you do

+--write_file $MYSQLTEST_VARDIR/tmp/file1.tmp

Again, I presume it should be file2.tmp ?

-------------

In the "grep replacement" code:

1. You copy the source file t1.TRG to a tmp file, which the Perl code
   then reads from.  Why not let the Perl code read directly from the
   original source file?

2. Even if you do need to copy to t1.src.TRG, you should delete that
   file when you're done.

3. In the while loop, why chomp the line to remove the \n, then print
   it with \n?  Can't you just print TO_FH "$_" ?
[1 Apr 10:17] 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/71007

2760 Alexander Nozdrin	2009-04-01
      Patch for Bug#39542: main.trigger_compat fails sporadically on windows.
      
      The patch actually enhances mysqltest directives -- 'move_file' has
      been introduced.
[1 Apr 11:00] Bjorn Munch
OK to push for the move_file fix; grep part has already been done by Bug #38831
[1 Apr 13:18] Alexander Nozdrin
Patch queued in 6.0-runtime.
[16 May 10:41] Bugs System
Pushed into 6.0.12-alpha (revid:alik@sun.com-20090516083402-0avycdy7w6dnn0tv) (version
source revid:serg@mysql.com-20090512164111-jz224w5781lhe7wd) (merge vers: 6.0.12-alpha)
(pib:6)
[26 May 22:04] Paul DuBois
Noted in 6.0.12 changelog.

The mysqltest program now has a move_file from_file to_file command 
for renaming files. This should be used in test cases rather than
invoking an external command that might be platform specific.

Setting report to NDI pending push into 5.1.x.
[27 May 22: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/75088

2797 Bjorn Munch	2009-05-27
      cherry picking fix for Bug #39542 from 6.0-runtime
      modified:
        client/mysqltest.cc
        mysql-test/r/mysqltest.result
        mysql-test/t/mysqltest.test
[5 Jun 10:04] Bugs System
Pushed into 5.1.36 (revid:bjorn.munch@sun.com-20090605074215-1d7l2reqdb9a0t0t) (version
source revid:bjorn.munch@sun.com-20090605074215-1d7l2reqdb9a0t0t) (merge vers: 5.1.36)
(pib:6)
[5 Jun 17:29] Paul DuBois
Noted in 5.1.36 changelog.
[17 Jun 21:24] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version
source revid:matthias.leich@sun.com-20090609174954-3ao9iz97nzrfg9yl) (merge vers:
5.4.4-alpha) (pib:11)
[26 Aug 15:46] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l)
(version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers:
5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 15:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc)
(version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers:
5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 15:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4)
(version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers:
5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 18:33] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr)
(version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers:
5.1.37-ndb-7.0.8) (pib:11)