blob: f3f2dabe304710b4673212f18d9b54ef3b38a80a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
<?php
/*
Phoronix Test Suite "Trondheim"
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008, Phoronix Media
Copyright (C) 2008, Michael Larabel
pts-functions-extra.php: "Extra" functions needed for some operations.
*/
function pts_remove_saved_result($identifier)
{
$return_value = false;
if(is_file(SAVE_RESULTS_DIR . $identifier . "/composite.xml"))
{
@unlink(SAVE_RESULTS_DIR . $identifier . "/composite.xml");
foreach(glob(SAVE_RESULTS_DIR . $identifier . "/result-graphs/*.png") as $remove_file)
@unlink($remove_file);
foreach(glob(SAVE_RESULTS_DIR . $identifier . "/test-*.xml") as $remove_file)
@unlink($remove_file);
@unlink(SAVE_RESULTS_DIR . $identifier . "/pts-results-viewer.xsl");
@rmdir(SAVE_RESULTS_DIR . $identifier . "/result-graphs/");
@rmdir(SAVE_RESULTS_DIR . $identifier);
echo "Removed: $identifier\n";
$return_value = true;
}
return $return_value;
}
function pts_tests_in_suite($object)
{
$type = pts_test_type($object);
$tests = array();
if($type == "TEST_SUITE")
{
$xml_parser = new tandem_XmlReader(file_get_contents(XML_SUITE_DIR . $object . ".xml"));
$suite_benchmarks = array_unique($xml_parser->getXMLArrayValues(P_SUITE_TEST_NAME));
foreach($suite_benchmarks as $benchmark)
foreach(pts_tests_in_suite($benchmark) as $sub_test)
array_push($tests, $sub_test);
}
else if($type == "BENCHMARK")
return array($object);
return array_unique($tests);
}
function pts_generate_download_cache()
{
if(!is_dir(PTS_DOWNLOAD_CACHE_DIR))
mkdir(PTS_DOWNLOAD_CACHE_DIR);
$xml_writer = new tandem_XmlWriter();
$xml_writer->addXmlObject(P_CACHE_PTS_VERSION, -1, PTS_VERSION);
$file_counter = 0;
foreach(glob(TEST_RESOURCE_DIR . "*/downloads.xml") as $downloads_file)
{
$test = substr($downloads_file, strlen(TEST_RESOURCE_DIR), 0 - 14);
$xml_parser = new tandem_XmlReader(file_get_contents($downloads_file));
$package_url = $xml_parser->getXMLArrayValues(P_DOWNLOADS_PACKAGE_URL);
$package_md5 = $xml_parser->getXMLArrayValues(P_DOWNLOADS_PACKAGE_MD5);
$package_filename = $xml_parser->getXMLArrayValues(P_DOWNLOADS_PACKAGE_FILENAME);
$download_to = $xml_parser->getXMLArrayValues(P_DOWNLOADS_PACKAGE_DESTINATION);
$cached = false;
echo "\nChecking Downloads For: " . $test . "\n";
for($i = 0; $i < count($package_url); $i++)
{
if(empty($package_filename[$i]))
$package_filename[$i] = basename($package_url[$i]);
if(is_file(PTS_DOWNLOAD_CACHE_DIR . $package_filename[$i]) && md5_file(PTS_DOWNLOAD_CACHE_DIR . $package_filename[$i]) == $package_md5[$i])
{
echo "\tPreviously Cached: " . $package_filename[$i] . "\n";
$cached = true;
}
else
{
|