P4DTI issue job000764

TitleTest suite fails with Bugzilla versions 2.16.1 to 2.16.3
Assigned userDavid Jones
DescriptionSome tests fail with after emitting the error 'Too late for "-T" option'.

Here's an example:

$ python2 test_p4dti.py bugzilla_params.runTest
P4DTI test suite, logging to
Too late for "-T" option at doeditparams.cgi line 1.
ERROR: Bugzilla parameters (test_p4dti.bugzilla_params)
Traceback (most recent call last):
  File "test_p4dti.py", line 2400, in runTest
  File "test_p4dti.py", line 647, in edit_parameters
    self.run_script('doeditparams.cgi', params)
  File "test_p4dti.py", line 563, in run_script
IOError: [Errno 32] Broken pipe

Ran 1 tests in 5.396s

This is because Bugzilla 2.16.1 introduced the convention of
specifying the -wT options on the #! line. The test suite is
failing because it attempts to emulate a web server invoking the
cgi script; this emulation is faulty. Emulation currently works
by invoking "perl" on the file; this is presumably to get round
the fact that the interpreter specified by Bugzilla,
/usr/bonsaitools/bin/perl, does not usually exist on a test
machine. The invoked perl (invoked without options) is spotting
that options have been specified on the #! line and emits a
warning and exits.

Note that the test (suite) is at fault, it is not necessarily a
fault with the p4dti product.

Possible solutions are:
1. require /usr/bonsaitools/bin/perl to
  exist on test machines and invoke cgi scripts directly.
2. parse #! line of cgi scripts to determine both that perl is
  the interpreter and what options to specify to the perl
3. (possibly) invoke perl with -wT and hope that this works for
  historical version of Bugzilla too.
4. (possibly) invoke perl with options that suppress the errors
  about spotting options on the #! line.

p4dti 1.5.0 is the first release to support Bugzilla 2.16.x

NB 2004-07-16: Fixed with a combination of solutions 2 and 3:
 Firstly replace /usr/bonsaitools/bin/perl with the result of `which perl`, after making the copy of Bugzilla used by the source sources. The Bugzilla Guide has a tip on how to do this (using Perl, naturally):

 perl -pi -e 's@#!/usr/bonsaitools/bin/perl@#!/real/path/to/perl@' * 2>/dev/null

Also check the Bugzilla version, and on versions since 2.16, invoke perl with -T.
How foundautomated_test
Observed in2.0.0
Introduced in1.5.0
Test procedureAn example test that fails is test_p4dti.bugzilla_params: $ python2 test_p4dti.py bugzilla_params.runTest
Created byDavid Jones
Created on2003-08-22 14:05:39
Last modified byGareth Rees
Last modified on2010-10-07 12:05:01
History2003-08-22 DRJ Created


Change Effect Date User Description
103412 closed 2004-06-30 09:49:42 Nick Barnes Fix /usr/bonsaitools shebang lines so test suite works on machines without /usr/bonsaitools. Also turn off taint mode for old versions of Bugzilla.