projects / phoronix-test-suite.git / commitdiff
Build Results
 
Summary

Description: Unnamed repository; edit this file to name it for gitweb.
Last Change: Mon 8/30/10 20:43

Recent Commits
Time
Signed-Off By
Description
Commit Diff
Mon 8/30/10 20:43
Michael Larabel  
 
Mon 8/30/10 20:37
Michael Larabel  
pts-core: Last minute... 
Sat 8/28/10 12:53
Michael Larabel  
pts-core: Detect if a... 
Sat 8/28/10 10:34
Michael Larabel  
pts-core: Fix test result... 
Fri 8/27/10 8:51
Michael Larabel  
pts-core: When doing a... 
Wed 8/25/10 18:46
Michael Larabel  
 
 
> --git a/CHANGE-LOG b/CHANGE-LOG
index 67e3e97
..1ad14b2 100644
--- a/CHANGE-LOG
+++ b/CHANGE-LOG
@@ -21,+21,@@ Phoronix Test Suite (Git)
 - 
pts-coreAdd support for /opt/bin/php
 
pts-coreAdd PTS External Dependencies support for Optware
 
pts-coreAdd yasm to PTS External Dependencies
+- pts-coreSupport using PHP's cURL library for handling downloads when available
 - phodevi: Split out phodevi_parser module into phodevi_linux_parser, phodevi_osx_parser, and phodevi_solaris_parser for OS-specific functions
 - phodevi: Avoid situations of the manufacturer/vendor string being repeated in the motherboard property
 - phodevi: Add device notes and special settings string functionality to API
diff --git a/pts-core/library/pts-functions_shell.php b/pts-core/library/pts-functions_shell.php
index 51f8116..d31b78a 100644
--- a/pts-core/library/pts-functions_shell.php
+++ b/pts-core/library/pts-functions_shell.php
@@ -86,22 +86,47 @@ function pts_download($download, $to)
 {
     $to_file = basename($to);
     $to_dir = dirname($to);
-    $download_output = "";
+    $download_output = null;
     $user_agent = pts_codename(true);
+    $connection_timeout = 25;

     if(strpos($to_file, ".") === false)
     {
         $to_file = basename($download);
     }
+
+    if(function_exists("curl_init"))
+    {
+        // TODO: with curl_multi_init we could do multiple downloads at once...
+        $cr = curl_init();
+        $fh = fopen(pts_add_trailing_slash($to_dir) . $to_file, '
w');
+
+        curl_setopt($cr, CURLOPT_FILE, $fh);
+        curl_setopt($cr, CURLOPT_URL, $download);
+        curl_setopt($cr, CURLOPT_HEADER, 0);
+        curl_setopt($cr, CURLOPT_USERAGENT, $user_agent);
+        curl_setopt($cr, CURLOPT_REFERER, "http://www.phoronix-test-suite.com/");
+        curl_setopt($cr, CURLOPT_FOLLOWLOCATION, 1);
+        curl_setopt($cr, CURLOPT_CONNECTTIMEOUT, $connection_timeout);
+
+        if(defined("NETWORK_PROXY"))
+        {
+            curl_setopt($cr, CURLOPT_PROXY, NETWORK_PROXY);
+        }
+
+        curl_exec($cr);
+        curl_close($cr);
+        fclose($fh);
+    }
     else if(($curl = pts_executable_in_path("curl")) != false)
     {
         // curl download
-        $download_output = shell_exec("cd " . $to_dir . " && " . $curl . (defined("NETWORK_PROXY") ? " -x " . NETWORK_PROXY : null) . " -L --fail --connect-timeout 25 --user-agent \"" . $user_agent . "\" " . $download . " > " . $to_file);
+        $download_output = shell_exec("cd " . $to_dir . " && " . $curl . (defined("NETWORK_PROXY") ? " -x " . NETWORK_PROXY : null) . " -L --fail --connect-timeout " . $connection_timeout . " --user-agent \"" . $user_agent . "\" " . $download . " > " . $to_file);
     }
     else if(($wget = pts_executable_in_path("wget")) != false)
     {
         // wget download
-        $download_output = shell_exec((defined("NETWORK_PROXY") ? "export http_proxy=\"" . NETWORK_PROXY . "\"; export ftp_proxy=\"" . NETWORK_PROXY . "\"; " : null) . "cd " . $to_dir . " && " . $wget . " --timeout=25 --tries=3 --user-agent=\"" . $user_agent . "\" " . $download . " -O " . $to_file);
+        $download_output = shell_exec((defined("NETWORK_PROXY") ? "export http_proxy=\"" . NETWORK_PROXY . "\"; export ftp_proxy=\"" . NETWORK_PROXY . "\"; " : null) . "cd " . $to_dir . " && " . $wget . " --timeout=" . $connection_timeout . " --tries=3 --user-agent=\"" . $user_agent . "\" " . $download . " -O " . $to_file);
     }
     else if(IS_BSD && ($ftp = pts_executable_in_path("ftp")) != false)
     {
diff --git a/pts-core/library/pts-includes-run_options.php b/pts-core/library/pts-includes-run_options.php
index 4ae3527..6ccafac 100644
--- a/pts-core/library/pts-includes-run_options.php
+++ b/pts-core/library/pts-includes-run_options.php
@@ -79,7 +79,7 @@ function pts_prompt_test_options($identifier)
                 $value = pts_text_input("Enter Value");
             }

-            array_push($text_args, array(""));
+            array_push($text_args, array($o->format_option_display_from_input($value)));
             array_push($user_args, array($o->format_option_value_from_input($value)));
         }
         else
diff --git a/pts-core/objects/pts_test_option.php b/pts-core/objects/pts_test_option.php
index cf80ca2..7fafed3 100644
--- a/pts-core/objects/pts_test_option.php
+++ b/pts-core/objects/pts_test_option.php
@@ -102,6 +102,12 @@ class pts_test_option
     {
         return $this->get_option_prefix() . $input . $this->get_option_postfix();
     }
+    public function format_option_display_from_input($input)
+    {
+        $name = $this->get_name();
+
+        return $name != null && $input != null ? $name . ": " . $input : null;
+    }
     public function format_option_value_from_select($select_pos)
     {
         $input = $this->get_option_value($select_pos);
@@ -111,14 +117,13 @@ class pts_test_option
     public function format_option_display_from_select($select_pos)
     {
         $display_name = $this->get_option_name($select_pos);
-        $name = $this->get_name();

         if(($cut_point = strpos($display_name, "(")) > 1 && strpos($display_name, ")") > $cut_point)
         {
             $display_name = trim(substr($display_name, 0, $cut_point));
         }

-        return $name != null && $display_name != null ? $this->get_name() . ": " . $display_name : null;
+        return $this->format_option_display_from_input($input);
     }
     public function is_valid_select_choice($select_pos)
  
 
Phoronix.com
Linux Driver Forums
Copyright © 2010 by Phoronix Media