Skip to content

Instantly share code, notes, and snippets.

@wizardishungry
Last active December 16, 2015 09:38
Show Gist options
  • Save wizardishungry/5413908 to your computer and use it in GitHub Desktop.
Save wizardishungry/5413908 to your computer and use it in GitHub Desktop.
Are all the tests actually being run by your test suites?
<?php
define('TEST_BASE_PATH', realpath(realpath(dirname(__FILE__)) . '/../library/Mmf/Test/'));
define('SCRIPT_PATH', realpath(dirname(__FILE__)) . '/CommitTest.php');
echo SCRIPT_PATH,"\n";
echo "This is SLOW!\n";
$tmp = tempnam(sys_get_temp_dir(), "TestSuiteCoverage-");
$path = TEST_BASE_PATH;
$files = explode("\n",`find $path -type f`);
echo "Logging strace to $tmp\n";
passthru("strace -o $tmp -eopen -f php ".SCRIPT_PATH." ".escapeshellcmd(implode(' ',array_slice($argv,1))));
$lines = explode("\n",`cut -d \" -f 2 $tmp | grep $path | sort | uniq`);
$diff = array_diff($files,$lines);
echo count($lines), " files encountered of ", count($files), "; ", count($diff), " missing\n\n";
foreach($diff as $file) {
echo "$file\n";
}
unlink($tmp);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment