protected static function parse_result_process(&$test_run_request, $parse_xml_file, $log_file, $pts_test_arguments, $extra_arguments, $is_numeric_check = true, $prefix = null)
 {
     $test_identifier = $test_run_request->test_profile->get_identifier();
     $results_parser_xml = new pts_parse_results_nye_XmlReader($parse_xml_file);
     $result_match_test_arguments = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MatchToTestArguments');
     $result_scale = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultScale');
     $result_proportion = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultProportion');
     $result_precision = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultPrecision');
     $result_template = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/OutputTemplate');
     $result_key = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultKey');
     $result_line_hint = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineHint');
     $result_line_before_hint = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineBeforeHint');
     $result_line_after_hint = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineAfterHint');
     $result_before_string = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultBeforeString');
     $result_after_string = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultAfterString');
     $result_divide_by = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/DivideResultBy');
     $result_multiply_by = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MultiplyResultBy');
     $strip_from_result = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/StripFromResult');
     $strip_result_postfix = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/StripResultPostfix');
     $multi_match = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MultiMatch');
     $file_format = $results_parser_xml->getXMLArrayValues('PhoronixTestSuite/ResultsParser/FileFormat');
     $test_result = false;
     if ($prefix != null && substr($prefix, -1) != '_') {
         $prefix .= '_';
     }
     for ($i = 0; $i < count($result_template); $i++) {
         if (!empty($result_match_test_arguments[$i]) && strpos($pts_test_arguments, $result_match_test_arguments[$i]) === false) {
             // This is not the ResultsParser XML section to use as the MatchToTestArguments does not match the PTS test arguments
             continue;
         }
         if ($result_key[$i] == null) {
             $result_key[$i] = '#_' . $prefix . 'RESULT_#';
         } else {
             switch ($result_key[$i]) {
                 case 'PTS_TEST_ARGUMENTS':
                     $result_key[$i] = '#_' . $prefix . str_replace(' ', '', $pts_test_arguments) . '_#';
                     break;
                 case 'PTS_USER_SET_ARGUMENTS':
                     $result_key[$i] = '#_' . $prefix . str_replace(' ', '', $extra_arguments) . '_#';
                     break;
             }
         }
         // The actual parsing here
         $start_result_pos = strrpos($result_template[$i], $result_key[$i]);
         if ($prefix != null && $start_result_pos === false && $result_template[$i] != 'csv-dump-frame-latencies' && $result_template[$i] != 'libframetime-output') {
             // XXX: technically the $prefix check shouldn't be needed, verify whether safe to have this check be unconditional on start_result_pos failing...
             return false;
         }
         $space_out_chars = array('(', ')', "\t");
         if (isset($file_format[$i]) && $file_format[$i] == 'CSV') {
             array_push($space_out_chars, ',');
         }
         if (isset($result_template[$i][$start_result_pos - 1]) && $result_template[$i][$start_result_pos - 1] == '/' || isset($result_template[$i][$start_result_pos + strlen($result_key[$i])]) && $result_template[$i][$start_result_pos + strlen($result_key[$i])] == '/') {
             array_push($space_out_chars, '/');
         }
         $end_result_pos = $start_result_pos + strlen($result_key[$i]);
         $end_result_line_pos = strpos($result_template[$i], "\n", $end_result_pos);
         $result_template_line = substr($result_template[$i], 0, $end_result_line_pos === false ? strlen($result_template[$i]) : $end_result_line_pos);
         $result_template_line = substr($result_template_line, strrpos($result_template_line, "\n"));
         $result_template_r = explode(' ', pts_strings::trim_spaces(str_replace($space_out_chars, ' ', str_replace('=', ' = ', $result_template_line))));
         $result_template_r_pos = array_search($result_key[$i], $result_template_r);
         if ($result_template_r_pos === false) {
             // Look for an element that partially matches, if like a '.' or '/sec' or some other pre/post-fix is present
             foreach ($result_template_r as $x => $r_check) {
                 if (isset($result_key[$x]) && strpos($r_check, $result_key[$x]) !== false) {
                     $result_template_r_pos = $x;
                     break;
                 }
             }
         }
         $search_key = null;
         $line_before_key = null;
         if (isset($result_line_hint[$i]) && $result_line_hint[$i] != null && strpos($result_template_line, $result_line_hint[$i]) !== false) {
             $search_key = $result_line_hint[$i];
         } else {
             if (isset($result_line_before_hint[$i]) && $result_line_before_hint[$i] != null && strpos($result_template[$i], $result_line_hint[$i]) !== false) {
                 $search_key = null;
                 // doesn't really matter what this value is
             } else {
                 if (isset($result_line_after_hint[$i]) && $result_line_after_hint[$i] != null && strpos($result_template[$i], $result_line_hint[$i]) !== false) {
                     $search_key = null;
                     // doesn't really matter what this value is
                 } else {
                     foreach ($result_template_r as $line_part) {
                         if (strpos($line_part, ':') !== false && strlen($line_part) > 1) {
                             // add some sort of && strrpos($result_template[$i], $line_part)  to make sure there isn't two of the same $search_key
                             $search_key = $line_part;
                             break;
                         }
                     }
                     if ($search_key == null && isset($result_key[$i])) {
                         // Just try searching for the first part of the string
                         /*
                         for($i = 0; $i < $result_template_r_pos; $i++)
                         {
                         	$search_key .= $result_template_r[$i] . ' ';
                         }
                         */
                         // This way if there are ) or other characters stripped, the below method will work where the above one will not
                         $search_key = substr($result_template_line, 0, strpos($result_template_line, $result_key[$i]));
                     }
                 }
             }
         }
         if (is_file($log_file)) {
             $result_output = file_get_contents($log_file);
         } else {
             // Nothing to parse
             return false;
         }
         $test_results = array();
         $already_processed = false;
         $frame_time_values = null;
         if ($result_template[$i] == 'libframetime-output') {
             $already_processed = true;
             $frame_time_values = array();
             $line_values = explode(PHP_EOL, $result_output);
             if (!empty($line_values) && isset($line_values[3])) {
                 foreach ($line_values as &$v) {
                     if (substr($v, -3) == ' us' && substr($v, 0, 10) == 'Frametime ') {
                         $frametime = substr($v, 10);
                         $frametime = substr($frametime, 0, -3);
                         if ($frametime > 2000) {
                             $frametime = $frametime / 1000;
                             array_push($frame_time_values, $frametime);
                         }
                     }
                 }
                 $frame_time_values = pts_math::remove_outliers($frame_time_values);
             }
         } else {
             if ($result_template[$i] == 'csv-dump-frame-latencies') {
                 $already_processed = true;
                 $frame_time_values = explode(',', $result_output);
             }
         }
         if (!empty($frame_time_values) && isset($frame_time_values[3])) {
             // Get rid of the first value
             array_shift($frame_time_values);
             foreach ($frame_time_values as $f => &$v) {
                 if (!is_numeric($v) || $v == 0) {
                     unset($frame_time_values[$f]);
                     continue;
                 }
                 $v = 1000 / $v;
             }
             switch ($prefix) {
                 case 'MIN_':
                     $val = min($frame_time_values);
                     break;
                 case 'MAX_':
                     $val = max($frame_time_values);
                     break;
                 case 'AVG_':
                 default:
                     $val = array_sum($frame_time_values) / count($frame_time_values);
                     break;
             }
             if ($val != 0) {
                 array_push($test_results, $val);
             }
         }
         if (($search_key != null || isset($result_line_before_hint[$i]) && $result_line_before_hint[$i] != null || (isset($result_line_after_hint[$i]) && $result_line_after_hint[$i]) != null || isset($result_key[$i]) && $result_template_r[0] == $result_key[$i]) && $already_processed == false) {
             $is_multi_match = !empty($multi_match[$i]) && $multi_match[$i] != 'NONE';
             do {
                 $result_count = count($test_results);
                 if ($result_line_before_hint[$i] != null) {
                     pts_client::test_profile_debug_message('Result Parsing Line Before Hint: ' . $result_line_before_hint[$i]);
                     $result_line = substr($result_output, strpos($result_output, "\n", strrpos($result_output, $result_line_before_hint[$i])));
                     $result_line = substr($result_line, 0, strpos($result_line, "\n", 1));
                     $result_output = substr($result_output, 0, strrpos($result_output, "\n", strrpos($result_output, $result_line_before_hint[$i]))) . "\n";
                 } else {
                     if ($result_line_after_hint[$i] != null) {
                         pts_client::test_profile_debug_message('Result Parsing Line After Hint: ' . $result_line_after_hint[$i]);
                         $result_line = substr($result_output, 0, strrpos($result_output, "\n", strrpos($result_output, $result_line_before_hint[$i])));
                         $result_line = substr($result_line, strrpos($result_line, "\n", 1) + 1);
                         $result_output = null;
                     } else {
                         if ($search_key != null) {
                             $search_key = trim($search_key);
                             pts_client::test_profile_debug_message('Result Parsing Search Key: ' . $search_key);
                             $result_line = substr($result_output, 0, strpos($result_output, "\n", strrpos($result_output, $search_key)));
                             $start_of_line = strrpos($result_line, "\n");
                             $result_output = substr($result_line, 0, $start_of_line) . "\n";
                             $result_line = substr($result_line, $start_of_line + 1);
                         } else {
                             // Condition $result_template_r[0] == $result_key[$i], include entire file since there is nothing to search
                             pts_client::test_profile_debug_message('No Result Parsing Hint, Including Entire Result Output');
                             $result_line = trim($result_output);
                         }
                     }
                 }
                 pts_client::test_profile_debug_message('Result Line: ' . $result_line);
                 $result_r = explode(' ', pts_strings::trim_spaces(str_replace($space_out_chars, ' ', str_replace('=', ' = ', $result_line))));
                 $result_r_pos = array_search($result_key[$i], $result_r);
                 if (!empty($result_before_string[$i])) {
                     // Using ResultBeforeString tag
                     $result_before_this = array_search($result_before_string[$i], $result_r);
                     if ($result_before_this !== false) {
                         array_push($test_results, $result_r[$result_before_this - 1]);
                     }
                 } else {
                     if (!empty($result_after_string[$i])) {
                         // Using ResultBeforeString tag
                         $result_after_this = array_search($result_after_string[$i], $result_r);
                         if ($result_after_this !== false) {
                             $result_after_this++;
                             for ($f = $result_after_this; $f < count($result_r); $f++) {
                                 if (in_array($result_r[$f], array(':', ',', '-', '='))) {
                                     continue;
                                 }
                                 array_push($test_results, $result_r[$f]);
                                 break;
                             }
                         }
                     } else {
                         if (isset($result_r[$result_template_r_pos])) {
                             array_push($test_results, $result_r[$result_template_r_pos]);
                         }
                     }
                 }
             } while ($is_multi_match && count($test_results) != $result_count && !empty($result_output));
         }
         foreach ($test_results as $x => &$test_result) {
             if ($strip_from_result[$i] != null) {
                 $test_result = str_replace($strip_from_result[$i], null, $test_result);
             }
             if ($strip_result_postfix[$i] != null && substr($test_result, 0 - strlen($strip_result_postfix[$i])) == $strip_result_postfix[$i]) {
                 $test_result = substr($test_result, 0, 0 - strlen($strip_result_postfix[$i]));
             }
             // Expand validity checking here
             if ($is_numeric_check == true && is_numeric($test_result) == false) {
                 unset($test_results[$x]);
                 continue;
             }
             if ($result_divide_by[$i] != null && is_numeric($result_divide_by[$i]) && $result_divide_by[$i] != 0) {
                 $test_result = $test_result / $result_divide_by[$i];
             }
             if ($result_multiply_by[$i] != null && is_numeric($result_multiply_by[$i]) && $result_multiply_by[$i] != 0) {
                 $test_result = $test_result * $result_multiply_by[$i];
             }
         }
         if (empty($test_results)) {
             continue;
         }
         switch ($multi_match[$i]) {
             case 'REPORT_ALL':
                 $test_result = implode(',', $test_results);
                 break;
             case 'AVERAGE':
             default:
                 if ($is_numeric_check) {
                     $test_result = array_sum($test_results) / count($test_results);
                 }
                 break;
         }
         if ($test_result != false) {
             if ($result_scale[$i] != null) {
                 $test_run_request->test_profile->set_result_scale($result_scale[$i]);
             }
             if ($result_proportion[$i] != null) {
                 $test_run_request->test_profile->set_result_proportion($result_proportion[$i]);
             }
             if ($result_precision[$i] != null) {
                 $test_run_request->set_result_precision($result_precision[$i]);
             }
             break;
         }
     }
     return $test_result;
 }
 public static function rebuild_result_parser_file($xml_file)
 {
     $xml_writer = new nye_XmlWriter();
     $xml_parser = new pts_parse_results_nye_XmlReader($xml_file);
     $result_template = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/OutputTemplate');
     $result_match_test_arguments = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MatchToTestArguments');
     $result_key = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultKey');
     $result_line_hint = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineHint');
     $result_line_before_hint = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineBeforeHint');
     $result_line_after_hint = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/LineAfterHint');
     $result_before_string = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultBeforeString');
     $result_after_string = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultAfterString');
     $strip_from_result = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/StripFromResult');
     $strip_result_postfix = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/StripResultPostfix');
     $multi_match = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MultiMatch');
     $file_format = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/FileFormat');
     $result_divide_by = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/DivideResultBy');
     $result_multiply_by = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/MultiplyResultBy');
     $result_scale = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultScale');
     $result_proportion = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultProportion');
     $result_precision = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ResultsParser/ResultPrecision');
     foreach (array_keys($result_template) as $i) {
         $xml_writer->addXmlNode('PhoronixTestSuite/ResultsParser/OutputTemplate', $result_template[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/MatchToTestArguments', $result_match_test_arguments[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultKey', $result_key[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/LineHint', $result_line_hint[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/LineBeforeHint', $result_line_before_hint[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/LineAfterHint', $result_line_after_hint[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultBeforeString', $result_before_string[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultAfterString', $result_after_string[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/StripFromResult', $strip_from_result[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/StripResultPostfix', $strip_result_postfix[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/MultiMatch', $multi_match[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/DivideResultBy', $result_divide_by[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/MultiplyResultBy', $result_multiply_by[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultScale', $result_scale[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultProportion', $result_proportion[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultPrecision', $result_precision[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/FileFormat', $file_format[$i]);
     }
     $result_iqc_source_file = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/SourceImage');
     $result_match_test_arguments = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/MatchToTestArguments');
     $result_iqc_image_x = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/ImageX');
     $result_iqc_image_y = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/ImageY');
     $result_iqc_image_width = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/ImageWidth');
     $result_iqc_image_height = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ImageParser/ImageHeight');
     foreach (array_keys($result_iqc_source_file) as $i) {
         $xml_writer->addXmlNode('PhoronixTestSuite/ImageParser/SourceImage', $result_iqc_source_file[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ImageParser/MatchToTestArguments', $result_match_test_arguments[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ImageParser/ImageX', $result_iqc_image_x[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ImageParser/ImageY', $result_iqc_image_y[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ImageParser/ImageWidth', $result_iqc_image_width[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/ImageParser/ImageHeight', $result_iqc_image_height[$i]);
     }
     $monitor_sensor = $xml_parser->getXMLArrayValues('PhoronixTestSuite/SystemMonitor/Sensor');
     $monitor_frequency = $xml_parser->getXMLArrayValues('PhoronixTestSuite/SystemMonitor/PollingFrequency');
     $monitor_report_as = $xml_parser->getXMLArrayValues('PhoronixTestSuite/SystemMonitor/Report');
     foreach (array_keys($monitor_sensor) as $i) {
         $xml_writer->addXmlNode('PhoronixTestSuite/SystemMonitor/Sensor', $monitor_sensor[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/SystemMonitor/PollingFrequency', $monitor_frequency[$i]);
         $xml_writer->addXmlNodeWNE('PhoronixTestSuite/SystemMonitor/Report', $monitor_report_as[$i]);
     }
     $extra_data_id = $xml_parser->getXMLArrayValues('PhoronixTestSuite/ExtraData/Identifier');
     foreach (array_keys($extra_data_id) as $i) {
         $xml_writer->addXmlNode('PhoronixTestSuite/ExtraData/Identifier', $extra_data_id[$i]);
     }
     return $xml_writer;
 }
 public static function validate_test_profile(&$test_profile)
 {
     if ($test_profile->xml_parser->getFileLocation() == null) {
         echo PHP_EOL . 'ERROR: The file location of the XML test profile source could not be determined.' . PHP_EOL;
         return false;
     }
     // Validate the XML against the XSD Schemas
     libxml_clear_errors();
     // First rewrite the main XML file to ensure it is properly formatted, elements are ordered according to the schema, etc...
     $test_profile_writer = new pts_test_profile_writer();
     $test_profile_writer->rebuild_test_profile($test_profile);
     $test_profile_writer->save_xml($test_profile->xml_parser->getFileLocation());
     // Now re-create the pts_test_profile object around the rewritten XML
     $test_profile = new pts_test_profile($test_profile->get_identifier());
     $valid = $test_profile->xml_parser->validate();
     if ($valid == false) {
         echo PHP_EOL . 'Errors occurred parsing the main XML.' . PHP_EOL;
         pts_validation::process_libxml_errors();
         return false;
     } else {
         echo PHP_EOL . 'Test Profile XML Is Valid.' . PHP_EOL;
     }
     // Validate the downloads file
     $download_xml_file = $test_profile->get_file_download_spec();
     if (empty($download_xml_file) == false) {
         $writer = new pts_test_profile_downloads_writer();
         $writer->rebuild_download_file($test_profile);
         $writer->save_xml($download_xml_file);
         $downloads_parser = new pts_test_downloads_nye_XmlReader($download_xml_file);
         $valid = $downloads_parser->validate();
         if ($valid == false) {
             echo PHP_EOL . 'Errors occurred parsing the downloads XML.' . PHP_EOL;
             pts_validation::process_libxml_errors();
             return false;
         } else {
             echo PHP_EOL . 'Test Downloads XML Is Valid.' . PHP_EOL;
         }
         // Validate the individual download files
         echo PHP_EOL . 'Testing File Download URLs.' . PHP_EOL;
         $files_missing = 0;
         $file_count = 0;
         foreach (pts_test_install_request::read_download_object_list($test_profile) as $download) {
             foreach ($download->get_download_url_array() as $url) {
                 $stream_context = pts_network::stream_context_create();
                 stream_context_set_params($stream_context, array('notification' => 'pts_stream_status_callback'));
                 $file_pointer = fopen($url, 'r', false, $stream_context);
                 if ($file_pointer == false) {
                     echo 'File Missing: ' . $download->get_filename() . ' / ' . $url . PHP_EOL;
                     $files_missing++;
                 } else {
                     fclose($file_pointer);
                 }
                 $file_count++;
             }
         }
         if ($files_missing > 0) {
             return false;
         }
     }
     // Validate the parser file
     $parser_file = $test_profile->get_file_parser_spec();
     if (empty($parser_file) == false) {
         $writer = new pts_test_result_parser_writer();
         $writer->rebuild_parser_file($parser_file);
         $writer->save_xml($parser_file);
         $parser = new pts_parse_results_nye_XmlReader($parser_file);
         $valid = $parser->validate();
         if ($valid == false) {
             echo PHP_EOL . 'Errors occurred parsing the results parser XML.' . PHP_EOL;
             pts_validation::process_libxml_errors();
             return false;
         } else {
             echo PHP_EOL . 'Test Results Parser XML Is Valid.' . PHP_EOL;
         }
     }
     // Make sure no extra files are in there
     $allowed_files = pts_validation::test_profile_permitted_files();
     foreach (pts_file_io::glob($test_profile->get_resource_dir() . '*') as $tp_file) {
         if (!is_file($tp_file) || !in_array(basename($tp_file), $allowed_files)) {
             echo PHP_EOL . basename($tp_file) . ' is not allowed in the test package.' . PHP_EOL;
             return false;
         }
     }
     return true;
 }