Bug #52828 Tests that use perl fail when perl is not in path
Submitted: 14 Apr 2010 15:33 Modified: 13 Nov 2010 16:12
Reporter: Daniel Fischer Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.1+ OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[14 Apr 2010 15:33] Daniel Fischer
Description:
Test cases can use perl; mysqltest will spawn a perl interpreter and pass a script fragment to it.

The implementation of this feature in mysqltest assumes that perl is in PATH and tests will fail when it is not, even though mtr runs fine without perl in PATH.

Output will typically look similar to

mysqltest: In included file ".\include\truncate_file.inc": At line 11: command "perl" failed with error 1

(taken from a rpl.rpl_manual_change_index_file test failure)

How to repeat:
It's easier to repeat on Windows. Install perl, don't add it to PATH, run mtr by specifying the full path of the perl executable, wait for a test that requires perl (or directly run one, such as the one mentioned above).

Suggested fix:
I could see two different ways to improve this:

1) tests that require perl can be skipped if perl is not in PATH (requires changing all such test cases)

2) mysqltest could detect that executing the perl interpreter failed because it wasn't found and return an appropriate result code to mtr that causes it to not treat the test case as a failure
[14 Apr 2010 17:32] MySQL Verification Team
Thank you for the bug report.
[29 Sep 2010 11:06] 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/119386

2937 Bjorn Munch	2010-09-29
      Bug #52828 Tests that use perl fail when perl is not in path
      Trying to run perl fails, just like it does when perl is started but fails
      Trap the case that perl was not found/could not be started, and skip test
      Also force a restart of servers since test may already have done something
[29 Sep 2010 11:10] Bjørn Munch
Alt. 1 requires tests that use Perl to identify themselves, and I don't think that's a good idea.

I go for detecting that missing (or unrunnable) perl was the cause, and then skip the test instead of failing it. We also have to force restart of servers to avoid side effects of whatever the test has already done.
[30 Sep 2010 8:05] Magnus Blåudd
Have you tried to add the perl path of the perl that is executing mtr.pl to $PATH before starting mysqltest? We do require perl you know. :)
[30 Sep 2010 10:34] 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/119500

2937 Bjorn Munch	2010-09-30
      Bug #52828 Tests that use perl fail when perl is not in path
      Trying to run perl fails, just like it does when perl is started but fails
      Trap the case that perl was not found/could not be started, and skip test
      Also force a restart of servers since test may already have done something
      mtr now also appends path of current perl to PATH to aid mysqltest
[30 Sep 2010 10:45] 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/119504

2938 Bjorn Munch	2010-09-30
      Bug #52828 Tests that use perl fail when perl is not in path
      Trying to run perl fails, just like it does when perl is started but fails
      Trap the case that perl was not found/could not be started, and skip test
      Also force a restart of servers since test may already have done something
      mtr now also appends path of current perl to PATH to aid mysqltest
[30 Sep 2010 11:16] Bjørn Munch
Pushed to -mtr branches
[6 Oct 2010 19:42] Paul DuBois
Changes to test suite. No changelog entry needed.
[19 Oct 2010 11:59] 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/121123

2941 Bjorn Munch	2010-10-19
      Bug #52828 Tests that use perl fail when perl is not in path
      main.mysqltest skipped on Windows because a perl intentionally does exit(1)
      Use exit(2), as exit(1) on Windows is indistinguishable from failing to
      execute perl.
[1 Nov 2010 19:00] Bugs System
Pushed into mysql-5.1 5.1.53 (revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (version source revid:build@mysql.com-20101101184443-o2olipi8vkaxzsqk) (merge vers: 5.1.53) (pib:21)
[9 Nov 2010 19:46] Bugs System
Pushed into mysql-5.5 5.5.7-rc (revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (version source revid:sunanda.menon@sun.com-20101109182959-otkxq8vo2dcd13la) (merge vers: 5.5.7-rc) (pib:21)
[13 Nov 2010 16:07] Bugs System
Pushed into mysql-trunk 5.6.99-m5 (revid:alexander.nozdrin@oracle.com-20101113155825-czmva9kg4n31anmu) (version source revid:alexander.nozdrin@oracle.com-20101113152450-2zzcm50e7i4j35v7) (merge vers: 5.6.1-m4) (pib:21)
[13 Nov 2010 16:12] Paul DuBois
Changes to test suite. No changelog entry needed.
[13 Nov 2010 16:35] Bugs System
Pushed into mysql-next-mr (revid:alexander.nozdrin@oracle.com-20101113160336-atmtmfb3mzm4pz4i) (version source revid:vasil.dimov@oracle.com-20100629074804-359l9m9gniauxr94) (pib:21)
[18 Nov 2010 15:54] Bugs System
Pushed into mysql-5.1 5.1.54 (revid:build@mysql.com-20101118153531-693taxtxyxpt037i) (version source revid:build@mysql.com-20101118153531-693taxtxyxpt037i) (merge vers: 5.1.54) (pib:21)
[16 Dec 2010 22:30] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)