PDA

View Full Version : problem with list-tests and list-suites


schwalbenmann
02-08-2009, 07:06 AM
Hi.

I have some problem with PTS.
$ phoronix-test-suite list-suites

====================================
Phoronix Test Suite - Suites
====================================


Warning: array_merge(): Argument #2 is not an array in /usr/share/phoronix-test-suite/pts-core/functions/pts-functions_tests.php on line 660

Warning: array_unique(): The argument should be an array in /usr/share/phoronix-test-suite/pts-core/functions/pts-functions_tests.php on line 660

Warning: asort() expects parameter 1 to be array, boolean given in /usr/share/phoronix-test-suite/pts-core/functions/pts-functions_tests.php on line 661

The error is because the glob() funtion return FALSE if no files were found. This FALSE is handled like an normal array with array_merge. But FALSE can not be merged with an other array. This issue exists at some positions. Here an example:
656 function pts_available_suites_array()
657 {
658 $suites = glob(XML_SUITE_DIR . "*.xml");
659 $local_suites = glob(XML_SUITE_LOCAL_DIR . "*.xml");
660 $suites = array_unique(array_merge($suites, $local_suites));
661 asort($suites);
662
663 for($i = 0; $i < count($suites); $i++)
664 {
665 $suites[$i] = basename($suites[$i], ".xml");
666 }
667
668 return $suites;
669 }

Thanks, Andreas

Michael
02-08-2009, 02:44 PM
This should be fixed in tonight's Git update. Please report back if the problem persists and thanks for reporting the bug.

apaige
11-17-2009, 04:09 PM
Still there. http://bbs.archlinux.org/viewtopic.php?pid=657488

I suggest wrapping the glob() function:
function pts_glob($pattern, $flags = 0)
{
$r = glob($pattern, $flags);
return is_array($r) ? $r : array ();
}

Michael
11-17-2009, 04:28 PM
Hi apaige,

Thanks for reporting this... The earlier bug poster never reported back to say whether the Git problem fixed it or not, which evidently it did not. However, this will be fixed in Git shortly using a method similar to what you describe.

Michael
11-17-2009, 09:28 PM
BTW, can you get that user to submit any other information about what special php.ini settings he may have or anything? First time I've encountered a problem with no tests or suites like that.... And if he can try a .tar.gz copy locally from /home/ as my only thought is that he may have a PHP setting restricting php from opening files in /usr/