public function needs_updated_install() { foreach (pts_types::identifiers_to_test_profile_objects($this->get_identifier(), false, true) as $test_profile) { if ($test_profile->test_installation == false || $test_profile->test_installation->get_installed_system_identifier() != phodevi::system_id_string() || pts_c::$test_flags & pts_c::force_install) { return true; } } return false; }
public function needs_updated_install() { // Checks if test needs updating return $this->test_installation == false || $this->get_test_profile_version() != $this->test_installation->get_installed_version() || $this->get_installer_checksum() != $this->test_installation->get_installed_checksum() || $this->test_installation->get_installed_system_identifier() != phodevi::system_id_string(); }
public static function update_test_install_xml(&$test_profile, $this_duration = 0, $is_install = false, $compiler_data = null, $install_footnote = null) { // Refresh/generate an install XML for pts-install.xml if ($test_profile->test_installation == false) { // XXX: Hackish way to avoid problems until this function is better written for clean installations, etc $test_profile->test_installation = new pts_installed_test($test_profile); } $xml_writer = new nye_XmlWriter('file://' . PTS_USER_PATH . 'xsl/' . 'pts-test-installation-viewer.xsl'); $test_duration = $test_profile->test_installation->get_average_run_time(); if (!is_numeric($test_duration) && !$is_install) { $test_duration = $this_duration; } if (!$is_install && is_numeric($this_duration) && $this_duration > 0) { $test_duration = ceil(($test_duration * $test_profile->test_installation->get_run_count() + $this_duration) / ($test_profile->test_installation->get_run_count() + 1)); } $compiler_data = $is_install ? $compiler_data : $test_profile->test_installation->get_compiler_data(); $install_footnote = $is_install ? $install_footnote : $test_profile->test_installation->get_install_footnote(); $test_version = $is_install ? $test_profile->get_test_profile_version() : $test_profile->test_installation->get_installed_version(); $test_checksum = $is_install ? $test_profile->get_installer_checksum() : $test_profile->test_installation->get_installed_checksum(); $sys_identifier = $is_install ? phodevi::system_id_string() : $test_profile->test_installation->get_installed_system_identifier(); $install_time = $is_install ? date('Y-m-d H:i:s') : $test_profile->test_installation->get_install_date_time(); $install_time_length = $is_install ? $this_duration : $test_profile->test_installation->get_latest_install_time(); $latest_run_time = $is_install || $this_duration == 0 ? $test_profile->test_installation->get_latest_run_time() : $this_duration; $times_run = $test_profile->test_installation->get_run_count(); if ($is_install) { $last_run = $latest_run_time; if (empty($last_run)) { $last_run = '0000-00-00 00:00:00'; } } else { $last_run = date('Y-m-d H:i:s'); $times_run++; } $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/Identifier', $test_profile->get_identifier()); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/Version', $test_version); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/CheckSum', $test_checksum); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/CompilerData', json_encode($compiler_data)); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/InstallFootnote', $install_footnote); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/Environment/SystemIdentifier', $sys_identifier); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/InstallTime', $install_time); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/InstallTimeLength', $install_time_length); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/LastRunTime', $last_run); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/TimesRun', $times_run); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/AverageRunTime', $test_duration); $xml_writer->addXmlNode('PhoronixTestSuite/TestInstallation/History/LatestRunTime', $latest_run_time); $xml_writer->saveXMLFile($test_profile->get_install_dir() . 'pts-install.xml'); }