Re: Re: PHPT and --FILEEOF--

From: Date: Fri, 01 May 2009 12:54:57 +0000
Subject: Re: Re: PHPT and --FILEEOF--
References: 1 2 3 4 5  Groups: php.qa 
Request: Send a blank email to php-qa+get-64844@lists.php.net to get a copy of this message
Hi all
Thanks everyone for looking into this. I didn't mean to imply that we should remove the section. I was having trouble nailing down a proper use case for it. I had found the two tests, but neither test alone seem to validate it's use. I should have reviewed the bug report though and that was my mistake. I think I'll document it's use based on the two tests we do have for it, but include comments that it's a rarely used edge-case specific feature. In other words, 99.99% of the time, you wouldn't use this feature.
    
Hi, I'd have to agree - in fact, it might be better to refactor this oddness so that special test setup such as pre-processing the file's contents or things like temporary file/directory creation could happen in a separate process. 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*-- This would work really nicely for --FILE_EXTERNAL-- as well (and I'm willing to refactor all of the phar tests that use FILE_EXTERNAL) There's a reason phpunit has setup/teardown methods outside the tests themselves - phpt could benefit from this model. 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? Zoe

« previous php.qa (#64844) next »