Пример #1
0
 /**
  * validates test dependencies including:
  *   fio         Performs actual testing - version 2.0+ required
  *   gnuplot     Generates graphs per the SNIA test specification. These graphs
  *               are used in the PDF report
  *   hdparm      Used for ATA secure erase (when supported)
  *   util-linux  For TRIM operations using `blkdiscard` and `fstrim` (when 
  *               supported). Not required if test targets are rotational
  *   wkhtmltopdf Generates PDF version of report - download from 
  *               http://wkhtmltopdf.org
  *   zip         Archives HTML test report into a single zip file
  * returns an array containing the missing dependencies (array is empty if 
  * all dependencies are valid)
  * @param array $options the run options (see BlockStorageTest::getRunOptions)
  * @return array
  */
 public static function validateDependencies($options)
 {
     $dependencies = array('fio' => 'fio');
     // reporting dependencies
     if (!isset($options['noreport']) || !$options['noreport']) {
         $dependencies['gnuplot'] = 'gnuplot';
         $dependencies['zip'] = 'zip';
         if (!isset($options['nopdfreport']) || !$options['nopdfreport']) {
             $dependencies['wkhtmltopdf'] = 'wkhtmltopdf';
         }
     }
     // ATA secure erase requires hdparm
     if ((!isset($options['nosecureerase']) || !$options['nosecureerase']) && isset($options['secureerase_pswd'])) {
         $dependencies['hdparm'] = 'hdparm';
     }
     // non-rotational devices require trim
     if (!isset($options['notrim']) || !$options['notrim']) {
         $nonrotational = FALSE;
         foreach ($options['target'] as $target) {
             if (!BlockStorageTest::isRotational($target)) {
                 $nonrotational = TRUE;
                 break;
             }
         }
         if (!$nonrotational) {
             $dependencies['fstrim'] = 'util-linux';
         }
     }
     return validate_dependencies($dependencies);
 }