Re: Re: PHPT and --FILEEOF--

From: Date: Fri, 01 May 2009 13:37:11 +0000
Subject: Re: Re: PHPT and --FILEEOF--
References: 1 2 3 4 5 6  Groups: php.qa 
Request: Send a blank email to php-qa+get-64845@lists.php.net to get a copy of this message
zoe wrote: <snip> >> >> The easiest way to do this robustly would be to simply have a script >> that is passed the name of the testfile in a variable run in a separate >> process (much like --CLEAN--): >> >> --SETUP-- >> <?php >> $contents = file_get_contents($testfile); >> $contents = trim($contents); >> file_put_contents($testfile, $contents); >> ?> >> --FILE-- >> >> This way, any future manipulations needed can be done quite easily >> without adding new --FILE*-- >> <snip> > I think I like this idea. It seems that with FILEEOF we have > introduced a test section as a way to check for a specific failure in > the lexer. As that failure doesn't exist at the moment it's impossible > to detect any practical difference between FILEEOF and FILE. I tried a > few different tests: http://pastebin.ca/1409304, including the > one > Greg suggested and the one in the original bug. If there is a way and > I've missed it please shout :-) > > We still need a way to test for that kind of bug though. Greg's > suggestion provides that without using a test section that is only > valid for one type of bug. > > I suggest that we implement Greg's proposal in the new version of > run-tests, and that we do not implement FILEEOF. We can do as Eric > says with the current FILEEOF section, that is, document it and make > it clear that no-one is likely to need it. That would likely mean that > we possibly wouldn't implement FILE_EXTERNAL in the new version either > (actually, I need to think this through a bit more). > > One possible issue is that this means introducing another type of > runnable section, therefore another proc_open(), if used a lot it > might make overall execution slower? > > Thoughts? Hi, It may make execution slower, but currently we are talking about less than 100 tests in the entire PHP test suite, so I don't think the impact will be noticeable. I had another thought about how to do this more simply. Rather than passing in $testfile, if the setup file is simply named $testfile . '.setup' then we could instead easily do: --SETUP-- <?php $testfile = basename(__FILE__, '.setup'); $contents = file_get_contents($testfile); $contents = trim($contents); file_put_contents($testfile, $contents); ?> --FILE-- inside the file itself. This will make the logic in the phpt runner a bit simpler. As I said before, I am happy to refactor FILE_EXTERNAL into a --SETUP-- section in the phar tests. Not that you care, but these tests are not going to change format, so I would simply duplicate them, use a --SKIPIF-- to check for run-tests version (this needs to be possible, perhaps through an ENV variable), and copy the tests so that the --SETUP-- ones only run with the new run-tests, and the --FILE_EXTERNAL-- ones only run with the old run-tests. Simple and easy, and allows me BC with PHP 5.2, which we will support for pecl/phar until 5.2 dies. Greg Greg

« previous php.qa (#64845) next »