Compare commits

...

105 Commits

Author SHA1 Message Date
Michael Larabel
90c0b94435 Phoronix Test Suite 5.4 Milestone 3 2014-10-20 20:58:06 -05:00
Michael Larabel
a5a1abe670 phoromatic: Support for deleting results from the web UI's results page 2014-10-20 20:49:19 -05:00
Michael Larabel
2495d01bea phoromatic: Support for merging result files from the results page by clicking on each of them once 2014-10-20 20:29:29 -05:00
Michael Larabel
386ee6e23b phoromatic: Introduce activity stream and logging of user events / display from "activity events" page 2014-10-20 10:32:29 -05:00
Michael Larabel
17c97467d7 phoromatic: Improve schedule display a bit more 2014-10-12 11:55:49 -05:00
Michael Larabel
95431cb944 phoromatic: Support for removing system groups 2014-10-12 11:31:33 -05:00
Michael Larabel
773a9c377c phoromatic: Support for mass editing of systems in groups via the systems page 2014-10-12 11:09:01 -05:00
Michael Larabel
a82c1d8e6d phoromatic: Fix for adding systems to groups 2014-10-12 10:42:42 -05:00
Michael Larabel
192fc1a0cd phoromatic: Add multi-user account documentation 2014-10-11 19:38:15 -05:00
Michael Larabel
8bb6f632bb phoromatic: Add support for the main administrator to create multiple users associated with the same account
phoromatic: Add support for "viewer accounts" where they can view data but not alter/write data
2014-10-11 19:07:01 -05:00
Michael Larabel
59865f49a9 phoromatic: Update the CSS style 2014-10-11 17:12:19 -05:00
Michael Larabel
224f9702ac pts-core: Support for obtaining the local IP on Fedora 2014-10-11 11:53:09 -05:00
Michael Larabel
80f9036327 phoromatic: Support for reporting the network MAC address (for later WoL purposes) 2014-10-11 11:48:57 -05:00
Michael Larabel
d741f9e0ff phoromatic: Support for activating/deactivating "deleting" test schedules from the web UI 2014-10-11 11:22:55 -05:00
Michael Larabel
14d42b51e3 phoromatic: Support for editing schedules from the web UI 2014-10-11 11:02:11 -05:00
Michael Larabel
c597a2dadd pts-core: Fix RPM package generation with Upstart files 2014-10-09 11:48:44 -05:00
Michael Larabel
aa6e10a4b8 install-sh: Just always install the systemd service and Upstart conf files 2014-10-09 11:38:15 -05:00
Michael Larabel
32c6e2d371 install-sh: update 2014-10-08 15:42:30 -05:00
Michael Larabel
f0b4e85a5b pts-core: Fix systemd service file installation 2014-10-08 15:41:04 -05:00
Michael Larabel
7c55979561 phoromatic: Add new create schedule interface
phoromatic: Properly hook in system ID / group validation for test schedules
2014-10-08 14:58:21 -05:00
Michael Larabel
f63976e833 pts-core: Notice fix 2014-10-08 10:56:35 -05:00
Michael Larabel
06743fc076 phoromatic: Save admin/administrator usernames for other purposes 2014-10-06 17:16:57 -05:00
Michael Larabel
2249328776 phoromatic: Better documentation on the log-in page 2014-10-06 16:58:10 -05:00
Michael Larabel
65ab3b5aca pts-core: Fix whoops from previous commit 2014-10-06 10:51:53 -05:00
Michael Larabel
1bae8b3541 pts-core: Try downloading files from remote download caches up to two times in event of failure / checksum issues 2014-10-06 10:51:14 -05:00
Michael Larabel
9a8e005a79 pts-core: More error logging work 2014-10-06 10:31:44 -05:00
Michael Larabel
0c547a65d0 phoromatic: Avoid duplicate log messages 2014-10-06 10:20:06 -05:00
Michael Larabel
0cc646a60d phoromatic: Clean up DEBUG TEST message 2014-10-06 10:18:14 -05:00
Michael Larabel
414acebf64 pts-core: Start generating log file for the Phoromatic client 2014-10-06 10:11:00 -05:00
Michael Larabel
2b0364464e phoromatic: Start a basic logger of Phoromatic Server events 2014-10-06 09:49:33 -05:00
Michael Larabel
be57f8eafc Phoronix Test Suite 5.4-Lipki Milestone 2 2014-10-05 20:34:38 -05:00
Michael Larabel
8f41896a47 phoromatic: Add a cache settings page to the web interface 2014-10-05 20:22:34 -05:00
Michael Larabel
0e1c62051e pts-core: Initial Upstart and systemd configurations for the Phoromatic clients 2014-10-05 14:44:37 -05:00
Michael Larabel
d2a12edb06 pts-core: Start on Phoromatic Server documentation 2014-10-05 14:30:57 -05:00
Michael Larabel
18f81f6c38 phoromatic: defined 2014-10-05 12:25:54 -05:00
Michael Larabel
3706917cc3 phoromatic: Ignore warning on no PTS_GSID 2014-10-05 12:25:19 -05:00
Michael Larabel
ee1e5f932c pts-core: Allow discovery of Phoromatic Server account associated with it by the PTS machine ID 2014-10-05 12:24:03 -05:00
Michael Larabel
96463b0eae pts-core: ; typo 2014-10-05 11:53:07 -05:00
Michael Larabel
b623d305f4 pts-core: Allow PhoromaticServers user-config.xml to specify static Phoromatic Server IP:port information 2014-10-05 11:47:21 -05:00
Michael Larabel
12df1c8316 pts-core: Crash fix if passing an object name to the command line and the module_manager attempts to try to access a non-existant class constant 2014-10-05 11:28:57 -05:00
Michael Larabel
d55d27e816 pts-core: Move the Phoromatic Server probing to be dynamic when needed rather than always on start-up 2014-10-05 11:26:10 -05:00
Michael Larabel
a0177952b6 phoromatic: Add phoromatic.explore sub-command for showing discovered Phoromatic servers and their server/debugging information 2014-10-05 11:17:10 -05:00
Michael Larabel
ea3eec6438 pts-core: Fix 2014-10-05 10:18:02 -05:00
Michael Larabel
fa63231915 pts-core: Typo fix 2014-10-05 10:15:51 -05:00
Michael Larabel
8ba0f420cd pts-core: Don't probe Phoromatic server duplicates 2014-10-05 10:15:08 -05:00
Michael Larabel
a855d5560b pts-core: Introduce pts_client::available_phoromatic_servers() 2014-10-05 10:12:30 -05:00
Michael Larabel
202e1745ca pts-core: Introduce make-openbenchmarking-cache sub-command for trying to cache all test/suite meta-data from OpenBenchmarking.org 2014-10-05 09:52:13 -05:00
Michael Larabel
7a1fda21ff pts-core: Be sure to remove broken/old Phoromatic Servers previously detected 2014-10-04 19:41:23 -05:00
Michael Larabel
d1cf5938f2 pts-core: Allow result file titles up to 126 characters in length 2014-10-04 18:22:46 -05:00
Michael Larabel
d1ca6ad9f5 pts-core: Should fix systems that result in endless forking when the PTS test installer compiler mask picks up a compiler with ccache 2014-10-04 17:00:21 -05:00
Michael Larabel
5e69a0cc7f system_monitor: Allow user-set time interval period between sensor measurements using MONITOR_INTERVAL environment variable 2014-10-04 16:49:07 -05:00
Michael Larabel
b0833c1437 pts-core: Introduce machine_self_id as UUIDv5 compliant self-generated unique identifier for each PTS client
phoromatic: Support pts-core's machine_self_id for system identification as an alternative to OpenBenchmarking.org GSID
2014-10-04 16:27:26 -05:00
Michael Larabel
e88592b1ee pts-core: Improved dump-core-storage output 2014-10-04 15:18:23 -05:00
Michael Larabel
f7bba09772 pts-core: Few more Internet checks 2014-10-04 14:34:34 -05:00
Michael Larabel
28d00c08cf pts-core: Few more Internet support checks 2014-10-04 14:05:15 -05:00
Michael Larabel
0b8702bf0f pts-core: Couple installer improvements when Internet is not present 2014-10-04 13:42:23 -05:00
Michael Larabel
5c2fe4ef86 phoromatic: Allow sharing OpenBenchmarking.org index/test/suite cache data from server with local Phoromatic clients 2014-10-04 13:09:02 -05:00
Michael Larabel
73e8368ee0 pts-core: OpenBenchmarking tweaks for earlier commit 2014-10-04 12:56:44 -05:00
Michael Larabel
7679af256b pts-core: Typo fix 2014-10-04 12:05:25 -05:00
Michael Larabel
378bb49dd9 pts-core: Client support for being able to obtain OpenBenchmarking.org index/test/suite data from local Phoromatic Servers 2014-10-04 12:02:42 -05:00
Michael Larabel
762d98c6a2 pts-core: Make sure dpkg is present when running the build-package-deb script 2014-10-04 10:20:24 -05:00
Michael Larabel
69f449b199 phodevi: Restructure when /etc/os-release is parsed for obtaining OS name/version information 2014-10-04 10:05:08 -05:00
Michael Larabel
b7d4a31805 pts_Graph: Fix for horizontal box plot graphs with certain values where their top end line is being cut off 2014-10-04 09:31:07 -05:00
Michael Larabel
6f00af8ddb phoromatic: Support the /usr/share/phoronix-test-suite/download-cache/ location 2014-10-03 12:58:03 -05:00
Michael Larabel
05b4c90ba1 pts-core: Support /usr/share/phoronix-test-suite/download-cache as another download cache by default 2014-10-03 12:56:14 -05:00
Michael Larabel
d35573ae97 pts-core: User configuration XML handling improvements 2014-10-03 10:34:19 -05:00
Michael Larabel
4620ac6af6 pts-core: More systemd-related work 2014-10-03 10:06:23 -05:00
Michael Larabel
b30be27c68 pts-core: Start work on phoromatic-server systemd instance 2014-10-02 16:59:17 -05:00
Michael Larabel
9d307ca2fc pts-core: Rewrite most of the RPM package generator 2014-10-02 10:11:40 -05:00
Michael Larabel
8ce35dd771 - phodevi: Allow multiple providers for one VFS entry in case of failure in prior commands/files
- phodevi: Allow reading X Server log from the systemd journalctl
2014-10-02 10:09:20 -05:00
Michael Larabel
123f982898 phodevi: Allow GPU frequency detection for DRM/KMS drivers when no X Server DDX is detected 2014-10-02 10:07:56 -05:00
Michael Larabel
eceaf92806 pts-core: Couple small changes 2014-09-23 10:49:16 -05:00
Michael Larabel
2bbe0e02dc pts-core: Missing file check for pts_test_file_download->check_file_hash() 2014-09-22 15:14:05 -05:00
Michael Larabel
b9f2e48f11 Bump PTS_CORE_VERSION after the recent changes 2014-09-22 14:24:32 -05:00
Michael Larabel
9eb323e9a7 pts-core: Allow Phoronix Test Suite clients to automatically discover Phoromatic download-cache archives
phoromatic: Automatically setup download-cache over Phoromatic HTTP with the system's local download-cache archive
2014-09-22 14:02:38 -05:00
Michael Larabel
1cb10c3c35 pts-core: Convert to a JSON-based representation instead of XML for the pts-download-cache file
pts-core: Various file hash checking improvements during test installation
2014-09-22 12:23:06 -05:00
Michael Larabel
21817cd187 pts-core: Add "failed to load" to the scan_for_error of test execution failures 2014-09-22 09:15:47 -05:00
Michael Larabel
86519919da pts-core: From copy and paste of previous commit, don't need stripos on 404 number, only strpos 2014-09-22 09:08:28 -05:00
Michael Larabel
479d153262 pts-core: Improved detection of file downloads that fail and serve HTML 404/not found responses 2014-09-22 09:07:30 -05:00
Michael Larabel
99e3d6b62a pts-core: Update make-download-cache description 2014-09-21 21:24:24 -05:00
Michael Larabel
9e11eb6ebe pts-core: Allow passing arguments to make-download-cache 2014-09-21 21:22:39 -05:00
Michael Larabel
1d5c4b88f5 pts-core: Improvements to make-download-cache 2014-09-21 21:19:13 -05:00
Michael Larabel
16ee622c5f phoromatic: Update the new server.php information file 2014-09-21 20:47:16 -05:00
Michael Larabel
fe76aa3bed pts-core: Add support to PTS clients for automatically finding Phoromatic Servers using Avahi zero-conf network discovery
The infrastructure support is in place. The rest of the client code still needs to build upon it...
2014-09-21 20:44:56 -05:00
Michael Larabel
bb5385e3f6 pts-core: Separate out NoNetworkCommunication user option into NoInternetCommunication/NoNetworkCommunication user config options for those still wanting LAN/intranet support 2014-09-21 19:56:03 -05:00
Michael Larabel
e1e5ab55d4 phoromatic: Advertise Phoromatic Server using Advahi zero-conf networking service when avahi-publish available and AdvertiseServiceZeroConf user config option is TRUE 2014-09-21 19:32:04 -05:00
Michael Larabel
5c937d0a19 phoromatic: With this latest client/server code, local (behind firewall) result uploads are now possible and don't depend on OpenBenchmarking.org. 2014-09-21 16:51:21 -05:00
Michael Larabel
f5465f6634 phoromatic: Client-side changes shared with OB for uploading test results directly to Phoromatic server 2014-09-20 18:27:07 -05:00
Michael Larabel
7c89a57a35 phoromatic: Add SQLite schema changes for local results storage, based on OpenBenchmarking.org schema. 2014-09-20 17:46:10 -05:00
Michael Larabel
d7842c0ef6 pts-core: Rename debug-run mode to debug-benchmark, add extra features 2014-09-13 20:32:56 -05:00
Michael Larabel
ae51b7a333 pts-core: Bump core version to 5311 after the result file parsing improvements 2014-09-13 10:40:30 -05:00
Michael Larabel
2289cbad2b - pts-core: Add "ResultAfterString" to test result parser XML schema
- pts-core: Other result file parsing improvements/fixes
2014-09-13 10:31:50 -05:00
Michael Larabel
7d4773be31 Phoronix Test Suite 5.4 Milestone 1 2014-09-05 12:16:52 -05:00
Michael Larabel
89443b99c8 phodevi: Improved SoC detection 2014-09-05 09:15:26 -05:00
Michael Larabel
e6555dca53 pts_LineGraph: Alignment fix for keys 2014-09-04 09:11:51 -05:00
Michael Larabel
f510712cc6 phodevi: Improvement to monitor name EDID parsing 2014-08-30 23:37:41 -05:00
Michael Larabel
eb126f7e39 pts-core: Drop phoromatic_legacy support (old Phoromatic.com version) 2014-08-30 23:02:03 -05:00
Michael Larabel
44881b0ecb Should have bumped the development version numbering a while ago... PTS 5.4 Lipki development. 2014-08-30 22:40:14 -05:00
Michael Larabel
b3891efa11 phodevi: Support for reading monitor EDID over sysfs, decoding descriptors, and obtaining monitor name 2014-08-30 22:38:53 -05:00
Michael Larabel
fadada1130 pts-core: Don't set memory_limit with HHVM 2014-08-29 08:57:34 -05:00
Michael Larabel
aa6b123d71 Bug fix 2014-08-29 06:54:20 -05:00
Michael Larabel
d23bca1c46 system_monitor: Correct perf-per-Watt calculation for LIB results 2014-08-28 20:37:41 -05:00
Michael Larabel
18a8f03a89 phodevi: Support Nouveau's pstate formatting changes to read core/mem MHz on newer kernels 2014-08-27 16:23:59 -05:00
Michael Larabel
222cc70b86 pts_webui: SERVER_ADDR fix - http://www.phoronix.com/forums/showthread.php?102512-Remote-gui-not-accessible-in-Phoronix-Test-Suite-5-2&p=430312#post430312 2014-07-23 09:50:53 -05:00
Michael Larabel
810d4ce8e2 pts-core: Sanitize pts_result_file user strings 2014-07-18 07:58:45 -05:00
93 changed files with 3609 additions and 1654 deletions

View File

@@ -1,5 +1,75 @@
PHORONIX TEST SUITE CHANGE-LOG
Phoronix Test Suite 5.4 Milestone 3
20 October 2014
- pts-core: Introduce basic system logging capabilities for services
- pts-core: Try downloading files from remote download caches up to two times in event of failure / checksum issues
- phoromatic: Start a basic logger of Phoromatic Server events
- phoromatic: Add new create schedule interface
- phoromatic: Properly hook in system ID / group validation for test schedules
- phoromatic: Support for editing schedules from the web UI
- phoromatic: Support for activating/deactivating "deleting" test schedules from the web UI
- phoromatic: Support for reporting the network MAC address (for later WoL purposes)
- phoromatic: Update the CSS style
- phoromatic: Add support for the main administrator to create multiple users associated with the same account
- phoromatic: Add support for "viewer accounts" where they can view data but not alter/write data
- phoromatic: Fix for adding systems to groups
- phoromatic: Support for mass editing of systems in groups via the systems page
- phoromatic: Support for removing system groups
- phoromatic: Introduce activity stream and logging of user events / display from "activity events" page
- phoromatic: Support for merging result files from the results page by clicking on each of them once
- phoromatic: Support for deleting results from the web UI's results page
Phoronix Test Suite 5.4 Milestone 2
5 October 2014
- pts-core: Add "ResultAfterString" to test result parser XML schema
- pts-core: Other result file parsing improvements/fixes
- pts-core: Rename debug-run mode to debug-benchmark, add extra features
- pts-core: Separate out NoNetworkCommunication user option into NoInternetCommunication/NoNetworkCommunication user config options for those still wanting LAN/intranet support
- pts-core: Add support to PTS clients for automatically finding Phoromatic Servers using Avahi zero-conf network discovery
- pts-core: Improvements to make-download-cache
- pts-core: Improved detection of file downloads that fail and serve HTML 404/not found responses
- pts-core: Convert to a JSON-based representation instead of XML for the pts-download-cache file
- pts-core: Various file hash checking improvements during test installation
- pts-core: Allow Phoronix Test Suite clients to automatically discover Phoromatic download-cache archives
- pts-core: Rewrite most of the RPM package generator
- pts-core: Support /usr/share/phoronix-test-suite/download-cache as another download cache by default
- pts-core: Client support for being able to obtain OpenBenchmarking.org index/test/suite data from local Phoromatic Servers
- pts-core: Improved dump-core-storage output
- pts-core: Introduce machine_self_id as UUIDv5 compliant self-generated unique identifier for each PTS client
- pts-core: Allow result file titles up to 126 characters in length
- pts-core: Add start of basic Phoromatic Server systemd service file
- pts-core: Add start of basic Phoromatic Server Upstart conf file
- pts-core: Introduce make-openbenchmarking-cache sub-command for trying to cache all test/suite meta-data from OpenBenchmarking.org
- pts-core: Allow PhoromaticServers user-config.xml to specify static Phoromatic Server IP:port information
- pts-core: Initial Upstart and systemd configurations for the Phoromatic clients
- phoromatic: Begin allowing results to be stored locally, not dependent on OpenBenchmarking.org storage
- phoromatic: Advertise Phoromatic Server using Avahi zero-conf networking service when avahi-publish available and AdvertiseServiceZeroConf user config option is TRUE
- phoromatic: Automatically setup download-cache over Phoromatic HTTP with the system's local download-cache archive
- phoromatic: Allow sharing OpenBenchmarking.org index/test/suite cache data from server with local Phoromatic clients
- phoromatic: Support pts-core's machine_self_id for system identification as an alternative to OpenBenchmarking.org GSID
- phoromatic: Add phoromatic.explore sub-command for showing discovered Phoromatic servers and their server/debugging information
- phoromatic: Add a cache settings page to the web interface
- phodevi: Allow GPU frequency detection for DRM/KMS drivers when no X Server DDX is detected
- phodevi: Allow multiple providers for one VFS entry in case of failure in prior commands/files
- phodevi: Allow reading X Server log from the systemd journalctl
- phodevi: Restructure when /etc/os-release is parsed for obtaining OS name/version information
- system_monitor: Allow user-set time interval period between sensor measurements using MONITOR_INTERVAL environment variable
Phoronix Test Suite 5.4 Milestone 1
5 September 2014
- pts-core: Sanitize pts_result_file user strings
- pts-core: Don't set memory_limit with HHVM
- pts-core: Drop phoromatic_legacy support (old Phoromatic.com version)
- system_monitor: Correct perf-per-Watt calculation for LIB results
- phodevi: Support Nouveau's pstate formatting changes to read core/mem MHz on newer kernels
- phodevi: Support for reading monitor EDID over sysfs, decoding descriptors, and obtaining monitor name (should improve monitor name reporting for Intel Linux systems)
- phodevi: Improved SoC detection
- pts_LineGraph: Alignment fix for keys
Phoronix Test Suite 5.2.1-Khanino
11 July 2014

2
README
View File

@@ -1,4 +1,4 @@
Phoronix Test Suite 5.2.1
Phoronix Test Suite 5.4.0m3
http://www.phoronix-test-suite.com/
#####################################

View File

@@ -1,4 +1,4 @@
.TH phoronix-test-suite 1 "www.phoronix-test-suite.com" "5.2.1"
.TH phoronix-test-suite 1 "www.phoronix-test-suite.com" "5.4.0m3"
.SH NAME
phoronix-test-suite \- The Phoronix Test Suite is an extensible open-source platform for performing testing and performance evaluation.
.SH SYNOPSIS
@@ -17,7 +17,7 @@ This option will install the selected test(s) inside the testing environment dir
This option will install the external dependencies needed by the selected test(s) using the distribution's package management system. For example, some tests depend upon GCC for compiling code. If GCC is not detected on the system, the Phoronix Test Suite will attempt to install GCC using the distribution's package management system. If you are running this command as a local user, you may be prompted for the root password while the process is running. For unsupported distributions, the dependency names will be displayed along with common names for the package. The install-dependencies option needs to be supplied with the test name or suite as an argument. When using the install option, the external dependencies are automatically checked.
.TP
.B make-download-cache
This option will create a download cache for use by the Phoronix Test Suite.
This option will create a download cache for use by the Phoronix Test Suite. The download cache is created of test files already downloaded to the local system. If passing any test/suite names to make-download-cache, the needed files for those test profiles will first be automatically downloaded before creating the cache.
.TP
.B remove-installed-test [Test]
This option will permanently remove a installed test by the Phoronix Test Suite.
@@ -70,6 +70,9 @@ This option will download a local copy of a file that was saved to OpenBenchmark
.B list-recommended-tests
This option will list recommended test profiles for benchmarking sorted by hardware sub-system. The recommended tests are determined via querying OpenBenchmarking.org and determining the most popular tests for a given environment based upon the number of times a test profile has been downloaded, the number of test results available on OpenBenchmarking.org for a given test profile, the age of the test profile, and other weighted factors.
.TP
.B make-openbenchmarking-cache
This option will attempt to cache the test profile/suite meta-data from OpenBenchmarking.org for all linked repositories. This is useful if you're going to be running the Phoronix Test Suite / Phoromatic behind a firewall or without any Internet connection. Those with unrestricted Internet access or not utilizing a large local deployment of the Phoronix Test Suite / Phoromatic shouldn't need to run this command.
.TP
.B openbenchmarking-changes
This option will list recent changes to test profiles of enabled OpenBenchmarking.org repositories.
.TP
@@ -148,12 +151,12 @@ This option will list various details about installed tests and their usage.
This option will list all available test profiles that are available from the enabled OpenBenchmarking.org repositories but are NOT SUPPORTED on the given hardware/software platform. This is mainly a debugging option for those looking for test profiles to potentially port to new platforms, etc.
.TP
.SH ASSET CREATION
.B debug-benchmark [Test | Suite | OpenBenchmarking.org ID | Test Result] ...
This option is intended for use by test profile writers and is identical to the <em>run</em> option but will yield more information during the run process that can be used to debug issues with a test profile or to verify the test profile is functioning correctly.
.TP
.B debug-install [Test | Suite | OpenBenchmarking.org ID | Test Result] ...
This option is intended for use by test profile writers and is identical to the install option but will yield more information during the run process that can be used to debug issues with a test profile installer or to verify the test profile is functioning correctly.
.TP
.B debug-run [Test | Suite | OpenBenchmarking.org ID | Test Result] ...
This option is intended for use by test profile writers and is identical to the <em>run</em> option but will yield more information during the run process that can be used to debug issues with a test profile or to verify the test profile is functioning correctly.
.TP
.B debug-test-download-links [Test | Suite]
This option will check all download links within the specified test profile(s) to ensure there are no broken URLs.
.TP
@@ -261,7 +264,7 @@ This option will display the Phoronix Test Suite client version.
Launch the Phoronix Test Suite HTML5 web user-interface in the local GUI mode (no remote web support) and attempt to auto-launch the web-browser.
.TP
.B start-remote-gui-server
Start the GUI web server and WebSocket server processes for remote (or local) access via the web-browser. The settings can be configured via the Phoronix Test Suite's user-config.xml configuration file.
Start the GUI web server and WebSocket server processes for remote (or local) access via the web-browser. The settings can be configured via the Phoronix Test Suite's XML configuration file.
.TP
.B start-ws-server
Manually start a WebSocket server for communication by remote Phoronix Test Suite GUIs, the Phoronix Test Suite Multi-System Commander, and other functionality.
@@ -280,7 +283,7 @@ This option will allow you to configure all available end-user options for a Pho
This option can be used for debugging a Phoronix Test Suite module.
.TP
.SH GUI / WEB SUPPORT
.B r
.B e
p
.TP
.SH SEE ALSO

View File

@@ -0,0 +1,81 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<Title>Phoronix Test Suite Phoromatic</Title>
</head>
<body>
<h1>Phoromatic Server</h1>
<p><em>This documentation is a work-in-progress and will be firmed up by the Phoronix Test Suite 5.4 official release planned for November 2014.</em></p>
<h2>Introduction</h2>
<p>Phoromatic is a remote management system for the Phoronix Test Suite. Phoromatic allows the automatic (hence the name <em>Phoro-matic</em>) scheduling of tests, remote installation of new tests, and the management of multiple test systems all through an intuitive, easy-to-use web interface. Tests can be scheduled to automatically run on a routine basis across multiple test systems. The test results are then available from this central, secure location.</p>
<p>Phoromatic was originally introduced with Phoronix Test Suite 2.0 via Phoromatic.com as a project going back to 2008~2009. Phoromatic.com debuted as a hosted instance with the option of behind-the-firewall licensing for use within organizations. With Phoronix Test Suite 5.2 the model shifted to offer a local, open-source version of Phoromatic built into the Phoronix Test Suite code-base. Thanks to continued enterprise development, with Phoronix Test Suite 5.4 is now a fully-functioning, built-in version of Phoromatic that's open-source and can be used for behind-the-firewall testing without needing to push results to OpenBenchmarking.org and the ability to keep all results private.</p>
<p>Phoromatic in Phoronix Test Suite 5.4 also has the ability to support zero-conf network discovery using Avahi and the automatic distribution of needed test profiles/suites and test files. Phoronix Test Suite 5.4's Phoromatic is a significant breakthrough for open-source testing particularly those running this GPL benchmarking software within test labs and other large organizations.</p>
<h2>Features<h2>
<p>Built atop the Phoronix Test Suite, Phoromatic offers many features for both enterprise and community/personal users:</p>
<h3>Automated Scheduling</h3>
<p>Whether it is every evening at 6:00PM, once every Thursday at 10:00AM or somewhere in between, Phoromatic can schedule tests to be run at user-defined intervals. The testing schedules can be updated through Phoromatic web interface. After the test(s) have run, the results will be immediately uploaded to Phoromatic.</p>
<h3>Extensible</h3>
<p>Any test profile or test suite that is compliant with the Phoronix Test Suite specification will work with Phoromatic. Phoromatic is able to leverage the hundreds of test profiles and test suites currently in the Phoronix Test Suite via OpenBenchmarking.org, along with any custom or proprietary test profiles you or your company utilize. Additionally, the Phoromatic interface allows the user to construct their own test suite(s).</p>
<h3>Remote Testing</h3>
<p>Once the test system is setup, all testing and management of that system can be done remotely. There is no need to execute Phoronix Test Suite commands locally using the GUI or command line version, but instead nearly all of the same features are accessible from the Phoromatic interface.</p>
<h3>Multi-System Support</h3>
<p>A single Phoromatic account is able to manage multiple test systems running the Phoronix Test Suite. Phoromatic supports grouping together test systems, tagging, and other features to support effectively managing many test systems. From the Phoromatic interface, installed system hardware and software from a given system can also be viewed.</p>
<h3>Turn-Key Deployment</h3>
<p>No additional software needs to be installed to support Phoromatic; all that's needed is Phoronix Test Suite 5.4 or later for full compatibility. New test systems can easily be synced with a given Phoromatic account by running a single command from the Phoronix Test Suite client.</p>
<h3>Result Management</h3>
<p>Test results are automatically uploaded to the Phoromatic account and remain private unless you opt to upload them to OpenBenchmarking.org. From the Phoromatic interface, results from multiple test systems can easily be compared and multiple results from the same systems can be used to track performance over time. There are also options to look at the statistical significance of the results and other features to efficiently and effectively analyze the system's performance.</p>
<h3>Decentralized</h3>
<p>Once the Phoronix Test Suite running on the Phoromatic Server has been able to cache all of the OpenBenchmarking.org test files and the needed files for each test, Phoromatic with any Phoronix Test Suite clients on your LAN can run fully decentralized without the need for a constant stream of OpenBenchmarking.org communication or Internet connection for that matter. (The only exception would be if your local systems don't have all their needed external dependencies and your system's package manager would need to install components like a compiler or necessary system libraries.</p>
<h3>Fully Open-Source</h3>
<p>Phoromatic is now fully open-source within the Phoronix Test Suite code-base for fostering greater development and new capabilities. Patches are welcome and Phoronix Media is available to provide commercial support and custom engineering services around Phoromatic and the Phoronix Test Suite.</p>
<h2>Phoromatic Server Setup</h2>
<p>Phoromatic is built into the Phoronix Test Suite code-base and should be found in all packaged versions of the <strong>phoronix-test-suite</strong>. Starting the Phoromatic Server entails running phoronix-test-suite start-phoromatic-server after configuring the server information within <em>~/.phoronix-test-suite/user-config.xml</em>. The Phoromatic Server can with or without root permissions depending upon your firewall and the port numbers you wish to use for the server.</p>
<p>On the "client side", any up-to-date version of the Phoronix Test Suite can automatically communicate with the Phoromatic Server. If Avahi support is available (commonly in Linux distribution repositories as <u>avahi-tools</u>), there should be zero-conf discovery if the Phoromatic Server and client systems are on the same LAN. If a Phoronix Test Suite client discovers a Phoromatic Server, it will attempt to use it automatically as a local download cache. In the event of no Internet connection, it will also attempt to obtain the needed OpenBenchmarking.org test/suite meta-data from the Phoromatic Server based upon its archived meta-data. This allows the Phoronix Test Suite / Phoromatic deployment on the LAN to be self-sustaining without an Internet connection as long as the systems have all installed test dependencies.</p>
<p>Further configuration of the setup parameters for the Phoromatic Server and Phoronix Test Suite clients can be tuned via the <em>~/.phoronix-test-suite/user-config.xml</em> file. All control and configuration of the Phoromatic Server is done via the web-based interface when the Phoromatic Server is active.</p>
<p>The Phoromatic Server utilizes PHP/HHVM's built-in web-server capabilities and there's also a Phoronix Test Suite built-in WebSocket server that's also initiated for back-end processing. At this time there are no ports set by default for these services but must be defined within the user configuration file. With the Avahi zero-conf network discovery and other automated detection in place, there's little restrictions over the port selection.</p>
<p>Systemd and Upstart service files are shipped with the Phoronix Test Suite for those that wish to have the services automatically run as daemons. The only new requirements over the basic Phoronix Test Suite system requirements is having PHP-SQLite support installed and the newer version of PHP or HHVM is recommended for offering the best support.</p>
<h2>Example Deployments</h2>
<h3>Use Case A: Unrestricted Internet Access, Local Result Storage</h3>
<p>Systems on your network with unrestricted Internet access is the easiest and simplest deployment for the Phoronix Test Suite and Phoromatic. After installing the Phoronix Test Suite on the system you wish to designate the Phoromatic Server and have configured the <em>user-config.xml</em> file, simply run:</p>
<p><strong>$ phoronix-test-suite start-phoromatic-server</strong></p>
<p>Assuming you have no firewall or permission issues, the built-in web server and WebSocket server should proceed to initiate along with outputting the IP/port information for these services. Unless otherwise disabled from the user configuration file and if avahi-tools is present, the Phoromatic Server will be advertised with Avahi for zero-configuration networking.</p>
<p>From the Phoromatic web interface you are able to create an account and from there proceed with the creating of test schedules, updating settings, and connecting systems. From the "client systems" you wish to use as the benchmarking nodes, it's simply a matter of running <strong>phoronix-test-suite phoromatic.connect</strong> with zero-conf networking or otherwise follow the information from the Phoromatic web interface for manual setup with the IP/port information.</p>
<h3>Use Case B: No Internet Available To Client Systems</h3>
<p>It's possible to run the Phoronix Test Suite and Phoromatic Server without a persistent Internet connection as long as you are able to first download the necessary files to the Phoromatic Server. After installing the Phoronix Test Suite on the system you wish to designate the Phoromatic Server and have configured the <em>user-config.xml</em> file, a few commands from the system while having an Internet connection will be able to cache the needed data:</p>
<p><strong>$ phoronix-test-suite make-download-cache x264 xonotic ffmpeg</strong></p>
<p>This command will simply download all of the needed test files for the tests/suites passed to the sub-command. Alternatively you could also pass pts/all to cache all tests. It's important though to just cache the tests/suites you'll be using on your network. This will generate the test file download cache by default to <em>~/.phoronix-test-suite/download-cache/</em> or <em>/usr/share/phoronix-test-suite/download-cache/</em> depending upon your write permissions. You can always run this command later with more test files. Alternatively, if you already have a number of tests installed on the system, simply running "phoronix-test-suite make-download-cache" will generate the cache based upon the currently installed tests.</p>
<p><strong>$ phoronix-test-suite make-openbenchmarking-cache</strong></p>
<p>This command will cache as much of the OpenBenchmarking.org meta-data as possible for test profiles and test suites. After the above commands, the Phoromatic Server should no longer need a persistent Internet connection.</p>
<p><strong>$ phororonix-test-suite start-phoromatic-server</strong></p>
<p>Proceed to start the Phoromatic Server and operate as normal.</p>
<p>For the test clients without an Internet connection, as long as they're able to reach the Phoromatic Server, the Phoromatic Server should be able to automatically serve all of the needed test files download cache and OpenBenchmarking.org meta-data to the systems locally.</p>
<h3>Use Case C: Phoromatic Across The Internet</h3>
<p>If wishing to use the same Phoromatic Server across multiple geographic locations, it's easily possible -- you just lose out on the zero-conf networking ability. To let the Phoronix Test Suite client systems know about the remote Phoromatic Server, simply add the Phoromatic Server information to the client's <em>PhoromaticServers</em> element within the <em>user-config.xml</em>. Of course, make sure the Phoromatic Server has a globally resolvable IP address and its Phoromatic HTTP/WebSocket ports are open. Once informing the client of the Phoromatic Server, the use cases as above apply in the same manner.</p>
<h2>Client Setup</h2>
<p>From Phoronix Test Suite client systems running on the LAN, the following command will report all available detected Phoromatic Servers along with important server and debugging information:</p>
<p><strong>$ phoronix-test-suite phoromatic.explore</strong></p>
<p>With the following example output on finding one successful server:</p>
<p><em>IP: 192.168.1.211<br />
HTTP PORT: 5447<br />
WEBSOCKET PORT: 5427<br />
SERVER: PHP 5.5.9-1ubuntu4.4 Development Server<br />
PHORONIX TEST SUITE: Phoronix Test Suite v5.4.0m1 [5313]<br />
DOWNLOAD CACHE: 19 FILES / 2390 MB CACHE SIZE<br />
SUPPORTED OPENBENCHMARKING.ORG REPOSITORIES:<br />
pts - Last Generated: 05 Oct 2014 07:16</em></p>
<p>Phoromatic Servers are detected by the Phoronix Test Suite through Avahi or if manually configuring the Phoronix Test Suite clients to point to Phoromatic Servers. For networks without Avahi/auto-discovery support or for test systems that may be connecting from another network, the IP address and HTTP port number can be added to the local system's <em>~/.phoronix-test-suite/user-config.xml</em> with the <em>PhoromaticServers</em> element. Adding the <em>IP:port</em> (the Phoromatic Server's HTTP port) to the PhoromaticServers <em>user-config.xml</em> element for will perform targeted probing by the Phoronix Test Suite without any dependence on Avahi. Multiple Phoromatic Servers can be added if each IP:port is delimited by a comma.</p>
<p>To connect a Phoronix Test Suite system for benchmarking to an account, log into your Phoromatic account from the web-interface and on the main/system pages will be instructions along with a specially formed string to run, e.g. <em>phoronix-test-suite phoromatic.connect 192.168.1.211:5447/I0SSJY</em>. When running that command once on the system(s) to be synced to that account, as the administrator you'll be able to validate/approve the systems from the Phoromatic web interface. After that, whenever the system(s) are to be running benchmarks, simply have the <strong>phoronix-test-suite phoromatic.connect</strong> command running on the system (after the initial account has been synced, simply running <strong>phoronix-test-suite phoromatic.connect</strong> is enough for the system to find the server and its account).</p>
<h2>Other Advice</h2>
<h3>Disable Internet Precaution</h3>
<p>If you have an Internet connection but want to ensure your Phoronix Test Suite client doesn't attempt to use it for any matter, via the <em>~/.phoronix-test-suite/user-config.xml</em> you can set <em>NoInternetCommunication</em> to <em>TRUE</em>. There's also a NoNetworkCommunication tag, but setting that to TRUE will disable any form of network communication -- including communication with the Phoromatic Server.</p>
<h3>Ports / Services</h3>
<p>The Phoromatic Server process currently relies upon a PHP/HHVM built-in web server process and a PTS-hosted WebSocket server. The web server process handles the web UI and much of the responsibilities of the Phoromatic Server. Over time the PTS WebSocket server will be increasingly utilized for bi-directional, real-time communication between the server and clients -- including for features like viewing real-time hardware sensors of client systems from the server UI.</p>
<h3>Systemd / Upstart</h3>
<p>Packaged with the Phoronix Test Suite are basic <em>phoromatic-client</em> and <em>phoromatic-server</em> configurations for both Upstart and systemd init systems. The <em>phoromatic-server</em> configuration will launch the Phoronix Test Suite's Phoromatic Server and the <em>phoromatic-client</em> service will attempt to connect to a <u>pre-configured</u> Phoromatic Server.</p>
<h3>Cache Verification</h3>
<p>To confirm the files accessible to Phoronix Test Suite client systems, from the Phoromatic Server web user-interface go to the <em>settings</em> page followed by the <em>cache settings</em> link to view information about the download and OpenBenchmarking.org caches. From the client systems, running <strong>phoronix-test-suite phoromatic.explore</strong> will also supply cache statistics.</p>
<h3>Log Files</h3>
<p>The Phoromatic Server will produce a log file of events / debugging information to <em>~/.phoronix-test-suite/phoromatic.log</em> or <em>/var/log/phoromatic.log</em> depending upon the service's permissions. When running the Phoronix Test Suite Phoromatic client, the log will be written to one of the respective locations in <em>phoronix-test-suite.log</em>.</p>
<h3>Multi-User Accounts</h3>
<p>For each time a user account is made from the Phoromatic web UI's log-in page, all of the test schedules, systems, and other account information is separate to allow for a completely isolated multi-user system. If a main administrator (the one creating the account) wishes to have multiple users sharing the same account data, that user can create additional accounts from the <em>Users</em> tab of their account. The main administrator can make an additional administrator account or a &quot;viewer&quot; account that can consume the account's data but not create/modify the schedules, systems, or other account details.</p>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Module Options</title></head><body><p>The following list is the modules included with the Phoronix Test Suite that are intended to extend the functionality of pts-core. Some of these options have commands that can be run directly in a similiar manner to the other Phoronix Test Suite user commands. Some modules are just meant to be loaded directly by adding the module name to the LoadModules tag in ~/.phoronix-test-suite/user-config.xml or via the PTS_MODULES environmental variable. A list of available modules is also available by running <em>phoronix-test-suite list-modules.</em><hr></p><h2>Dummy Module</h2><p>This is a simple module intended for developers to just demonstrate some of the module functions.</p><p>phoronix-test-suite dummy_module.dummy-command</p><h2>OpenBenchmarking.org Ekofisk</h2><p>The Ekofisk client is used for connecting to OpenBenchmarking.org to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner.</p><p>phoronix-test-suite ekofisk.start</p><p>phoronix-test-suite ekofisk.user-system-return</p><h2>Graphics Event Checker</h2><p>This module checks a number of events prior to and and after running a test to make sure the graphics sub-system was not put in a sour or unintended state by the application. For instance, it makes sure syncing to vBlank is not forced through the driver and that a graphics test has not left the display in an unintended mode.</p><h2>Graphics Override</h2><p>This module allows you to override some graphics rendering settings for the ATI and NVIDIA drivers while running the Phoronix Test Suite.</p><p>This module utilizes the following environmental variables: FORCE_AA, FORCE_AF.</p><h2>MATISK</h2><p>My Automated Test Infrastructure Setup Kit</p><p>phoronix-test-suite matisk.run</p><p>phoronix-test-suite matisk.template</p><h2>Phoromatic Client</h2><p>The Phoromatic client is used for connecting to a Phoromatic server (Phoromatic.com or a locally run server) to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner. For more details visit http://www.phoromatic.com/. This module is intended to be used with Phoronix Test Suite 5.2+ clients and servers.</p><p>phoronix-test-suite phoromatic.connect</p><h2>Phoromatic Legacy Client</h2><p>The Phoromatic client is used for connecting to a Phoromatic server (Phoromatic.com or a locally run server) to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner. For more details visit http://www.phoromatic.com/. THIS MODULE IS USED FOR CONNECTING TO THE PRE-2014 VERSION OF PHOROMATIC; THIS OLDER VERSION OF PHOROMATIC IS NO LONGER BEING ACTIVELY MAINTAINED. PLEASE UPGRADE TO PHORONIX-TEST-SUITE 5.2+ WITH ITS BUILT-IN PHOROMATIC SERVER.</p><p>phoronix-test-suite phoromatic_legacy.start</p><p>phoronix-test-suite phoromatic_legacy.user-system-return</p><p>phoronix-test-suite phoromatic_legacy.upload-results</p><p>phoronix-test-suite phoromatic_legacy.clone-results</p><p>phoronix-test-suite phoromatic_legacy.system-schedule</p><p>phoronix-test-suite phoromatic_legacy.system-schedule-today</p><p>phoronix-test-suite phoromatic_legacy.send-message</p><h2>Pushover.net</h2><p>Submit notifications to your iOS/Android mobile devices of test results in real-time as push notifications, etc. Using the Pushover.net API.</p><p>This module utilizes the following environmental variables: PUSHOVER_NET_USER.</p><h2>Result Notifier</h2><p>A notification module.</p><h2>System Monitor</h2><p>This module contains sensor monitoring support.</p><p>This module utilizes the following environmental variables: MONITOR, PERFORMANCE_PER_WATT.</p><h2>Timed Screenshot</h2><p>This is a module that will take a screenshot of the system at a pre-defined interval. ImageMagick must be installed onto the system prior to using this module.</p><p>This module utilizes the following environmental variables: SCREENSHOT_INTERVAL.</p><h2>Toggle Screensaver</h2><p>This module toggles the system's screensaver while the Phoronix Test Suite is running. At this time, the GNOME and KDE screensavers are supported.</p><p>This module utilizes the following environmental variables: HALT_SCREENSAVER.</p><h2>Update Checker</h2><p>This module checks to see if the Phoronix Test Suite -- and its tests and suites -- are up to date.</p></body></html>
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Module Options</title></head><body><p>The following list is the modules included with the Phoronix Test Suite that are intended to extend the functionality of pts-core. Some of these options have commands that can be run directly in a similiar manner to the other Phoronix Test Suite user commands. Some modules are just meant to be loaded directly by adding the module name to the LoadModules tag in ~/.phoronix-test-suite/user-config.xml or via the PTS_MODULES environmental variable. A list of available modules is also available by running <em>phoronix-test-suite list-modules.</em><hr></p><h2>Dummy Module</h2><p>This is a simple module intended for developers to just demonstrate some of the module functions.</p><p>phoronix-test-suite dummy_module.dummy-command</p><h2>OpenBenchmarking.org Ekofisk</h2><p>The Ekofisk client is used for connecting to OpenBenchmarking.org to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner.</p><p>phoronix-test-suite ekofisk.start</p><p>phoronix-test-suite ekofisk.user-system-return</p><h2>Graphics Event Checker</h2><p>This module checks a number of events prior to and and after running a test to make sure the graphics sub-system was not put in a sour or unintended state by the application. For instance, it makes sure syncing to vBlank is not forced through the driver and that a graphics test has not left the display in an unintended mode.</p><h2>Graphics Override</h2><p>This module allows you to override some graphics rendering settings for the ATI and NVIDIA drivers while running the Phoronix Test Suite.</p><p>This module utilizes the following environmental variables: FORCE_AA, FORCE_AF.</p><h2>MATISK</h2><p>My Automated Test Infrastructure Setup Kit</p><p>phoronix-test-suite matisk.run</p><p>phoronix-test-suite matisk.template</p><h2>Phoromatic Client</h2><p>The Phoromatic client is used for connecting to a Phoromatic server (Phoromatic.com or a locally run server) to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner. For more details visit http://www.phoromatic.com/. This module is intended to be used with Phoronix Test Suite 5.2+ clients and servers.</p><p>phoronix-test-suite phoromatic.connect</p><p>phoronix-test-suite phoromatic.explore</p><h2>Pushover.net</h2><p>Submit notifications to your iOS/Android mobile devices of test results in real-time as push notifications, etc. Using the Pushover.net API.</p><p>This module utilizes the following environmental variables: PUSHOVER_NET_USER.</p><h2>Result Notifier</h2><p>A notification module.</p><h2>System Monitor</h2><p>This module contains sensor monitoring support.</p><p>This module utilizes the following environmental variables: MONITOR, PERFORMANCE_PER_WATT, MONITOR_INTERVAL.</p><h2>Timed Screenshot</h2><p>This is a module that will take a screenshot of the system at a pre-defined interval. ImageMagick must be installed onto the system prior to using this module.</p><p>This module utilizes the following environmental variables: SCREENSHOT_INTERVAL.</p><h2>Toggle Screensaver</h2><p>This module toggles the system's screensaver while the Phoronix Test Suite is running. At this time, the GNOME and KDE screensavers are supported.</p><p>This module utilizes the following environmental variables: HALT_SCREENSAVER.</p><h2>Update Checker</h2><p>This module checks to see if the Phoronix Test Suite -- and its tests and suites -- are up to date.</p></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -4,14 +4,6 @@
</head>
<body>
<h1>Overview</h1>
<p><em>Phoromatic is a remote management system for the Phoronix Test Suite. Phoromatic allows the automatic (hence the name Phoromatic) scheduling of tests, remote installation of new tests, and the management of multiple test systems all through an intuitive, easy-to-use web interface. Tests can be scheduled to automatically run on a routine basis across multiple test systems. The test results are then available from this central, secure location.</em></p>
<h1>Basic Instructions</h1>
<ol>
<li>Create a free account at <a href="http://www.phoromatic.com/">Phoromatic.com</a>. Phoromatic can also be installed on a LAN / intranet for professional and enterprise support customers of the Phoronix Test Suite.</li>
<li>On each test system, install the latest version of the Phoronix Test Suite and then run <em>phoronix-test-suite module-setup phoromatic</em>. During this process it will ask the user for an account code and activiation ID that are shown from the <em>Systems</em> page of your Phoromatic account.</li>
<li>Phoromatic cannot install external dependencies for a test if the Phoronix Test Suite is not running as root, so it would be recommended to now run <em>phoronix-test-suite install-dependencies all</em>. Alternatively, you can also run <em>phoronix-test-suite install all</em> to install all tests at this time, or begin selectively installing the tests you wish to use. Phoromatic can install tests automatically though, it just cannot install external dependencies when the user is not root.</li>
<li>When you are all set, run <em>phoronix-test-suite phoromatic.start</em>, which begins the process of the Phoronix Test Suite listening to the Phoromatic server waiting for installation and run commands, etc. The installed system software/hardware is also reported all automatically, etc.</li>
</ol>
<p>For more information on Phoromatic and a detailed guide, read <a href="http://www.phoronix.com/vr.php?view=14347">Building A Benchmarking Test Farm With Phoromatic</a>.</p>
<p>The Phoronix Test Suite now features its own built-in Phoromatic server and client implementations. See the <em>phoromatic.pdf</em> / <em>phoromatic.html</em> documentation for more information on this advanced capability.</p>
</body>
</html>

View File

@@ -57,6 +57,8 @@ mkdir -p $DESTDIR$INSTALL_PREFIX/share/man/man1/
mkdir -p $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
mkdir -p $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/bash_completion.d/
#mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/systemd/system/
#mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/init/
cp CHANGE-LOG $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
cp COPYING $DESTDIR$INSTALL_PREFIX/share/doc/phoronix-test-suite/
@@ -74,6 +76,13 @@ cp pts-core/static/phoronix-test-suite.desktop $DESTDIR$INSTALL_PREFIX/share/app
cp pts-core/static/phoronix-test-suite-launcher.desktop $DESTDIR$INSTALL_PREFIX/share/applications/
cp pts-core/static/phoronix-test-suite.appdata.xml $DESTDIR$INSTALL_PREFIX/share/appdata/
mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/systemd/system/
cp pts-core/static/*.service $DESTDIR$INSTALL_PREFIX/../etc/systemd/system/
mkdir -p $DESTDIR$INSTALL_PREFIX/../etc/init/
cp pts-core/static/upstart/*.conf $DESTDIR$INSTALL_PREFIX/../etc/init/
rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts/etc/scripts/package-build-*
cp -r pts-core $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/
rm -f $DESTDIR$INSTALL_PREFIX/share/phoronix-test-suite/pts-core/static/phoronix-test-suite.desktop

View File

@@ -101,6 +101,11 @@ fi
exit
fi
if [ ! -f pts-core/phoronix-test-suite.php ] && [ -f `dirname $0`/pts-core/phoronix-test-suite.php ]
then
cd `dirname $0`
fi
# Ensure the user is in the correct directory
if [ ! -f pts-core/phoronix-test-suite.php ]
then

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2010, Phoronix Media
Copyright (C) 2009 - 2010, Michael Larabel
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,7 +20,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class debug_run implements pts_option_interface
class debug_benchmark implements pts_option_interface
{
const doc_section = 'Asset Creation';
const doc_description = 'This option is intended for use by test profile writers and is identical to the <em>run</em> option but will yield more information during the run process that can be used to debug issues with a test profile or to verify the test profile is functioning correctly.';
@@ -31,8 +31,17 @@ class debug_run implements pts_option_interface
new pts_argument_check('VARIABLE_LENGTH', array('pts_types', 'identifier_to_object'), null)
);
}
public static function command_aliases()
{
return array('debug_run');
}
public static function run($r)
{
// Make sure you're debugging the latest test script...
pts_test_installer::standard_install($r);
// For debugging, usually running just once is sufficient, unless FORCE_TIMES_TO_RUN is preset
pts_client::pts_set_environment_variable('FORCE_TIMES_TO_RUN', 1);
// Run the test(s) in debug mode
pts_test_run_manager::standard_run($r, pts_c::debug_mode);
}
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2013, Phoronix Media
Copyright (C) 2008 - 2013, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,6 +29,11 @@ class diagnostics implements pts_option_interface
{
foreach(pts_define(-1) as $constant => $constant_value)
{
if(strpos($constant, 'GSID') !== false || strpos($constant, '_ID') !== false)
{
continue;
}
echo $constant . ' = ' . $constant_value . PHP_EOL;
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2011 - 2013, Phoronix Media
Copyright (C) 2011 - 2013, Michael Larabel
Copyright (C) 2011 - 2014, Phoronix Media
Copyright (C) 2011 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009, Phoronix Media
Copyright (C) 2009, Michael Larabel
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,28 +29,31 @@ class dump_core_storage implements pts_option_interface
foreach($pso->get_objects() as $pso_index => $pso_object)
{
if($pso_index != 'phodevi_smart_cache')
if(!in_array($pso_index, array('global_reported_hw', 'global_reported_sw', 'global_reported_usb', 'global_reported_pci', 'phodevi_smart_cache')))
{
echo $pso_index . ': ';
if(is_array($pso_object))
{
foreach($pso_object as $key => $element)
{
echo PHP_EOL . "\t" . $key . ': ' . $element;
}
}
else
{
echo $pso_object;
}
echo PHP_EOL;
self::print_element($pso_index, $pso_object, 0);
}
}
echo PHP_EOL;
}
private static function print_element($in, $el, $depth)
{
//echo $in . ': ';
if(is_array($el))
{
foreach($el as $key => $element)
{
echo PHP_EOL . str_repeat("\t", $depth) . $in . ': ';
self::print_element($key, $element, ($depth + 1));
}
}
else
{
echo PHP_EOL . str_repeat("\t", $depth) . $in . ': ' . $el;
}
}
}
?>

View File

@@ -268,6 +268,25 @@ class dump_documentation implements pts_option_interface
$readme .= pts_file_io::file_get_contents(PTS_PATH . 'documentation/stubs/readme-basics.txt') . PHP_EOL . PHP_EOL;
$readme = wordwrap($readme, 80, PHP_EOL);
file_put_contents(PTS_PATH . 'README', $readme);
// Phoromatic Documentation
$pdf = new pts_pdf_template(pts_title(false), 'Phoromatic Documentation');
$html_doc = new pts_html_template(pts_title(false), 'Phoromatic Documentation');
$pdf->AddPage();
$pdf->Image(PTS_CORE_STATIC_PATH . 'images/pts-308x160.png', 69, 85, 73, 38, 'PNG', 'http://www.phoronix-test-suite.com/');
$pdf->Ln(120);
$pdf->WriteStatement('www.phoronix-test-suite.com', 'C', 'http://www.phoronix-test-suite.com/');
$pdf->Ln(15);
$pdf->Image(PTS_CORE_STATIC_PATH . 'images/phoromatic-390x56.png', 55, 250, 0, 0, 'PNG', 'http://www.phoronix-test-suite.com/');
//$pdf->Image(PTS_CORE_STATIC_PATH . 'images/phoromatic-390x56.png', 69, 85, 73, 38, 'PNG', 'http://www.phoromatic.com/');
$pdf->WriteBigHeaderCenter(pts_title(true));
$pdf->WriteHeaderCenter('Phoromatic User Manual');
$pdf->html_to_pdf(PTS_PATH . 'documentation/phoromatic.html');
$pdf_file = PTS_PATH . 'documentation/phoromatic.pdf';
$pdf->Output($pdf_file);
echo PHP_EOL . 'Saved To: ' . $pdf_file . PHP_EOL . PHP_EOL;
}
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2011, Phoronix Media
Copyright (C) 2008 - 2011, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,14 +23,33 @@
class make_download_cache implements pts_option_interface
{
const doc_section = 'Test Installation';
const doc_description = 'This option will create a download cache for use by the Phoronix Test Suite.';
const doc_description = 'This option will create a download cache for use by the Phoronix Test Suite. The download cache is created of test files already downloaded to the local system. If passing any test/suite names to make-download-cache, the needed files for those test profiles will first be automatically downloaded before creating the cache.';
public static function run($r)
{
// Generates a PTS Download Cache
$dc_write_directory = null;
if(!empty($r))
{
$test_profiles = pts_types::identifiers_to_test_profile_objects($r, true, true);
$dc_write_directory = pts_strings::add_trailing_slash(pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
if(count($test_profiles) > 0)
{
echo PHP_EOL . 'Downloading Test Files For: ' . implode(' ', $test_profiles);
pts_test_installer::only_download_test_files($test_profiles);
}
}
// Generates a PTS Download Cache
if(is_writable(PTS_SHARE_PATH))
{
// If running as root, might as well write it to the /usr/share PTS download cache so other users on system could benefit too
$dc_write_directory = PTS_SHARE_PATH . 'download-cache/';
pts_file_io::mkdir($dc_write_directory);
}
else
{
// The user's local cache
$dc_write_directory = pts_strings::add_trailing_slash(pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
}
if($dc_write_directory == null || !is_writable($dc_write_directory))
{
@@ -40,48 +59,73 @@ class make_download_cache implements pts_option_interface
echo PHP_EOL . 'Download Cache Directory: ' . $dc_write_directory . PHP_EOL;
$xml_writer = new nye_XmlWriter();
$json_download_cache = array('phoronix-test-suite' => array(
'main' => array('generated' => time()),
'download-cache' => array()
));
foreach(pts_tests::installed_tests() as $test)
{
$test_profile = new pts_test_profile($test);
$cached = false;
echo PHP_EOL . 'Checking Downloads For: ' . $test . PHP_EOL;
foreach(pts_test_install_request::read_download_object_list($test_profile, false) as $file)
{
$cached_valid = false;
if(is_file($dc_write_directory . $file->get_filename()) && $file->check_file_hash($dc_write_directory . $file->get_filename()))
{
echo ' Previously Cached: ' . $file->get_filename() . PHP_EOL;
$cached = true;
$cached_valid = true;
}
else
else if(is_dir($test_profile->get_install_dir()))
{
if(is_dir($test_profile->get_install_dir()))
if(is_file($test_profile->get_install_dir() . $file->get_filename()) && $file->check_file_hash($test_profile->get_install_dir() . $file->get_filename()))
{
if(is_file($test_profile->get_install_dir() . $file->get_filename()) && $file->check_file_hash($test_profile->get_install_dir() . $file->get_filename()))
echo ' Caching: ' . $file->get_filename() . PHP_EOL;
if(copy($test_profile->get_install_dir() . $file->get_filename(), $dc_write_directory . $file->get_filename()))
{
echo ' Caching: ' . $file->get_filename() . PHP_EOL;
if(copy($test_profile->get_install_dir() . $file->get_filename(), $dc_write_directory . $file->get_filename()))
{
$cached = true;
}
$cached_valid = true;
}
}
}
if($cached)
if($cached_valid)
{
$xml_writer->addXmlNode('PhoronixTestSuite/DownloadCache/Package/FileName', $file->get_filename());
$xml_writer->addXmlNode('PhoronixTestSuite/DownloadCache/Package/MD5', $file->get_md5());
$xml_writer->addXmlNode('PhoronixTestSuite/DownloadCache/Package/SHA256', $file->get_sha256());
if(!isset($json_download_cache['phoronix-test-suite']['download-cache'][$file->get_filename()]))
{
$json_download_cache['phoronix-test-suite']['download-cache'][$file->get_filename()] = array(
'file_name' => $file->get_filename(),
'file_size' => $file->get_filesize(),
'associated_tests' => array($test_profile->get_identifier()),
'md5' => $file->get_md5(),
'sha256' => $file->get_sha256(),
);
}
else if($file->get_md5() == $json_download_cache['phoronix-test-suite']['download-cache'][$file->get_filename()]['md5'] && $file->get_sha256() == $json_download_cache['phoronix-test-suite']['download-cache'][$file->get_filename()]['sha256'])
{
array_push($json_download_cache['phoronix-test-suite']['download-cache'][$file->get_filename()]['associated_tests'], $test_profile->get_identifier());
}
}
}
}
$cache_xml = $xml_writer->getXML();
file_put_contents($dc_write_directory . 'pts-download-cache.xml', $cache_xml);
// Find files in download-cache/ that weren't part of an installed test (but could have just been tossed in there) to cache
foreach(glob($dc_write_directory . '/*') as $cached_file)
{
$file_name = basename($cached_file);
if(!isset($json_download_cache['phoronix-test-suite']['download-cache'][$file_name]) && $file_name != 'pts-download-cache.json')
{
$json_download_cache['phoronix-test-suite']['download-cache'][$file_name] = array(
'file_name' => $file_name,
'file_size' => filesize($cached_file),
'associated_tests' => array(),
'md5' => md5_file($cached_file),
'sha256' => hash_file('sha256', $cached_file),
);
}
}
file_put_contents($dc_write_directory . 'pts-download-cache.json', json_encode($json_download_cache, JSON_PRETTY_PRINT));
echo PHP_EOL;
}
}

View File

@@ -0,0 +1,103 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class make_openbenchmarking_cache implements pts_option_interface
{
const doc_section = 'OpenBenchmarking.org';
const doc_description = 'This option will attempt to cache the test profile/suite meta-data from OpenBenchmarking.org for all linked repositories. This is useful if you\'re going to be running the Phoronix Test Suite / Phoromatic behind a firewall or without any Internet connection. Those with unrestricted Internet access or not utilizing a large local deployment of the Phoronix Test Suite / Phoromatic shouldn\'t need to run this command.';
public static function run($r)
{
pts_client::$display->generic_heading('Available Tests');
$available_tests = pts_openbenchmarking::available_tests(false);
$available_suites = pts_openbenchmarking::available_suites(false);
$test_count = count($available_tests);
$suite_count = count($available_suites);
$total_count = $test_count + $suite_count;
$total_cache_count = 0;
$total_cache_size = 0;
if($test_count == 0 || !pts_network::internet_support_available())
{
echo PHP_EOL . 'No tests found. Please check that you have Internet connectivity to download test profile data from OpenBenchmarking.org. The Phoronix Test Suite has documentation on configuring the network setup, proxy settings, and PHP network options. Please contact Phoronix Media if you continuing to experience problems.' . PHP_EOL . PHP_EOL;
return false;
}
$terminal_width = pts_client::terminal_width();
// Cache test profiles
foreach($available_tests as $i => $identifier)
{
$repo = substr($identifier, 0, strpos($identifier, '/'));
$test = substr($identifier, strlen($repo) + 1);
$repo_index = pts_openbenchmarking::read_repository_index($repo);
echo $i . '/' . $total_count . ': ' . ($repo_index['tests'][$test]['title'] != null ? $repo_index['tests'][$test]['title'] . ' [' . $repo_index['tests'][$test]['test_type'] . ']' : null) . PHP_EOL;
foreach($repo_index['tests'][$test]['versions'] as $version)
{
$qualified_identifier = $repo . '/' . $test . '-' . $version;
echo $qualified_identifier;
$success = pts_openbenchmarking::download_test_profile($repo . '/' . $test . '-' . $version);
if($success && is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip'))
{
$file_size = round(filesize(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip') / 1024, 2);
$info = $file_size . 'KB - ' . sha1_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip');
echo ' ' . str_repeat('.', $terminal_width - strlen($qualified_identifier) - 3 - strlen($info)) . ' ' . $info . PHP_EOL;
$total_cache_count++;
$total_cache_size += $file_size;
}
}
echo PHP_EOL;
}
// Cache test suites
foreach($available_suites as $i => $identifier)
{
$repo = substr($identifier, 0, strpos($identifier, '/'));
$test = substr($identifier, strlen($repo) + 1);
$repo_index = pts_openbenchmarking::read_repository_index($repo);
echo ($i + $test_count) . '/' . $total_count . ': ' . $repo_index['suites'][$test]['title'] . PHP_EOL;
foreach($repo_index['suites'][$test]['versions'] as $version)
{
$qualified_identifier = $repo . '/' . $test . '-' . $version;
echo $qualified_identifier;
$success = pts_openbenchmarking::download_test_suite($repo . '/' . $test . '-' . $version);
if($success && is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip'))
{
$file_size = round(filesize(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip') / 1024, 2);
$info = $file_size . 'KB - ' . sha1_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip');
echo ' ' . str_repeat('.', $terminal_width - strlen($qualified_identifier) - 3 - strlen($info)) . ' ' . $info . PHP_EOL;
$total_cache_count++;
$total_cache_size += $file_size;
}
}
echo PHP_EOL;
}
echo PHP_EOL . $total_cache_count . ' Files Cached' . PHP_EOL . $test_count . ' Test Profiles' . PHP_EOL . $suite_count . ' Test Suites' . PHP_EOL . $total_cache_size . 'KB Total Cache Size' . PHP_EOL . PHP_EOL;
}
}
?>

View File

@@ -27,6 +27,12 @@ class start_phoromatic_server implements pts_option_interface
public static function run($r)
{
if(pts_client::create_lock(PTS_USER_PATH . 'phoromatic_server_lock') == false)
{
trigger_error('The Phoromatic Server is already running.', E_USER_ERROR);
return false;
}
pts_file_io::unlink(PTS_USER_PATH . 'phoromatic-server-launcher');
if(PHP_VERSION_ID < 50400)
{
@@ -50,7 +56,7 @@ class start_phoromatic_server implements pts_option_interface
if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)
{
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ~/.phoronix-test-suite/user-config.xml to proceed.', E_USER_ERROR);
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
fclose($fp);
return false;
}
@@ -67,7 +73,7 @@ class start_phoromatic_server implements pts_option_interface
}
else
{
echo PHP_EOL . PHP_EOL . 'You must first configure the remote web / Phoromatic settings via:' . PHP_EOL . ' ~/.phoronix-test-suite/user-config.xml.' . PHP_EOL . PHP_EOL . 'The RemoteAccessPort should be a network port to use for HTTP communication while WebSocketPort should be set to another available network port.' . PHP_EOL . PHP_EOL;
echo PHP_EOL . PHP_EOL . 'You must first configure the remote web / Phoromatic settings via:' . PHP_EOL . ' ' . pts_config::get_config_file_location() . PHP_EOL . PHP_EOL . 'The RemoteAccessPort should be a network port to use for HTTP communication while WebSocketPort should be set to another available network port.' . PHP_EOL . PHP_EOL;
return false;
}
@@ -77,29 +83,50 @@ class start_phoromatic_server implements pts_option_interface
return false;
}
// Setup server logger
define('PHOROMATIC_SERVER', true);
$pts_logger = new pts_logger();
$pts_logger->clear_log();
$pts_logger->log(pts_title(true) . ' starting Phoromatic Server on ' . pts_network::get_local_ip());
// Just create the logger so now it will flush it out
// WebSocket Server Setup
$server_launcher .= 'export PTS_WEBSOCKET_PORT=' . $web_socket_port . PHP_EOL;
$server_launcher .= 'export PTS_NO_FLUSH_LOGGER=1' . PHP_EOL;
$server_launcher .= 'export PTS_PHOROMATIC_LOG_LOCATION=' . $pts_logger->get_log_file_location() . PHP_EOL;
$server_launcher .= 'cd ' . getenv('PTS_DIR') . ' && PTS_MODE="CLIENT" ' . getenv('PHP_BIN') . ' pts-core/phoronix-test-suite.php start-ws-server &' . PHP_EOL;
$server_launcher .= 'websocket_server_pid=$!'. PHP_EOL;
$pts_logger->log('Starting WebSocket process on port ' . $web_socket_port);
// HTTP Server Setup
if(strpos(getenv('PHP_BIN'), 'hhvm'))
{
$server_launcher .= 'cd ' . PTS_CORE_PATH . 'phoromatic/public_html/ && ' . getenv('PHP_BIN') . ' --config ' . PTS_CORE_PATH . 'static/hhvm-server.hdf -m server -vServer.Port=' . $web_port . ' -vServer.IP=' . $server_ip . ' -vServer.SourceRoot=' . PTS_CORE_PATH . 'phoromatic/' . ' &' . PHP_EOL;
$server_launcher .= 'cd ' . PTS_CORE_PATH . 'phoromatic/public_html/ && ' . getenv('PHP_BIN') . ' --config ' . PTS_CORE_PATH . 'static/hhvm-server.hdf -m server -vServer.Port=' . $web_port . ' -vServer.IP=' . $server_ip . ' -vServer.SourceRoot=' . PTS_CORE_PATH . 'phoromatic/ > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL;
}
else
{
$server_launcher .= getenv('PHP_BIN') . ' -S ' . $server_ip . ':' . $web_port . ' -t ' . PTS_CORE_PATH . 'phoromatic/public_html/ &' . PHP_EOL; //2> /dev/null
$server_launcher .= getenv('PHP_BIN') . ' -S ' . $server_ip . ':' . $web_port . ' -t ' . PTS_CORE_PATH . 'phoromatic/public_html/ > /dev/null 2>> $PTS_PHOROMATIC_LOG_LOCATION &' . PHP_EOL; //2> /dev/null
}
$server_launcher .= 'http_server_pid=$!'. PHP_EOL;
$server_launcher .= 'sleep 1' . PHP_EOL;
$server_launcher .= 'echo "The Phoromatic Web Interface Is Accessible At: http://localhost:' . $web_port . '"' . PHP_EOL;
$server_launcher .= PHP_EOL . 'echo -n "Press [ENTER] to kill server..."' . PHP_EOL . 'read var_name';
$pts_logger->log('Starting HTTP process @ http://localhost:' . $web_port);
// Avahi for zeroconf network discovery support
if(pts_config::read_user_config('PhoronixTestSuite/Options/Server/AdvertiseServiceZeroConf', 'TRUE') && pts_client::executable_in_path('avahi-publish'))
{
$server_launcher .= 'avahi-publish -s phoromatic-server _http._tcp ' . $web_port . ' "Phoronix Test Suite Phoromatic" > /dev/null 2>&1 &' . PHP_EOL;
$server_launcher .= 'avahi_publish_pid=$!'. PHP_EOL;
}
// Wait for input to shutdown process..
$server_launcher .= PHP_EOL . 'echo -n "Press [ENTER] to kill server..."' . PHP_EOL;
$server_launcher .= PHP_EOL . 'read var_name';
// Shutdown / Kill Servers
$server_launcher .= PHP_EOL . 'kill $http_server_pid';
$server_launcher .= PHP_EOL . 'kill $websocket_server_pid';
$server_launcher .= PHP_EOL . 'kill $avahi_publish_pid';
$server_launcher .= PHP_EOL . 'rm -f ~/.phoronix-test-suite/run-lock*';
file_put_contents(PTS_USER_PATH . 'phoromatic-server-launcher', $server_launcher);
}

View File

@@ -23,7 +23,7 @@
class start_remote_gui_server implements pts_option_interface
{
const doc_section = 'Web / GUI Support';
const doc_description = 'Start the GUI web server and WebSocket server processes for remote (or local) access via the web-browser. The settings can be configured via the Phoronix Test Suite\'s user-config.xml configuration file.';
const doc_description = 'Start the GUI web server and WebSocket server processes for remote (or local) access via the web-browser. The settings can be configured via the Phoronix Test Suite\'s XML configuration file.';
public static function run($r)
{
@@ -50,7 +50,7 @@ class start_remote_gui_server implements pts_option_interface
if(($fp = fsockopen('127.0.0.1', $remote_access, $errno, $errstr, 5)) != false)
{
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ~/.phoronix-test-suite/user-config.xml to proceed.', E_USER_ERROR);
trigger_error('Port ' . $remote_access . ' is already in use by another server process. Close that process or change the Phoronix Test Suite server port via ' . pts_config::get_config_file_location() . ' to proceed.', E_USER_ERROR);
fclose($fp);
return false;
}
@@ -67,7 +67,7 @@ class start_remote_gui_server implements pts_option_interface
}
else
{
echo PHP_EOL . PHP_EOL . 'You must first configure the remote GUI/WEBUI settings via the ~/.phoronix-test-suite/user-config.xml.' . PHP_EOL . PHP_EOL;
echo PHP_EOL . PHP_EOL . 'You must first configure the remote GUI/WEBUI settings via:' . pts_config::get_config_file_location() . PHP_EOL . PHP_EOL;
return false;
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2011, Phoronix Media
Copyright (C) 2008 - 2011, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,10 +27,10 @@ class user_config_reset implements pts_option_interface
public static function run($r)
{
if(is_file(PTS_USER_PATH . 'user-config.xml'))
if(is_file(pts_config::get_config_file_location()))
{
copy(PTS_USER_PATH . 'user-config.xml', PTS_USER_PATH . 'user-config-old.xml');
unlink(PTS_USER_PATH . 'user-config.xml');
copy(pts_config::get_config_file_location(), PTS_USER_PATH . 'user-config-old.xml');
unlink(pts_config::get_config_file_location());
}
pts_config::user_config_generate();
}

View File

@@ -23,7 +23,7 @@
</Package>
<Package>
<GenericName>sdl2-development</GenericName>
<PackageName>SDL2 SDL2_image SDL2_mixer SDL2_ttf</PackageName>
<PackageName>SDL2 SDL2_image SDL2_mixer SDL2_ttf SDL2-devel SDL2_image-devel</PackageName>
</Package>
<Package>
<GenericName>tiff</GenericName>

View File

@@ -23,31 +23,86 @@
class phoromatic extends pts_module_interface
{
const module_name = 'Phoromatic Client';
const module_version = '0.1.0';
const module_version = '0.2.0';
const module_description = 'The Phoromatic client is used for connecting to a Phoromatic server (Phoromatic.com or a locally run server) to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner. For more details visit http://www.phoromatic.com/. This module is intended to be used with Phoronix Test Suite 5.2+ clients and servers.';
const module_author = 'Phoronix Media';
static $account_id = null;
static $server_address = null;
static $server_http_port = null;
static $server_ws_port = null;
private static $account_id = null;
private static $server_address = null;
private static $server_http_port = null;
private static $server_ws_port = null;
private static $is_running_as_phoromatic_node = false;
private static $log_file = null;
public static function module_info()
{
return 'The Phoromatic module contains the client support for interacting with Phoromatic and Phoromatic Tracker services. A public, free reference implementation of Phoromatic can be found at http://www.phoromatic.com/. A commercial version is available to enterprise customers for installation onto their intranet. For more information, contact Phoronix Media.';
return 'The Phoromatic module contains the client support for interacting with Phoromatic and Phoromatic Tracker services.';
}
public static function user_commands()
{
return array('connect' => 'run_connection');
return array('connect' => 'run_connection', 'explore' => 'explore_network'); //explore => explore_network
}
public static function module_setup()
public static function explore_network()
{
return array(
new pts_module_option('remote_host', 'Enter the URL to host', 'HTTP_URL', 'http://www.phoromatic.com/'),
new pts_module_option('remote_account', 'Enter the account code', 'ALPHA_NUMERIC'),
new pts_module_option('remote_verifier', 'Enter the verification code', 'ALPHA_NUMERIC'),
new pts_module_option('system_description', 'Enter a short (optional) description for this system', null, null, null, false)
);
pts_client::$display->generic_heading('Phoromatic Servers');
$archived_servers = pts_client::available_phoromatic_servers();
foreach($archived_servers as $archived_server)
{
$response = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/server.php?phoromatic_info');
if(!empty($response))
{
$response = json_decode($response, true);
if($response && isset($response['pts']))
{
echo PHP_EOL . 'IP: ' . $archived_server['ip'] . PHP_EOL;
echo 'HTTP PORT: ' . $archived_server['http_port'] . PHP_EOL;
echo 'WEBSOCKET PORT: ' . $response['ws_port'] . PHP_EOL;
echo 'SERVER: ' . $response['http_server'] . PHP_EOL;
echo 'PHORONIX TEST SUITE: ' . $response['pts'] . ' [' . $response['pts_core'] . ']' . PHP_EOL;
}
$repo = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/download-cache.php?repo');
echo 'DOWNLOAD CACHE: ';
if(!empty($repo))
{
$repo = json_decode($repo, true);
if($repo && isset($repo['phoronix-test-suite']['download-cache']))
{
$total_file_size = 0;
foreach($repo['phoronix-test-suite']['download-cache'] as $file_name => $inf)
{
$total_file_size += $repo['phoronix-test-suite']['download-cache'][$file_name]['file_size'];
}
echo count($repo['phoronix-test-suite']['download-cache']) . ' FILES / ' . round($total_file_size / 1000000) . ' MB CACHE SIZE';
}
}
else
{
echo 'N/A';
}
echo PHP_EOL;
$repo = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/openbenchmarking-cache.php?repos');
echo 'SUPPORTED OPENBENCHMARKING.ORG REPOSITORIES:' . PHP_EOL;
if(!empty($repo))
{
$repo = json_decode($repo, true);
if($repo && is_array($repo['repos']))
{
foreach($repo['repos'] as $data)
{
echo ' ' . $data['title'] . ' - Last Generated: ' . date('d M Y H:i', $data['generated']) . PHP_EOL;
}
}
}
else
{
echo ' N/A' . PHP_EOL;
}
}
}
}
protected static function upload_to_remote_server($to_post, $server_address = null, $server_http_port = null, $account_id = null)
{
@@ -86,21 +141,36 @@ class phoromatic extends pts_module_interface
$to_post['aid'] = $account_id;
$to_post['pts'] = PTS_VERSION;
$to_post['pts_core'] = PTS_CORE_VERSION;
$to_post['gsid'] = PTS_GSID;
$to_post['gsid'] = defined('PTS_GSID') ? PTS_GSID : null;
$to_post['lip'] = pts_network::get_local_ip();
$to_post['h'] = phodevi::system_hardware(true);
$to_post['nm'] = pts_network::get_network_mac();
$to_post['s'] = phodevi::system_software(true);
$to_post['n'] = phodevi::read_property('system', 'hostname');
$to_post['msi'] = PTS_MACHINE_SELF_ID;
return pts_network::http_upload_via_post('http://' . $server_address . ':' . $server_http_port . '/phoromatic.php', $to_post);
}
protected static function update_system_status($current_task, $estimated_time_remaining = 0)
{
static $last_msg = null;
// Avoid an endless flow of "idling" messages, etc
if($current_task != $last_msg)
pts_client::$pts_logger->log($current_task);
$last_msg = $current_task;
return $server_response = phoromatic::upload_to_remote_server(array(
'r' => 'update_system_status',
'a' => $current_task,
'time' => $estimated_time_remaining
));
}
public static function startup_ping_check($server_ip, $http_port)
{
$server_response = phoromatic::upload_to_remote_server(array(
'r' => 'ping',
), $server_ip, $http_port);
}
public static function run_connection($args)
{
if(pts_client::create_lock(PTS_USER_PATH . 'phoromatic_lock') == false)
@@ -109,10 +179,46 @@ class phoromatic extends pts_module_interface
return false;
}
self::$account_id = substr($args[0], strrpos($args[0], '/') + 1);
self::$server_address = substr($args[0], 0, strpos($args[0], ':'));
self::$server_http_port = substr($args[0], strlen(self::$server_address) + 1, -1 - strlen(self::$account_id));
pts_client::$display->generic_heading('Server IP: ' . self::$server_address . PHP_EOL . 'Server HTTP Port: ' . self::$server_http_port . PHP_EOL . 'Account ID: ' . self::$account_id);
if(pts_client::$pts_logger == false)
{
pts_client::$pts_logger = new pts_logger();
}
pts_client::$pts_logger->log(pts_title(true) . ' starting Phoromatic client');
if(isset($args[0]) && $args[0] && strpos($args[0], '/', strpos($args[0], ':')) > 6)
{
pts_client::$pts_logger->log('Attempting to connect to Phoromatic Server: ' . $args[0]);
self::$account_id = substr($args[0], strrpos($args[0], '/') + 1);
self::$server_address = substr($args[0], 0, strpos($args[0], ':'));
self::$server_http_port = substr($args[0], strlen(self::$server_address) + 1, -1 - strlen(self::$account_id));
pts_client::$display->generic_heading('Server IP: ' . self::$server_address . PHP_EOL . 'Server HTTP Port: ' . self::$server_http_port . PHP_EOL . 'Account ID: ' . self::$account_id);
}
else
{
pts_client::$pts_logger->log('Attempting to auto-discover Phoromatic Server');
$archived_servers = pts_client::available_phoromatic_servers();
foreach($archived_servers as $archived_server)
{
$server_response = phoromatic::upload_to_remote_server(array(
'r' => 'ping',
), $archived_server['ip'], $archived_server['http_port']);
$server_response = json_decode($server_response, true);
if($server_response && isset($server_response['phoromatic']['account_id']))
{
self::$server_address = $archived_server['ip'];
self::$server_http_port = $archived_server['http_port'];
self::$account_id = $server_response['phoromatic']['account_id'];
}
}
}
if(self::$server_address == null || self::$server_http_port == null || self::$account_id == null)
{
echo PHP_EOL . 'You must pass the Phoromatic Server information as an argument to phoromatic.connect, or otherwise configure your network setup.' . PHP_EOL . ' e.g. phoronix-test-suite phoromatic.connect 192.168.1.2:5555/I0SSJY' . PHP_EOL . PHP_EOL;
return false;
}
$times_failed = 0;
while(1)
@@ -127,6 +233,7 @@ class phoromatic extends pts_module_interface
if($times_failed > 2)
{
pts_client::$pts_logger->log('Communication attempt to server failed');
trigger_error('Communication with server failed.', E_USER_ERROR);
return false;
}
@@ -151,10 +258,10 @@ class phoromatic extends pts_module_interface
switch(isset($json['phoromatic']['task']) ? $json['phoromatic']['task'] : null)
{
case 'benchmark':
self::$is_running_as_phoromatic_node = true;
$test_flags = pts_c::auto_mode | pts_c::batch_mode;
$suite_identifier = sha1(time() . rand(0, 100));
pts_suite_nye_XmlReader::set_temporary_suite($suite_identifier, $json['phoromatic']['test_suite']);
$phoromatic_schedule_id = $json['phoromatic']['trigger_id'];
$phoromatic_results_identifier = $phoromatic_schedule_id;
$phoromatic_save_identifier = $json['phoromatic']['save_identifier'];
@@ -180,7 +287,7 @@ class phoromatic extends pts_module_interface
{
$test_run_manager = new pts_test_run_manager($test_flags);
pts_test_run_manager::set_batch_mode(array(
'UploadResults' => true,
'UploadResults' => false, // TODO XXX: give option back on Phoromatic web UI whether to upload results to OpenBenchmarking.org global too...
'SaveResults' => true,
'RunAllTestCombinations' => false,
'OpenBrowser' => false
@@ -190,7 +297,7 @@ class phoromatic extends pts_module_interface
if($test_run_manager->load_tests_to_run($suite_identifier))
{
phoromatic::set_user_context($json['phoromatic']['pre_run_set_context'], $phoromatic_trigger, $phoromatic_schedule_id, 'PRE_RUN');
if(true)
if(false)
{
$test_run_manager->auto_upload_to_openbenchmarking();
pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', $json['phoromatic']['settings']['UploadSystemLogs']);
@@ -205,17 +312,93 @@ class phoromatic extends pts_module_interface
phoromatic::update_system_status('Benchmarks Completed For Schedule: ' . $phoromatic_save_identifier . ' - ' . $phoromatic_schedule_id);
$test_run_manager->post_execution_process();
// Upload to Phoromatic
$ob_data = $test_run_manager->get_result_upload_data();
// Handle uploading data to server
$result_file = new pts_result_file($test_run_manager->get_file_name());
$composite_xml = $result_file->xml_parser->getXML();
$system_log_dir = PTS_SAVE_RESULTS_PATH . $result_file->get_identifier() . '/system-logs/';
$upload_system_logs = $json['phoromatic']['settings']['UploadSystemLogs'];
// TODO: Potentially integrate this code below shared with pts_openbenchmarking_client into a unified function for validating system log files
$system_logs = null;
$system_logs_hash = null;
if(is_dir($system_log_dir) && $upload_system_logs)
{
$is_valid_log = true;
$finfo = function_exists('finfo_open') ? finfo_open(FILEINFO_MIME_TYPE) : false;
foreach(pts_file_io::glob($system_log_dir . '*') as $log_dir)
{
if($is_valid_log == false || !is_dir($log_dir))
{
$is_valid_log = false;
break;
}
foreach(pts_file_io::glob($log_dir . '/*') as $log_file)
{
if(!is_file($log_file))
{
$is_valid_log = false;
break;
}
if($finfo && substr(finfo_file($finfo, $log_file), 0, 5) != 'text/')
{
$is_valid_log = false;
break;
}
}
}
if($is_valid_log)
{
$system_logs_zip = pts_client::create_temporary_file();
pts_compression::zip_archive_create($system_logs_zip, $system_log_dir);
if(filesize($system_logs_zip) < 2097152)
{
// If it's over 2MB, probably too big
$system_logs = base64_encode(file_get_contents($system_logs_zip));
$system_logs_hash = sha1($system_logs);
}
else
{
// trigger_error('The systems log attachment is too large to upload to OpenBenchmarking.org.', E_USER_WARNING);
}
unlink($system_logs_zip);
}
}
$composite_xml_hash = sha1($composite_xml);
$composite_xml_type = 'composite_xml';
// Compress the result file XML if it's big
if(isset($composite_xml[50000]) && function_exists('gzdeflate'))
{
$composite_xml_gz = gzdeflate($composite_xml);
if($composite_xml_gz != false)
{
$composite_xml = $composite_xml_gz;
$composite_xml_type = 'composite_xml_gz';
}
}
// Upload to Phoromatic
$server_response = phoromatic::upload_to_remote_server(array(
'r' => 'result_upload',
'ob' => $ob_data['id'],
//'ob' => $ob_data['id'],
'sched' => $json['phoromatic']['schedule_id'],
'o' => $phoromatic_save_identifier,
'ts' => $json['phoromatic']['trigger_id'],
$composite_xml_type => base64_encode($composite_xml),
'composite_xml_hash' => $composite_xml_hash,
'system_logs_zip' => $system_logs,
'system_logs_hash' => $system_logs_hash
));
pts_client::$pts_logger->log('XXX TEMP DEBUG MESSAGE: ' . $server_response);
if(!$json['phoromatic']['settings']['ArchiveResultsLocally'])
{
pts_client::remove_saved_result_file($test_run_manager->get_file_name());
@@ -223,6 +406,7 @@ class phoromatic extends pts_module_interface
}
phoromatic::set_user_context($json['phoromatic']['post_install_set_context'], $phoromatic_trigger, $phoromatic_schedule_id, 'POST_RUN');
}
self::$is_running_as_phoromatic_node = false;
break;
case 'exit':
echo PHP_EOL . 'Phoromatic received a remote command to exit.' . PHP_EOL;
@@ -274,6 +458,11 @@ class phoromatic extends pts_module_interface
}
public static function __pre_test_install($test_identifier)
{
if(!self::$is_running_as_phoromatic_node)
{
return false;
}
static $last_update_time = 0;
if(time() > ($last_update_time + 600))
@@ -284,12 +473,20 @@ class phoromatic extends pts_module_interface
}
public static function __pre_test_run($pts_test_result)
{
if(!self::$is_running_as_phoromatic_node)
{
return false;
}
// TODO: need a way to get the estimated time remaining from the test_run_manager so we can pass that back to the update_system_status parameter so server can read it
// TODO: report name of test identifier/run i.e. . ' For ' . PHOROMATIC_TITLE
phoromatic::update_system_status('Running ' . $pts_test_result->test_profile->get_identifier());
}
public static function __event_user_error($user_error)
{
if(!self::$is_running_as_phoromatic_node)
{
return false;
}
// Report PTS user error warnings to Phoromatic server
phoromatic::report_warning_to_phoromatic($user_error->get_error_string());
}
@@ -301,48 +498,10 @@ class phoromatic extends pts_module_interface
}*/
}
//
// TODO XXX: The code below here is Phoromatic legacy code still needing to be ported to the new interfaces of PTS 5.2 Khanino
//
public static function module_setup_validate($options)
{
if(substr($options['remote_host'], -14) != 'phoromatic.php')
{
$options['remote_host'] = pts_strings::add_trailing_slash($options['remote_host']) . 'phoromatic.php';
}
$server_response = phoromatic::upload_to_remote_server(array(
'r' => 'start',
'h' => phodevi::system_hardware(true),
's' => phodevi::system_software(true),
'n' => phodevi::read_property('system', 'hostname'),
),
$options['remote_host'], $options['remote_account'], $options['remote_verifier']);
$returned_id = self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response');
unset($options['system_description']); // No reason to have this locally just pass it to the server
if(!empty($returned_id))
{
$options['remote_system'] = $returned_id;
echo PHP_EOL . 'Run Phoromatic by entering: phoronix-test-suite phoromatic.start' . PHP_EOL;
}
else
{
echo PHP_EOL . 'Configuration Failed!' . PHP_EOL;
$options = array();
}
return $options;
}
//
// User Run Commands
//

View File

@@ -1,737 +0,0 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_legacy extends pts_module_interface
{
const module_name = 'Phoromatic Legacy Client';
const module_version = '2.0.0';
const module_description = 'The Phoromatic client is used for connecting to a Phoromatic server (Phoromatic.com or a locally run server) to facilitate the automatic running of tests, generally across multiple test nodes in a routine manner. For more details visit http://www.phoromatic.com/. THIS MODULE IS USED FOR CONNECTING TO THE PRE-2014 VERSION OF PHOROMATIC; THIS OLDER VERSION OF PHOROMATIC IS NO LONGER BEING ACTIVELY MAINTAINED. PLEASE UPGRADE TO PHORONIX-TEST-SUITE 5.2+ WITH ITS BUILT-IN PHOROMATIC SERVER.';
const module_author = 'Phoronix Media';
static $phoromatic_server_build = false;
static $phoromatic_host = null;
static $phoromatic_account = null;
static $phoromatic_verifier = null;
static $phoromatic_system = null;
static $openbenchmarking_upload_json = null;
public static function module_info()
{
return 'The Phoromatic module contains the client support for interacting with Phoromatic and Phoromatic Tracker services. A public, free reference implementation of Phoromatic can be found at http://www.phoromatic.com/. A commercial version is available to enterprise customers for installation onto their intranet. For more information, contact Phoronix Media.';
}
public static function module_setup()
{
return array(
new pts_module_option('remote_host', 'Enter the URL to host', 'HTTP_URL', 'http://www.phoromatic.com/'),
new pts_module_option('remote_account', 'Enter the account code', 'ALPHA_NUMERIC'),
new pts_module_option('remote_verifier', 'Enter the verification code', 'ALPHA_NUMERIC'),
new pts_module_option('system_description', 'Enter a short (optional) description for this system', null, null, null, false)
);
}
public static function module_setup_validate($options)
{
if(substr($options['remote_host'], -14) != 'phoromatic.php')
{
$options['remote_host'] = pts_strings::add_trailing_slash($options['remote_host']) . 'phoromatic.php';
}
$server_response = self::upload_to_remote_server(array(
'r' => 'setup',
'h' => phodevi::system_hardware(true),
's' => phodevi::system_software(true),
'o' => phodevi::read_property('system', 'hostname'),
'sys_desc' => $options['system_description']
),
$options['remote_host'], $options['remote_account'], $options['remote_verifier']);
$returned_id = self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response');
unset($options['system_description']); // No reason to have this locally just pass it to the server
if(!empty($returned_id))
{
$options['remote_system'] = $returned_id;
echo PHP_EOL . 'Run Phoromatic by entering: phoronix-test-suite phoromatic.start' . PHP_EOL;
}
else
{
echo PHP_EOL . 'Configuration Failed!' . PHP_EOL;
$options = array();
}
return $options;
}
public static function user_commands()
{
return array(
'start' => 'user_start',
'user_system_return' => 'user_system_return',
'upload_results' => 'upload_unscheduled_results',
'clone_results' => 'clone_results',
'system_schedule' => 'system_schedule',
'system_schedule_today' => 'system_schedule_today',
'send_message' => 'report_message_to_server'
);
}
//
// User Run Commands
//
public static function user_start()
{
if(pts_client::create_lock(PTS_USER_PATH . 'phoromatic_lock') == false)
{
trigger_error('Phoromatic is already running.', E_USER_ERROR);
return false;
}
if(!self::phoromatic_setup_module())
{
return false;
}
self::user_system_process();
}
public static function upload_unscheduled_results($to_upload)
{
if(!self::phoromatic_setup_module())
{
return false;
}
if(!isset($to_upload[0]) || pts_result_file::is_test_result_file($to_upload[0]) == false)
{
echo PHP_EOL . 'No test result file was found to upload.' . PHP_EOL;
return false;
}
self::upload_unscheduled_test_results($to_upload[0]);
}
public static function clone_results($to_clone)
{
if(!self::phoromatic_setup_module())
{
return false;
}
if(!isset($to_clone[0]) || empty($to_clone[0]))
{
echo PHP_EOL . 'No clone string was provided.' . PHP_EOL;
return false;
}
$server_response = self::upload_to_remote_server(array(
'r' => 'clone_test_results',
'i' => $to_clone[0]
));
switch(self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response'))
{
case 'TRUE':
$identifier = 'phoromatic-clone-' . str_replace(array('_', ':'), null, $to_clone[0]);
pts_client::save_test_result($identifier . '/composite.xml', $server_response); // TODO: regenerate the XML so that the Phoromatic response bits are not included
echo PHP_EOL . 'Result Saved To: ' . PTS_SAVE_RESULTS_PATH . $identifier . '/composite.xml' . PHP_EOL . PHP_EOL;
pts_client::display_web_page(PTS_SAVE_RESULTS_PATH . $identifier . '/index.html');
break;
case 'SETTING_DISABLED':
echo PHP_EOL . 'You need to enable this support from your Phoromatic account web interface.' . PHP_EOL;
break;
default:
case 'ERROR':
echo PHP_EOL . 'An Error Occurred.' . PHP_EOL;
break;
}
}
public static function system_schedule()
{
if(!self::phoromatic_setup_module())
{
return false;
}
$server_response = self::upload_to_remote_server(array(
'r' => 'system_schedule'
));
$schedule_xml = new nye_XmlReader($server_response);
$schedule_titles = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/Title');
$schedule_description = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/Description');
$schedule_active_on = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/ActiveOn');
$schedule_start_time = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/RunAt');
if(count($schedule_titles) == 0)
{
echo PHP_EOL . 'No test schedules for this system were found on the Phoromatic Server.' . PHP_EOL;
}
else
{
for($i = 0; $i < count($schedule_titles); $i++)
{
echo self::phoromatic_schedule_entry_string($schedule_titles[$i], $schedule_description[$i], $schedule_start_time[$i], $schedule_active_on[$i]);
}
}
echo PHP_EOL;
}
public static function system_schedule_today()
{
if(!self::phoromatic_setup_module())
{
return false;
}
$server_response = self::upload_to_remote_server(array(
'r' => 'system_schedule'
));
$schedule_xml = new nye_XmlReader($server_response);
$schedule_titles = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/Title');
$schedule_description = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/Description');
$schedule_active_on = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/ActiveOn');
$schedule_start_time = $schedule_xml->getXmlArrayValues('PhoronixTestSuite/Phoromatic/Schedules/TestSchedule/RunAt');
if(count($schedule_titles) == 0)
{
echo PHP_EOL . 'No test schedules for this system were found on the Phoromatic Server.' . PHP_EOL;
}
else
{
for($i = 0; $i < count($schedule_titles); $i++)
{
if($schedule_active_on[$i][(date('w'))] != 1)
{
continue;
}
echo self::phoromatic_schedule_entry_string($schedule_titles[$i], $schedule_description[$i], $schedule_start_time[$i], $schedule_active_on[$i]);
}
}
echo PHP_EOL;
}
public static function send_message_to_server($msg)
{
if(!self::phoromatic_setup_module())
{
return false;
}
if(empty($msg))
{
echo PHP_EOL . 'Pass the message as the first argument.' . PHP_EOL;
return false;
}
if(self::report_warning_to_phoromatic('MESSAGE: ' . implode(' ', $msg)))
{
echo PHP_EOL . 'Message Sent To Phoromatic Server.' . PHP_EOL;
}
else
{
echo PHP_EOL . 'Message Failed To Send.' . PHP_EOL;
}
}
//
// Core Functions
//
public static function user_system_process()
{
define('PHOROMATIC_PROCESS', true);
$last_communication_minute = date('i');
$communication_attempts = 0;
static $current_hw = null;
static $current_sw = null;
if(define('PHOROMATIC_START', true))
{
echo PHP_EOL . 'Registering Status With Phoromatic Server @ ' . date('H:i:s') . PHP_EOL;
$times_tried = 0;
do
{
if($times_tried > 0)
{
echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
sleep(60);
}
$update_sd = self::update_system_details();
$times_tried++;
}
while(!$update_sd && $times_tried < 5);
if(!$update_sd)
{
echo 'Server connection still failed. Exiting...' . PHP_EOL;
return false;
}
$current_hw = phodevi::system_hardware(true);
$current_sw = phodevi::system_software(true);
echo PHP_EOL . 'Idling 30 seconds for system to settle...' . PHP_EOL;
sleep(30);
}
do
{
$exit_loop = false;
echo PHP_EOL . 'Checking Status From Phoromatic Server @ ' . date('H:i:s');
if($last_communication_minute == date('i') && $communication_attempts > 2)
{
// Something is wrong, Phoromatic shouldn't be communicating with server more than three times a minute
$response = 'idle';
}
else
{
$server_response = self::upload_to_remote_server(array('r' => 'status_check'));
$xml_parser = new nye_XmlReader($server_response);
$response = $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/Response');
if(date('i') != $last_communication_minute)
{
$last_communication_minute = date('i');
$communication_attempts = 0;
}
$communication_attempts++;
}
if($response != null)
{
echo ' [' . $response . ']' . PHP_EOL;
}
switch($response)
{
case 'benchmark':
$test_flags = pts_c::auto_mode;
do
{
$suite_identifier = 'phoromatic-' . rand(1000, 9999);
}
while(is_file(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml'));
pts_file_io::mkdir(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier);
file_put_contents(PTS_TEST_SUITE_PATH . 'local/' . $suite_identifier . '/suite-definition.xml', $server_response);
$phoromatic_schedule_id = $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/ID');
$phoromatic_results_identifier = $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/SystemName');
$phoromatic_trigger = $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/Trigger');
self::$openbenchmarking_upload_json = null;
$suite_identifier = 'local/' . $suite_identifier;
if(pts_strings::string_bool($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/RunInstallCommand', 'TRUE')))
{
self::set_user_context($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/SetContextPreInstall'), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
if(pts_strings::string_bool($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/ForceInstallTests', 'TRUE')))
{
$test_flags |= pts_c::force_install;
}
pts_client::set_test_flags($test_flags);
pts_test_installer::standard_install($suite_identifier);
}
self::set_user_context($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/SetContextPreRun'), $phoromatic_trigger, $phoromatic_schedule_id, 'INSTALL');
// Do the actual running
if(pts_test_run_manager::initial_checks($suite_identifier))
{
$test_run_manager = new pts_test_run_manager($test_flags);
// Load the tests to run
if($test_run_manager->load_tests_to_run($suite_identifier))
{
if(pts_strings::string_bool($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/UploadToGlobal', 'FALSE')))
{
$test_run_manager->auto_upload_to_openbenchmarking();
pts_openbenchmarking_client::override_client_setting('UploadSystemLogsByDefault', pts_strings::string_bool($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/UploadSystemLogs', 'TRUE')));
}
// Save results?
$save_identifier = date('Y-m-d H:i:s');
$test_run_manager->auto_save_results($save_identifier, $phoromatic_results_identifier, 'A Phoromatic run.');
// Run the actual tests
$test_run_manager->pre_execution_process();
$test_run_manager->call_test_runs();
$test_run_manager->post_execution_process();
// Upload to Phoromatic
pts_file_io::unlink(PTS_TEST_SUITE_PATH . $suite_identifier . '/suite-definition.xml');
// Upload test results
if(is_file(PTS_SAVE_RESULTS_PATH . $test_run_manager->get_file_name() . '/composite.xml'))
{
self::update_system_status('Uploading Test Results');
$times_tried = 0;
do
{
if($times_tried > 0)
{
echo PHP_EOL . 'Connection to server failed. Trying again in 60 seconds...' . PHP_EOL;
sleep(60);
}
$uploaded_test_results = self::upload_test_results($test_run_manager->get_file_name(), $phoromatic_schedule_id, $phoromatic_results_identifier, $phoromatic_trigger, $xml_parser);
$times_tried++;
}
while($uploaded_test_results == false && $times_tried < 5);
if($uploaded_test_results == false)
{
echo 'Server connection failed. Exiting...' . PHP_EOL;
return false;
}
if(pts_strings::string_bool($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/ArchiveResultsLocally', 'TRUE')) == false)
{
pts_client::remove_saved_result_file($test_run_manager->get_file_name());
}
}
}
}
break;
case 'exit':
echo PHP_EOL . 'Phoromatic received a remote command to exit.' . PHP_EOL;
self::update_system_status('Exiting Phoromatic');
pts_client::release_lock(PTS_USER_PATH . 'phoromatic_lock');
$exit_loop = true;
break;
case 'server_maintenance':
// The Phoromatic server is down for maintenance, so don't bother updating system status and wait longer before checking back
echo PHP_EOL . 'The Phoromatic server is currently down for maintenance. Waiting for service to be restored.' . PHP_EOL;
sleep((15 - (date('i') % 15)) * 60);
break;
case 'SHUTDOWN':
echo PHP_EOL . 'Shutting down the system.' . PHP_EOL;
$exit_loop = true;
shell_exec('poweroff'); // Currently assuming root
break;
case 'REBOOT':
echo PHP_EOL . 'Rebooting the system.' . PHP_EOL;
$exit_loop = true;
shell_exec('reboot'); // Currently assuming root
break;
case 'idle':
default:
self::update_system_status('Idling, Waiting For Task');
sleep((10 - (date('i') % 10)) * 60); // Check with server every 10 minutes
break;
}
if(phodevi::system_hardware(true) != $current_hw || phodevi::system_software(true) != $current_sw)
{
// Hardware and/or software has changed while PTS/Phoromatic has been running, update the Phoromatic Server
echo 'Updating Installed Hardware / Software With Phoromatic Server' . PHP_EOL;
self::update_system_details();
$current_hw = phodevi::system_hardware(true);
$current_sw = phodevi::system_software(true);
}
}
while($exit_loop == false);
self::update_system_status('Offline');
}
//
// Process Functions
//
public static function __pre_test_install($test_identifier)
{
static $last_update_time = 0;
if(time() > ($last_update_time + 600))
{
self::update_system_status('Installing Tests');
$last_update_time = time();
}
}
public static function __pre_test_run($pts_test_result)
{
// TODO: need a way to get the estimated time remaining from the test_run_manager so we can pass that back to the update_system_status parameter so server can read it
// TODO: report name of test identifier/run i.e. . ' For ' . PHOROMATIC_TITLE
self::update_system_status('Running ' . $pts_test_result->test_profile->get_identifier());
}
public static function __event_user_error($user_error)
{
// Report PTS user error warnings to Phoromatic server
self::report_warning_to_phoromatic($user_error->get_error_string());
}
public static function __event_results_saved($test_run_manager)
{
if(pts_module::read_variable('AUTO_UPLOAD_RESULTS_TO_PHOROMATIC') && pts_module::is_module_setup())
{
self::upload_unscheduled_test_results($test_run_manager->get_file_name());
}
}
public static function __event_openbenchmarking_upload($json)
{
self::$openbenchmarking_upload_json = $json;
}
//
// Other Functions
//
protected static function read_xml_value($file, $xml_option)
{
$xml_parser = new nye_XmlReader($file);
return $xml_parser->getXMLValue($xml_option);
}
private static function set_user_context($context_script, $trigger, $schedule_id, $process)
{
if(!empty($context_script))
{
if(!is_executable($context_script))
{
if(($context_script = pts_client::executable_in_path($context_script)) == false || !is_executable($context_script))
{
return false;
}
}
$storage_path = pts_module::save_dir() . 'memory.pt2so';
$storage_object = pts_storage_object::recover_from_file($storage_path);
// We check to see if the context was already set but the system rebooted or something in that script
if($storage_object == false)
{
$storage_object = new pts_storage_object(true, true);
}
else if($storage_object->read_object('last_set_context_trigger') == $trigger && $storage_object->read_object('last_set_context_schedule') == $schedule_id && $storage_object->read_object('last_set_context_process') == $process)
{
// If the script already ran once for this trigger, don't run it again
return false;
}
$storage_object->add_object('last_set_context_trigger', $trigger);
$storage_object->add_object('last_set_context_schedule', $schedule_id);
$storage_object->add_object('last_set_context_process', $process);
$storage_object->save_to_file($storage_path);
// Run the set context script
exec($context_script . ' ' . $trigger);
// Just simply return true for now, perhaps check exit code status and do something
return true;
}
return false;
}
protected static function update_system_details()
{
$server_response = self::upload_to_remote_server(array('r' => 'update_system_details', 'h' => phodevi::system_hardware(true), 's' => phodevi::system_software(true)));
self::$phoromatic_server_build = self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/Server/ServerBuild');
return self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response') == 'TRUE';
}
protected static function update_system_status($current_task, $estimated_time_remaining = 0)
{
$server_response = self::upload_to_remote_server(array('r' => 'update_system_status', 'a' => $current_task, 'time' => $estimated_time_remaining));
return self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response') == 'TRUE';
}
protected static function report_warning_to_phoromatic($warning)
{
$server_response = self::upload_to_remote_server(array('r' => 'report_pts_warning', 'a' => $warning));
return self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response') == 'TRUE';
}
private static function capture_test_logs($save_identifier, &$xml_parser = null)
{
$data = array('system-logs' => null, 'test-logs' => null);
if(is_dir(PTS_SAVE_RESULTS_PATH . $save_identifier . '/system-logs/') && ($xml_parser == null || $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/UploadSystemLogs', 'FALSE')))
{
$system_logs_zip = pts_client::create_temporary_file();
pts_compression::zip_archive_create($system_logs_zip, PTS_SAVE_RESULTS_PATH . $save_identifier . '/system-logs/');
$data['system-logs'] = base64_encode(file_get_contents($system_logs_zip));
unlink($system_logs_zip);
}
if(is_dir(PTS_SAVE_RESULTS_PATH . $save_identifier . '/test-logs/') && ($xml_parser == null || $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/UploadTestLogs', 'FALSE')))
{
$test_logs_zip = pts_client::create_temporary_file();
pts_compression::zip_archive_create($test_logs_zip, PTS_SAVE_RESULTS_PATH . $save_identifier . '/test-logs/');
$data['test-logs'] = base64_encode(file_get_contents($test_logs_zip));
unlink($test_logs_zip);
}
return $data;
}
protected static function upload_test_results($save_identifier, $phoromatic_schedule_id, $results_identifier, $phoromatic_trigger, &$xml_parser = null)
{
$composite_xml = file_get_contents(PTS_SAVE_RESULTS_PATH . $save_identifier . '/composite.xml');
if(self::$openbenchmarking_upload_json != null && isset(self::$openbenchmarking_upload_json['openbenchmarking']['upload']['id']))
{
$openbenchmarking_id = self::$openbenchmarking_upload_json['openbenchmarking']['upload']['id'];
}
else
{
$openbenchmarking_id = null;
}
$logs = self::capture_test_logs($save_identifier, $xml_parser);
$server_response = self::upload_to_remote_server(array(
'r' => 'upload_test_results',
'c' => $composite_xml,
'i' => $phoromatic_schedule_id,
'ti' => $results_identifier,
'ts' => $phoromatic_trigger,
'sl' => $logs['system-logs'],
'tl' => $logs['test-logs'],
'ob' => $openbenchmarking_id,
));
return self::read_xml_value($server_response, 'PhoronixTestSuite/Phoromatic/General/Response') == 'TRUE';
}
protected static function upload_unscheduled_test_results($save_identifier)
{
$composite_xml = file_get_contents(PTS_SAVE_RESULTS_PATH . $save_identifier . '/composite.xml');
$logs = self::capture_test_logs($save_identifier);
$server_response = self::upload_to_remote_server(array(
'r' => 'upload_test_results_unscheduled',
'c' => $composite_xml,
'i' => 0,
'ti' => 'Unknown',
'sl' => $logs['system-logs'],
'tl' => $logs['test-logs']
));
$xml_parser = new nye_XmlReader($server_response);
switch($xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/Response'))
{
case 'TRUE':
echo PHP_EOL . 'Uploaded To Phoromatic.' . PHP_EOL;
break;
case 'ERROR':
echo PHP_EOL . 'An Error Occurred.' . PHP_EOL;
break;
case 'SETTING_DISABLED':
echo PHP_EOL . 'You need to enable this support from your Phoromatic account web interface.' . PHP_EOL;
break;
}
return $xml_parser->getXMLValue('PhoronixTestSuite/Phoromatic/General/Response') == 'TRUE';
}
protected static function phoromatic_setup_module()
{
if(!pts_module::is_module_setup())
{
echo PHP_EOL . 'You first must run:' . PHP_EOL . PHP_EOL . 'phoronix-test-suite module-setup phoromatic' . PHP_EOL . PHP_EOL;
return false;
}
self::$phoromatic_host = pts_module::read_option('remote_host');
self::$phoromatic_account = pts_module::read_option('remote_account');
self::$phoromatic_verifier = pts_module::read_option('remote_verifier');
self::$phoromatic_system = pts_module::read_option('remote_system');
if(extension_loaded('openssl') == false)
{
// OpenSSL is not supported therefore no HTTPS support
self::$phoromatic_host = str_replace('https://', 'http://', self::$phoromatic_host);
}
$phoromatic = 'phoromatic';
pts_module_manager::attach_module($phoromatic);
return true;
}
protected static function phoromatic_schedule_entry_string($title, $description, $start_time, $active_on)
{
echo PHP_EOL . $title . ':' . PHP_EOL;
echo "\t" . $description . PHP_EOL;
echo "\t" . 'Runs at ' . $start_time . ' on ' . pts_strings::parse_week_string($active_on) . '.' . PHP_EOL;
}
//
// Connection
//
protected static function upload_to_remote_server($to_post, $host = null, $account = null, $verifier = null, $system = null)
{
static $last_communication_minute = null;
static $communication_attempts = 0;
if($last_communication_minute == date('i') && $communication_attempts > 3)
{
// Something is wrong, Phoromatic shouldn't be communicating with server more than four times a minute
return false;
}
else
{
if(date('i') != $last_communication_minute)
{
$last_communication_minute = date('i');
$communication_attempts = 0;
}
$communication_attempts++;
}
if($host != null)
{
//$host = $host;
$to_post['aid'] = $account;
$to_post['vid'] = $verifier;
$to_post['sid'] = $system;
}
else if(self::$phoromatic_host != null)
{
$host = self::$phoromatic_host;
$to_post['aid'] = self::$phoromatic_account;
$to_post['vid'] = self::$phoromatic_verifier;
$to_post['sid'] = self::$phoromatic_system;
}
else
{
echo PHP_EOL . 'Phoromatic isn\'t configured. Run: phoronix-test-suite module-setup phoromatic' . PHP_EOL . PHP_EOL;
return;
}
$to_post['pts'] = PTS_VERSION;
$to_post['pts_core'] = PTS_CORE_VERSION;
$to_post['gsid'] = PTS_GSID;
return pts_network::http_upload_via_post($host, $to_post);
}
}
?>

View File

@@ -26,7 +26,7 @@
class system_monitor extends pts_module_interface
{
const module_name = 'System Monitor';
const module_version = '3.1.0';
const module_version = '3.1.2';
const module_description = 'This module contains sensor monitoring support.';
const module_author = 'Michael Larabel';
@@ -46,7 +46,7 @@ class system_monitor extends pts_module_interface
public static function module_environmental_variables()
{
return array('MONITOR', 'PERFORMANCE_PER_WATT');
return array('MONITOR', 'PERFORMANCE_PER_WATT', 'MONITOR_INTERVAL');
}
public static function module_info()
{
@@ -113,6 +113,15 @@ class system_monitor extends pts_module_interface
}
echo PHP_EOL;
if(pts_module::read_variable('MONITOR_INTERVAL') != null)
{
$proposed_interval = pts_module::read_variable('MONITOR_INTERVAL');
if(is_numeric($proposed_interval) && $proposed_interval >= 1)
{
self::$sensor_monitoring_frequency = $proposed_interval;
}
}
// Pad some idling sensor results at the start
sleep((self::$sensor_monitoring_frequency * 8));
}
@@ -201,7 +210,7 @@ class system_monitor extends pts_module_interface
{
$test_result->test_profile->set_result_proportion('HIB');
$test_result->test_profile->set_result_scale('Performance Per Watt');
$test_result->set_result(pts_math::set_precision(1 / ($test_result->get_result() / $watt_average)));
$test_result->set_result(pts_math::set_precision((1 / $test_result->get_result()) / $watt_average) / 1);
$result_file_writer->add_result_from_result_object_with_value_string($test_result, $test_result->get_result());
}
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2010, Phoronix Media
Copyright (C) 2008 - 2010, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
update_checker.php: This module checks to see if the Phoronix Test Suite -- and its tests and suites -- are up to date.
This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@ class update_checker extends pts_module_interface
public static function __pre_option_process()
{
// Once a day check for new version
if(IS_FIRST_RUN_TODAY)
if(IS_FIRST_RUN_TODAY && pts_network::internet_support_available())
{
// Check For pts-core updates
$latest_reported_version = pts_network::http_get_contents('http://www.phoronix-test-suite.com/LATEST');

View File

@@ -23,6 +23,7 @@
class pts_client
{
public static $display = false;
public static $pts_logger = false;
private static $current_command = null;
protected static $lock_pointers = null;
private static $forked_pids = array();
@@ -81,6 +82,28 @@ class pts_client
self::build_temp_cache();
}
//XXX
pts_define('PTS_ETC_PATH', is_dir('/etc') ?'/etc/phoronix-test-suite/' : false);
if(is_dir('/usr/local/share/phoronix-test-suite/'))
{
pts_define('PTS_SHARE_PATH', '/usr/local/share/phoronix-test-suite/');
}
else if(is_dir('/usr/share/'))
{
pts_define('PTS_SHARE_PATH', '/usr/share/phoronix-test-suite/');
if(is_writable('/usr/share') && !is_dir(PTS_SHARE_PATH))
{
mkdir(PTS_SHARE_PATH);
}
}
else
{
pts_define('PTS_SHARE_PATH', false);
}
// XXX: technically the config init_files line shouldn't be needed since it should be dynamically called
// pts_config::init_files();
pts_define('PTS_TEST_INSTALL_DEFAULT_PATH', pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/EnvironmentDirectory', '~/.phoronix-test-suite/installed-tests/')));
@@ -605,6 +628,25 @@ class pts_client
$requested_gsid = false;
}
$machine_self_id = $pso->read_object('machine_self_id');
if(empty($machine_self_id))
{
$ns = md5('phoronix-test-suite');
$binary_ns = null;
for($i = 0; $i < strlen($ns); $i += 2)
{
$binary_ns .= chr(hexdec($ns[$i] . $ns[$i + 1]));
}
$msi_hash = sha1($binary_ns . uniqid(PTS_CORE_VERSION, true) . getenv('USERNAME') . getenv('USER') . getenv('HOSTNAME') . pts_network::get_local_ip());
$machine_self_id = sprintf('%08s-%04s-%04x-%04x-%12s', substr($msi_hash, 0, 8), substr($msi_hash, 8, 4), (hexdec(substr($msi_hash, 12, 4)) & 0x0fff) | 0x5000, (hexdec(substr($msi_hash, 16, 4)) & 0x3fff) | 0x8000, substr($msi_hash, 20, 12));
// machine_self_id is self-generated unique name for Phoromatic/OB purposes in UUIDv5 format
$pso->add_object('machine_self_id', $machine_self_id);
}
pts_define('PTS_MACHINE_SELF_ID', $machine_self_id);
// Last Run Processing
$last_core_version = $pso->read_object('last_core_version');
pts_define('FIRST_RUN_ON_PTS_UPGRADE', ($last_core_version != PTS_CORE_VERSION));
@@ -635,7 +677,7 @@ class pts_client
$last_run = $pso->read_object('last_run_time');
pts_define('IS_FIRST_RUN_TODAY', (substr($last_run, 0, 10) != date('Y-m-d')));
$pso->add_object('last_run_time', date('Y-m-d H:i:s')); // Time PTS was last run
pts_define('TIME_SINCE_LAST_RUN', ceil((time() - strtotime($last_run)) / 60)); // TIME_SINCE_LAST_RUN is in minutes
// User Agreement Checking
$agreement_cs = $pso->read_object('user_agreement_cs');
@@ -680,6 +722,42 @@ class pts_client
// Archive to disk
$pso->save_to_file(PTS_CORE_STORAGE);
}
public static function available_phoromatic_servers()
{
$phoromatic_servers = array();
$possible_servers = pts_network::find_zeroconf_phoromatic_servers(true);
$user_config_phoromatic_servers = pts_config::read_user_config('PhoronixTestSuite/Options/General/PhoromaticServers', '');
foreach(explode(',', $user_config_phoromatic_servers) as $static_server)
{
$static_server = explode(':', $static_server);
if(count($static_server) == 2)
{
array_push($possible_servers, array($static_server[0], $static_server[1]));
}
}
foreach($possible_servers as $possible_server)
{
// possible_server[0] is the Phoromatic Server IP
// possible_server[1] is the Phoromatic Server HTTP PORT
if(in_array($possible_server[0], array_keys($phoromatic_servers)))
{
continue;
}
$server_response = pts_network::http_get_contents('http://' . $possible_server[0] . ':' . $possible_server[1] . '/server.php', false, false, 3);
if(stripos($server_response, 'Phoromatic') !== false)
{
trigger_error('Phoromatic Server Auto-Detected At: ' . $possible_server[0] . ':' . $possible_server[1], E_USER_NOTICE);
$phoromatic_servers[$possible_server[0]] = array('ip' => $possible_server[0], 'http_port' => $possible_server[1]);
}
}
return $phoromatic_servers;
}
public static function user_agreement_check($command)
{
$pso = pts_storage_object::recover_from_file(PTS_CORE_STORAGE);
@@ -1354,7 +1432,7 @@ class pts_client
}
else
{
$pci = array_diff($pci, $pci_prev);
$pci = @array_diff($pci, $pci_prev);
}
}
@@ -1507,11 +1585,11 @@ class pts_client
return shell_exec($var_string . $exec);
}
public static function executable_in_path($executable)
public static function executable_in_path($executable, $ignore_paths_with = false)
{
static $cache = null;
if(!isset($cache[$executable]))
if(!isset($cache[$executable]) || $ignore_paths_with)
{
$paths = pts_strings::trim_explode((phodevi::is_windows() ? ';' : ':'), (($path = pts_client::read_env('PATH')) == false ? '/usr/bin:/usr/local/bin' : $path));
$executable_path = false;
@@ -1522,11 +1600,22 @@ class pts_client
if(is_executable($path . $executable))
{
if($ignore_paths_with && stripos($path, $ignore_paths_with) !== false)
{
continue;
}
$executable_path = $path . $executable;
break;
}
}
if($ignore_paths_with)
{
// Don't cache calls using the $ignore_paths_with parameter
return $executable_path;
}
$cache[$executable] = $executable_path;
}
@@ -1800,6 +1889,11 @@ class pts_client
break;
}
if(pts_client::$pts_logger != false)
{
pts_client::$pts_logger->report_error($error_type, $error_string, $error_file, $error_line);
}
if(pts_client::$display != false)
{
pts_client::$display->triggered_system_error($error_type, $error_string, $error_file, $error_line);

View File

@@ -30,7 +30,17 @@ class pts_config
{
static $init_process_ran = false;
static $xml_user_config = null;
private static $config_file_location = null;
public static function get_config_file_location()
{
if(self::$config_file_location == null)
{
self::$config_file_location = PTS_USER_PATH . 'user-config.xml';
}
return self::$config_file_location;
}
public static function init_files()
{
// Don't let the process run multiple times...
@@ -90,6 +100,7 @@ class pts_config
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/General/DefaultBrowser', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/General/UsePhodeviCache', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/General/DefaultDisplayMode', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/General/PhoromaticServers', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Modules/LoadModules', $read_config);
@@ -122,6 +133,7 @@ class pts_config
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/BatchMode/RunAllTestCombinations', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/BatchMode/Configured', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Networking/NoInternetCommunication', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Networking/NoNetworkCommunication', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Networking/Timeout', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Networking/ProxyAddress', $read_config);
@@ -130,8 +142,9 @@ class pts_config
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Server/RemoteAccessPort', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Server/Password', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Server/WebSocketPort', $read_config);
$config->addXmlNodeFromReader('PhoronixTestSuite/Options/Server/AdvertiseServiceZeroConf', $read_config);
$config->saveXMLFile(PTS_USER_PATH . 'user-config.xml');
$config->saveXMLFile(pts_config::get_config_file_location());
}
public static function bool_to_string($bool)
{

View File

@@ -0,0 +1,104 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
pts_logger.php: A simple log file generator
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class pts_logger
{
private $log_file = null;
public function __construct($log_file = null)
{
if($log_file == null)
{
if(is_writable('/var/log') && (PTS_MODE == 'WEB_CLIENT' || defined('PHOROMATIC_SERVER') || getenv('PTS_SERVER_PROCESS')))
$log_file = '/var/log/';
else
$log_file = PTS_USER_PATH;
$log_file .= (defined('PHOROMATIC_SERVER') ? 'phoromatic' : 'phoronix-test-suite') . '.log';
}
// if(file_exists($log_file))
// unlink($log_file);
// Flush log
if(getenv('PTS_NO_FLUSH_LOGGER') == false || !file_exists($log_file))
$fwrite = file_put_contents($log_file, null);
if(is_writable($log_file))
$this->log_file = $log_file;
}
public function clear_log()
{
if($this->log_file == null)
return;
file_put_contents($this->log_file, null);
}
public function log($message)
{
if($this->log_file == null)
return;
file_put_contents($this->log_file, '[' . date('D M ' . str_pad(date('j'), 2, ' ', STR_PAD_LEFT) . ' H:i:s Y') . '] ' . $message . PHP_EOL, FILE_APPEND);
}
public function get_log_file_location()
{
return $this->log_file;
}
public static function add_to_log($message)
{
static $logger = null;
if($logger == null)
$logger = new pts_logger();
$logger->log($message);
}
public function report_error($level, $message, $file, $line)
{
$error_string = '[' . $level . '] ';
if(strpos($message, PHP_EOL) === false)
{
$error_string .= $message . ' ';
}
else
{
foreach(pts_strings::trim_explode(PHP_EOL, $message) as $line_count => $line_string)
{
$error_string .= $line_string . PHP_EOL . str_repeat(' ', strlen($level) + 3);
}
}
if($file != null)
{
$error_string .= 'in ' . basename($file, '.php');
}
if($line != 0)
{
$error_string .= ':' . $line;
}
$this->log($error_string);
}
}
?>

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2011, Phoronix Media
Copyright (C) 2009 - 2011, Michael Larabel
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -78,7 +78,7 @@ class pts_module_manager
$class_vars = get_class_vars($module);
$module_val = isset($class_vars[$process]) ? $class_vars[$process] : false;
if($module_val == null)
if($module_val == null && defined($module . '::' . $process))
{
eval('$module_val = ' . $module . '::' . $process . ';');
}

View File

@@ -56,7 +56,7 @@ class pts_openbenchmarking_client
return false;
}
if(pts_network::network_support_available() == false)
if(pts_network::internet_support_available() == false)
{
echo PHP_EOL . 'No network support available.' . PHP_EOL;
return false;
@@ -306,7 +306,7 @@ class pts_openbenchmarking_client
{
if(isset($openbenchmarking['user_name']) && isset($openbenchmarking['communication_id']) && isset($openbenchmarking['sav']))
{
if(IS_FIRST_RUN_TODAY && pts_network::network_support_available())
if(IS_FIRST_RUN_TODAY && pts_network::internet_support_available())
{
// Might as well make sure OpenBenchmarking.org account has the latest system info
// But don't do it everytime to preserve bandwidth
@@ -413,6 +413,11 @@ class pts_openbenchmarking_client
}
public static function upload_usage_data($task, $data)
{
if(!pts_network::internet_support_available())
{
return false;
}
switch($task)
{
case 'test_install':
@@ -434,7 +439,7 @@ class pts_openbenchmarking_client
}
public static function upload_hwsw_data($to_report)
{
if(!defined('PTS_GSID'))
if(!defined('PTS_GSID') || !pts_network::internet_support_available())
{
return false;
}
@@ -455,7 +460,7 @@ class pts_openbenchmarking_client
}
public static function upload_pci_data($to_report)
{
if(!defined('PTS_GSID'))
if(!defined('PTS_GSID') || !pts_network::internet_support_available())
{
return false;
}
@@ -472,7 +477,7 @@ class pts_openbenchmarking_client
}
public static function upload_usb_data($to_report)
{
if(!defined('PTS_GSID'))
if(!defined('PTS_GSID') || !pts_network::internet_support_available())
{
return false;
}
@@ -489,6 +494,11 @@ class pts_openbenchmarking_client
}
public static function request_gsid()
{
if(!pts_network::internet_support_available())
{
return false;
}
$payload = array(
'client_version' => PTS_VERSION,
'client_os' => phodevi::read_property('system', 'vendor-identifier')
@@ -500,6 +510,11 @@ class pts_openbenchmarking_client
}
public static function update_gsid()
{
if(!pts_network::internet_support_available())
{
return false;
}
$payload = array(
'client_version' => PTS_VERSION,
'client_os' => phodevi::read_property('system', 'vendor-identifier')
@@ -508,6 +523,11 @@ class pts_openbenchmarking_client
}
public static function retrieve_gsid()
{
if(!pts_network::internet_support_available())
{
return false;
}
// If the GSID_E and GSID_P are not known due to being from an old client
$json = pts_openbenchmarking::make_openbenchmarking_request('retrieve_gsid', array());
$json = json_decode($json, true);

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2013, Phoronix Media
Copyright (C) 2008 - 2013, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -98,7 +98,11 @@ class pts_test_file_download
}
public function check_file_hash($file)
{
if(pts_client::read_env('NO_FILE_HASH_CHECKS') != false)
if(!is_file($file))
{
return false;
}
else if(pts_client::read_env('NO_FILE_HASH_CHECKS') != false || pts_flags::skip_md5_checks())
{
return true;
}
@@ -110,10 +114,14 @@ class pts_test_file_download
{
return md5_file($file) == $this->md5;
}
else
else if(filesize($file) > 0)
{
return true;
}
else
{
return false;
}
}
public function set_filesize($size)
{

View File

@@ -72,10 +72,11 @@ class pts_test_install_manager
$remote_files = self::remote_files_available_in_download_caches();
$local_download_caches = self::local_download_caches();
$remote_download_caches = self::remote_download_caches();
$phoromatic_server_caches = pts_test_install_manager::phoromatic_download_server_caches();
foreach($this->tests_to_install as $i => &$test_install_request)
{
$test_install_request->scan_download_caches($local_download_caches, $remote_download_caches, $remote_files);
$test_install_request->scan_download_caches($local_download_caches, $remote_download_caches, $remote_files, $phoromatic_server_caches);
pts_client::$display->test_install_progress_update(($i / $test_count));
}
pts_client::$display->test_install_progress_completed();
@@ -86,34 +87,32 @@ class pts_test_install_manager
foreach(self::remote_download_caches() as $dc_directory)
{
if(($xml_dc_file = pts_network::http_get_contents($dc_directory . 'pts-download-cache.xml')) != false)
if(($json_dc_file = pts_network::http_get_contents($dc_directory . 'pts-download-cache.xml')) != false)
{
$xml_dc_parser = new nye_XmlReader($xml_dc_file);
$dc_file = $xml_dc_parser->getXMLArrayValues('PhoronixTestSuite/DownloadCache/Package/FileName');
$dc_md5 = $xml_dc_parser->getXMLArrayValues('PhoronixTestSuite/DownloadCache/Package/MD5');
$json_dc = json_decode($json_dc_file, true);
foreach(array_keys($dc_file) as $i)
foreach($json_download_cache['phoronix-test-suite']['download-cache'] as $cached_file)
{
if(!isset($remote_download_files[$dc_md5[$i]]))
if(!isset($remote_download_files[$cached_file['file_name']]))
{
$remote_download_files[$dc_md5[$i]] = array();
$remote_download_files[$cached_file['file_name']] = array();
}
array_push($remote_download_files[$dc_md5[$i]], $dc_directory . $dc_file[$i]);
array_push($remote_download_files[$cached_file['file_name']], $dc_directory . $cached_file['file_name']);
}
}
}
return $remote_download_files;
}
public static function file_lookaside_test_installations($package_filename, $package_md5, $package_sha256)
public static function file_lookaside_test_installations(&$test_file_download)
{
// Check to see if the same package name with the same package check-sum is already present in another test installation
$package_match = false;
foreach(pts_file_io::glob(pts_client::test_install_root_path() . '*/*/' . $package_filename) as $possible_package_match)
foreach(pts_file_io::glob(pts_client::test_install_root_path() . '*/*/' . $test_file_download->get_filename()) as $possible_package_match)
{
// Check to see if the same package name with the same package check-sum is already present in another test installation
if(pts_test_installer::validate_sha256_download_file($possible_package_match, $package_sha256) || pts_test_installer::validate_md5_download_file($possible_package_match, $package_md5))
if($test_file_download->check_file_hash($possible_package_match))
{
$package_match = $possible_package_match;
break;
@@ -219,6 +218,32 @@ class pts_test_install_manager
return $cache_directories;
}
public static function phoromatic_download_server_caches()
{
static $caches = null;
if($caches == null)
{
$caches = array();
$archived_servers = pts_client::available_phoromatic_servers();
foreach($archived_servers as $archived_server)
{
$repo = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/download-cache.php?repo');
if(!empty($repo))
{
$repo = json_decode($repo, true);
if($repo && isset($repo['phoronix-test-suite']['download-cache']))
{
$caches[$archived_server['ip'] . ':' . $archived_server['http_port']] = $repo['phoronix-test-suite']['download-cache'];
}
}
}
}
return $caches;
}
}
?>

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2013, Phoronix Media
Copyright (C) 2010 - 2013, Michael Larabel
Copyright (C) 2010 - 2014, Phoronix Media
Copyright (C) 2010 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -113,9 +113,10 @@ class pts_test_install_request
$remote_files = pts_test_install_manager::remote_files_available_in_download_caches();
$local_download_caches = pts_test_install_manager::local_download_caches();
$remote_download_caches = pts_test_install_manager::remote_download_caches();
$phoromatic_server_caches = pts_test_install_manager::phoromatic_download_server_caches();
$install_request->generate_download_object_list();
$install_request->scan_download_caches($local_download_caches, $remote_download_caches, $remote_files);
$install_request->scan_download_caches($local_download_caches, $remote_download_caches, $remote_files, $phoromatic_server_caches);
foreach($install_request->get_download_objects() as $download_object)
{
@@ -135,7 +136,7 @@ class pts_test_install_request
return true;
}
public function scan_download_caches($local_download_caches, $remote_download_caches, $remote_files)
public function scan_download_caches($local_download_caches, $remote_download_caches, $remote_files, $phoromatic_server_caches)
{
$download_location = $this->test_profile->get_install_dir();
$main_download_cache = pts_strings::add_trailing_slash(pts_client::parse_home_directory(pts_config::read_user_config('PhoronixTestSuite/Options/Installation/CacheDirectory', PTS_DOWNLOAD_CACHE_PATH)));
@@ -143,8 +144,6 @@ class pts_test_install_request
foreach($this->test_files as &$download_package)
{
$package_filename = $download_package->get_filename();
$package_md5 = $download_package->get_md5();
$package_sha256 = $download_package->get_sha256();
if(is_file($download_location . $package_filename))
{
@@ -168,12 +167,22 @@ class pts_test_install_request
$download_package->set_download_location('MAIN_DOWNLOAD_CACHE', array($main_download_cache . $package_filename));
}
else if(is_file(PTS_SHARE_PATH . 'download-cache/' . $package_filename))
{
// In system's /usr/share download cache
if($download_package->get_filesize() == 0)
{
$download_package->set_filesize(filesize(PTS_SHARE_PATH . 'download-cache/' . $package_filename));
}
$download_package->set_download_location('MAIN_DOWNLOAD_CACHE', array(PTS_SHARE_PATH . 'download-cache/' . $package_filename));
}
else
{
// Scan the local download caches
foreach($local_download_caches as &$cache_directory)
{
if(pts_test_installer::validate_sha256_download_file($cache_directory . $package_filename, $package_sha256) || pts_test_installer::validate_md5_download_file($cache_directory . $package_filename, $package_md5))
if(is_file($cache_directory . $package_filename) && $download_package->check_file_hash($cache_directory . $package_filename))
{
if($download_package->get_filesize() == 0)
{
@@ -187,7 +196,7 @@ class pts_test_install_request
// Look-aside download cache copy
// Check to see if the same package name with the same package check-sum is already present in another test installation
$lookaside_copy = pts_test_install_manager::file_lookaside_test_installations($package_filename, $package_md5, $package_sha256);
$lookaside_copy = pts_test_install_manager::file_lookaside_test_installations($download_package);
if($lookaside_copy)
{
if($download_package->get_filesize() == 0)
@@ -198,12 +207,25 @@ class pts_test_install_request
$download_package->set_download_location('LOOKASIDE_DOWNLOAD_CACHE', array($lookaside_copy));
}
// Check Phoromatic server caches
if($download_package->get_download_location_type() == null && $phoromatic_server_caches)
{
foreach($phoromatic_server_caches as $server_url => $repo)
{
if(isset($repo[$package_filename]) && ($repo[$package_filename]['md5'] == $download_package->get_md5() || $repo[$package_filename]['sha256'] == $download_package->get_sha256() || ($download_package->get_sha256() == null && $download_package->get_md5() == null)))
{
$download_package->set_download_location('REMOTE_DOWNLOAD_CACHE', array($server_url . '/download-cache.php?download=' . $package_filename));
break;
}
}
}
// If still not found, check remote download caches
if($download_package->get_download_location_type() == null)
{
if(!empty($package_md5) && isset($remote_files[$package_md5]))
if(isset($remote_files[$package_filename]))
{
$download_package->set_download_location('REMOTE_DOWNLOAD_CACHE', $remote_files[$package_md5]);
$download_package->set_download_location('REMOTE_DOWNLOAD_CACHE', $remote_files[$package_filename]);
}
else
{

View File

@@ -214,15 +214,13 @@ class pts_test_installer
foreach($test_install_request->get_download_objects() as $download_package)
{
$package_filename = $download_package->get_filename();
$package_md5 = $download_package->get_md5();
$package_sha256 = $download_package->get_sha256();
$download_destination = $download_location . $package_filename;
$download_destination_temp = $download_destination . '.pts';
if($download_package->get_download_location_type() == null)
{
// Attempt a possible last-minute look-aside copy cache in case a previous test in the install queue downloaded this file already
$lookaside_copy = pts_test_install_manager::file_lookaside_test_installations($package_filename, $package_md5, $package_sha256);
$lookaside_copy = pts_test_install_manager::file_lookaside_test_installations($download_package);
if($lookaside_copy)
{
if($download_package->get_filesize() == 0)
@@ -240,21 +238,32 @@ class pts_test_installer
pts_client::$display->test_install_download_file('FILE_FOUND', $download_package);
continue;
case 'REMOTE_DOWNLOAD_CACHE':
foreach($download_package->get_download_location_path() as $remote_download_cache_file)
$download_tries = 0;
do
{
pts_client::$display->test_install_download_file('DOWNLOAD_FROM_CACHE', $download_package);
pts_network::download_file($remote_download_cache_file, $download_destination_temp);
foreach($download_package->get_download_location_path() as $remote_download_cache_file)
{
pts_client::$display->test_install_download_file('DOWNLOAD_FROM_CACHE', $download_package);
pts_network::download_file($remote_download_cache_file, $download_destination_temp);
if(pts_test_installer::validate_md5_download_file($download_destination_temp, $package_md5))
{
rename($download_destination_temp, $download_destination);
continue;
}
else
{
pts_client::$display->test_install_error('The check-sum of the downloaded file failed.');
pts_file_io::unlink($download_destination_temp);
if($download_package->check_file_hash($download_destination_temp))
{
rename($download_destination_temp, $download_destination);
break;
}
else
{
pts_client::$display->test_install_error('The check-sum of the downloaded file failed.');
pts_file_io::unlink($download_destination_temp);
}
}
$download_tries++;
}
while(!is_file($download_destination) && $download_tries < 2);
if(is_file($download_destination))
{
continue;
}
case 'MAIN_DOWNLOAD_CACHE':
case 'LOCAL_DOWNLOAD_CACHE':
@@ -286,7 +295,7 @@ class pts_test_installer
pts_client::$display->test_install_progress_completed();
// Verify that the file was copied fine
if(pts_test_installer::validate_md5_download_file($download_destination_temp, $package_md5))
if($download_package->check_file_hash($download_destination_temp))
{
rename($download_destination_temp, $download_destination);
break;
@@ -317,33 +326,41 @@ class pts_test_installer
do
{
if((pts_c::$test_flags ^ pts_c::batch_mode) && (pts_c::$test_flags ^ pts_c::auto_mode) && pts_config::read_bool_config('PhoronixTestSuite/Options/Installation/PromptForDownloadMirror', 'FALSE') && count($package_urls) > 1)
if(pts_network::internet_support_available())
{
// Prompt user to select mirror
do
if((pts_c::$test_flags ^ pts_c::batch_mode) && (pts_c::$test_flags ^ pts_c::auto_mode) && pts_config::read_bool_config('PhoronixTestSuite/Options/Installation/PromptForDownloadMirror', 'FALSE') && count($package_urls) > 1)
{
echo PHP_EOL . 'Available Download Mirrors:' . PHP_EOL . PHP_EOL;
$url = pts_user_io::prompt_text_menu('Select Preferred Mirror', $package_urls, false);
// Prompt user to select mirror
do
{
echo PHP_EOL . 'Available Download Mirrors:' . PHP_EOL . PHP_EOL;
$url = pts_user_io::prompt_text_menu('Select Preferred Mirror', $package_urls, false);
}
while(pts_strings::is_url($url) == false);
}
while(pts_strings::is_url($url) == false);
else
{
// Auto-select mirror
shuffle($package_urls);
do
{
$url = array_pop($package_urls);
}
while(pts_strings::is_url($url) == false && !empty($package_urls));
}
pts_client::$display->test_install_download_file('DOWNLOAD', $download_package);
$download_start = time();
pts_network::download_file($url, $download_destination_temp);
$download_end = time();
}
else
{
// Auto-select mirror
shuffle($package_urls);
do
{
$url = array_pop($package_urls);
}
while(pts_strings::is_url($url) == false && !empty($package_urls));
pts_client::$display->test_install_error('Internet support is needed and it\'s disabled or not available.');
return false;
}
pts_client::$display->test_install_download_file('DOWNLOAD', $download_package);
$download_start = time();
pts_network::download_file($url, $download_destination_temp);
$download_end = time();
if(pts_test_installer::validate_md5_download_file($download_destination_temp, $package_md5))
if($download_package->check_file_hash($download_destination_temp))
{
// Download worked
if(is_file($download_destination_temp))
@@ -359,7 +376,12 @@ class pts_test_installer
else
{
// Download failed
if(is_file($download_destination_temp) && filesize($download_destination_temp) > 0)
if(is_file($download_destination_temp) && filesize($download_destination_temp) < 500 && (stripos(file_get_contents($download_destination_temp), 'not found') !== false || strpos(file_get_contents($download_destination_temp), 404) !== false))
{
pts_client::$display->test_install_error('File Not Found: ' . $url);
$md5_failed = false;
}
else if(is_file($download_destination_temp) && filesize($download_destination_temp) > 0)
{
pts_client::$display->test_install_error('MD5 Failed: ' . $url);
$md5_failed = true;
@@ -459,7 +481,7 @@ class pts_test_installer
foreach($possible_compilers as $i => $possible_compiler)
{
// first check to ensure not null sent to executable_in_path from env variable
if($possible_compiler && (($compiler_path = is_executable($possible_compiler)) || ($compiler_path = pts_client::executable_in_path($possible_compiler))))
if($possible_compiler && (($compiler_path = is_executable($possible_compiler)) || ($compiler_path = pts_client::executable_in_path($possible_compiler, 'ccache'))))
{
// Replace the array of possible compilers with a string to the detected compiler executable
$compilers[$compiler_type] = $compiler_path;
@@ -784,94 +806,6 @@ class pts_test_installer
return $installed;
}
public static function validate_md5_download_file($filename, $verified_md5)
{
$valid = false;
if(is_file($filename))
{
if(pts_flags::skip_md5_checks())
{
$valid = true;
}
else if(!empty($verified_md5))
{
$real_md5 = md5_file($filename);
if(pts_strings::is_url($verified_md5))
{
foreach(pts_strings::trim_explode("\n", pts_network::http_get_contents($verified_md5)) as $md5_line)
{
list($md5, $file) = explode(' ', $md5_line);
if($file == $filename)
{
if($md5 == $real_md5)
{
$valid = true;
}
break;
}
}
}
else if($real_md5 == $verified_md5)
{
$valid = true;
}
}
else
{
$valid = true;
}
}
return $valid;
}
public static function validate_sha256_download_file($filename, $verified_sha256)
{
$valid = false;
if(is_file($filename))
{
if(pts_flags::skip_md5_checks())
{
$valid = true;
}
else if(!empty($verified_sha256))
{
$real_sha256 = hash_file('sha256', $filename);
if(pts_strings::is_url($verified_sha256))
{
foreach(pts_strings::trim_explode("\n", pts_network::http_get_contents($verified_sha256)) as $sha256_line)
{
list($sha256, $file) = explode(' ', $sha256_line);
if($file == $filename)
{
if($sha256 == $real_sha256)
{
$valid = true;
}
break;
}
}
}
else if($real_sha256 == $verified_sha256)
{
$valid = true;
}
}
else
{
$valid = true;
}
}
return $valid;
}
protected static function setup_test_install_directory(&$test_install_request, $remove_old_files = false)
{
$identifier = $test_install_request->test_profile->get_identifier();

View File

@@ -281,14 +281,18 @@ class pts_test_run_manager
pts_tests::recently_saved_results();
}
while(empty($save_name) || ($is_reserved_word = pts_types::is_test_or_suite($save_name)))
$save_name_length = strlen($save_name);
while(empty($save_name) || ($is_reserved_word = pts_types::is_test_or_suite($save_name)) || $save_name_length > 126)
{
if($is_reserved_word)
{
echo PHP_EOL . 'The name of the saved file cannot be the same as a test/suite: ' . $save_name . PHP_EOL;
$is_reserved_word = false;
}
if($save_name_length > 126)
{
echo PHP_EOL . 'The name of the saved file must have between 2 and 126 characters in length.' . PHP_EOL;
}
pts_client::$display->generic_prompt('Enter a name to save these results under: ');
$save_name = pts_user_io::read_user_input();
@@ -700,6 +704,11 @@ class pts_test_run_manager
$input = strtolower($input);
}
if(strlen($input) > 126)
{
$input = substr($input, 0, 126);
}
return $input;
}
public static function initial_checks(&$to_run, $test_flags = 0)
@@ -901,7 +910,7 @@ class pts_test_run_manager
}
}
if($this->allow_sharing_of_results && pts_network::network_support_available())
if($this->allow_sharing_of_results && pts_network::internet_support_available())
{
if($this->auto_upload_to_openbenchmarking || pts_openbenchmarking_client::auto_upload_results() || pts_flags::upload_to_openbenchmarking())
{
@@ -1089,7 +1098,7 @@ class pts_test_run_manager
echo $message;
}
if((pts_c::$test_flags & pts_c::auto_mode) == false && (pts_c::$test_flags & pts_c::batch_mode) == false && pts_flags::is_live_cd() == false && pts_client::current_command() != 'benchmark')
if((pts_c::$test_flags & pts_c::batch_mode) == false && (pts_c::$test_flags & pts_c::auto_mode) == false && pts_flags::is_live_cd() == false && pts_client::current_command() != 'benchmark')
{
$stop_and_install = pts_user_io::prompt_bool_input('Would you like to stop and install these tests now', true);

View File

@@ -39,7 +39,7 @@ class pts_tests
{
$error = null;
foreach(array('fatal error', 'error:', 'error while loading', 'undefined reference', 'returned 1 exit status', 'not found', 'child process excited with status', 'error opening archive') as $error_string)
foreach(array('fatal error', 'error:', 'error while loading', 'undefined reference', 'returned 1 exit status', 'not found', 'child process excited with status', 'error opening archive', 'failed to load') as $error_string)
{
if(($e = strripos($log_file, $error_string)) !== false)
{

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2011, Phoronix Media
Copyright (C) 2010 - 2011, Michael Larabel
Copyright (C) 2010 - 2014, Phoronix Media
Copyright (C) 2010 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,11 @@ class pts_config_nye_XmlReader extends nye_XmlReader
public function __construct($new_values = null)
{
if(is_file(PTS_USER_PATH . 'user-config.xml'))
if(is_file(pts_config::get_config_file_location()))
{
$file = pts_config::get_config_file_location();
}
else if(PTS_USER_PATH . 'user-config.xml' != pts_config::get_config_file_location() && is_file(PTS_USER_PATH . 'user-config.xml'))
{
$file = PTS_USER_PATH . 'user-config.xml';
}

View File

@@ -818,8 +818,10 @@ class phodevi_gpu extends phodevi_device_interface
}
else if(phodevi::is_mesa_graphics())
{
switch(phodevi::read_property('system', 'display-driver'))
$display_driver = phodevi::read_property('system', 'display-driver');
switch($display_driver)
{
case '':
case 'nouveau':
if(is_file('/sys/class/drm/card0/device/performance_level'))
{
@@ -858,13 +860,36 @@ class phodevi_gpu extends phodevi_device_interface
// pstate is present with Linux 3.13 as the new performance states on Fermi/Kepler
$performance_state = pts_file_io::file_get_contents('/sys/class/drm/card0/device/pstate');
$performance_level = substr($performance_state, 0, strpos($performance_state, ' *'));
$performance_level = substr($performance_level, strrpos($performance_level, ': ') + 2);
if($performance_level == null)
{
// Method for Linux 3.17+
$performance_level = substr($performance_state, strpos($performance_state, 'AC: ') + 4);
if(($t = strpos($performance_level, PHP_EOL)))
{
$performance_level = substr($performance_level, 0, $t);
}
}
else
{
// Method for Linux ~3.13 through Linux 3.16
$performance_level = substr($performance_level, strrpos($performance_level, ': ') + 2);
}
$performance_level = explode(' ', $performance_level);
$core_string = array_search('core', $performance_level);
if($core_string !== false && isset($performance_level[($core_string + 1)]))
{
$core_string = str_ireplace('MHz', null, $performance_level[($core_string + 1)]);
if(strpos($core_string, '-') !== false)
{
// to work around a range of values, e.g.
// 0a: core 405-1032 MHz memory 1620 MHz AC DC *
$core_string = max(explode('-', $core_string));
}
if(is_numeric($core_string))
{
$core_freq = $core_string;
@@ -875,6 +900,14 @@ class phodevi_gpu extends phodevi_device_interface
if($mem_string !== false && isset($performance_level[($mem_string + 1)]))
{
$mem_string = str_ireplace('MHz', null, $performance_level[($mem_string + 1)]);
if(strpos($mem_string, '-') !== false)
{
// to work around a range of values, e.g.
// 0a: core 405-1032 MHz memory 1620 MHz AC DC *
$mem_string = max(explode('-', $mem_string));
}
if(is_numeric($mem_string))
{
$mem_freq = $mem_string;
@@ -882,7 +915,10 @@ class phodevi_gpu extends phodevi_device_interface
}
}
break;
if($display_driver != null)
{
break;
}
case 'radeon':
if(isset(phodevi::$vfs->radeon_pm_info))
{
@@ -994,7 +1030,10 @@ class phodevi_gpu extends phodevi_device_interface
}
}
}
break;
if($display_driver != null)
{
break;
}
case 'intel':
// try to read the maximum dynamic frequency
if(is_file('/sys/class/drm/card0/gt_max_freq_mhz'))
@@ -1046,7 +1085,10 @@ class phodevi_gpu extends phodevi_device_interface
}
}
}
break;
if($display_driver != null)
{
break;
}
}
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2013, Phoronix Media
Copyright (C) 2008 - 2013, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
phodevi_monitor.php: The PTS Device Interface object for the display monitor
This program is free software; you can redistribute it and/or modify
@@ -45,6 +45,8 @@ class phodevi_monitor extends phodevi_device_interface
}
public static function monitor_string()
{
$monitor = null;
if(phodevi::is_macosx())
{
$system_profiler = shell_exec('system_profiler SPDisplaysDataType 2>&1');
@@ -112,6 +114,58 @@ class phodevi_monitor extends phodevi_device_interface
$monitor = implode(' + ', $monitor);
}
if($monitor == null && phodevi::is_linux())
{
// Attempt to find the EDID over sysfs and then decode it for monitor name (0xFC)
// For at least Intel DRM drivers there is e.g. /sys/class/drm/card0-HDMI-A-2/edid
// Also works at least for Radeon DRM driver too
foreach(glob('/sys/class/drm/*/edid') as $edid_file)
{
$edid_file = pts_file_io::file_get_contents($edid_file);
if($edid_file == null)
{
continue;
}
$edid = bin2hex($edid_file);
$x = 0;
while($x = strpos($edid, '00fc', $x))
{
// 00fc indicates start of EDID monitor descriptor block
$encoded = substr($edid, $x + 4, 36);
$edid_monitor_name_block = null;
for($i = 0; $i < strlen($encoded); $i += 2)
{
$hex = substr($encoded, $i, 2);
if($hex == 15 || $hex == '0a')
{
break;
}
$ch = chr(hexdec($hex));
$edid_monitor_name_block .= $ch;
}
$edid_monitor_name_block = trim($edid_monitor_name_block);
if(pts_strings::string_only_contains($edid_monitor_name_block, (pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH)))
{
$monitor = $edid_monitor_name_block;
break;
}
$x++;
}
if($monitor != null)
{
break;
}
}
}
return empty($monitor) ? false : $monitor;
}
public static function monitor_count()

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2012, Phoronix Media
Copyright (C) 2008 - 2012, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
phodevi_motherboard.php: The PTS Device Interface object for the motherboard
This program is free software; you can redistribute it and/or modify
@@ -419,6 +419,11 @@ class phodevi_motherboard extends phodevi_device_interface
{
$info = phodevi_linux_parser::read_sys_dmi('product_name');
}
if(empty($info) && is_file('/sys/bus/soc/devices/soc0/machine'))
{
$info = pts_file_io::file_get_contents('/sys/bus/soc/devices/soc0/machine');
}
}
else if(phodevi::is_windows())
{

View File

@@ -912,6 +912,21 @@ class phodevi_system extends phodevi_device_interface
else if(phodevi::is_linux())
{
$os_version = phodevi_linux_parser::read_lsb('Release');
if($os_version == null && is_readable('/etc/os-release'))
{
$os_release = parse_ini_file('/etc/os-release');
if(isset($os_release['VERSION_ID']) && !empty($os_release['VERSION_ID']))
{
$os_version = $os_release['VERSION_ID'];
}
else if(isset($os_release['VERSION']) && !empty($os_release['VERSION']))
{
$os_version = $os_release['VERSION'];
}
$os_version = pts_strings::keep_in_string($os_version, pts_strings::CHAR_LETTER | pts_strings::CHAR_NUMERIC | pts_strings::CHAR_DECIMAL | pts_strings::CHAR_SPACE | pts_strings::CHAR_DASH | pts_strings::CHAR_UNDERSCORE);
}
}
else
{
@@ -932,6 +947,20 @@ class phodevi_system extends phodevi_device_interface
if(phodevi::is_linux())
{
$vendor = phodevi_linux_parser::read_lsb_distributor_id();
if($vendor == null && is_readable('/etc/os-release'))
{
$os_release = parse_ini_file('/etc/os-release');
if(isset($os_release['PRETTY_NAME']) && !empty($os_release['PRETTY_NAME']))
{
$vendor = $os_release['PRETTY_NAME'];
}
else if(isset($os_release['NAME']) && !empty($os_release['NAME']))
{
$vendor = $os_release['NAME'];
}
}
}
else if(phodevi::is_hurd())
{
@@ -1020,10 +1049,14 @@ class phodevi_system extends phodevi_device_interface
}
}
}
else
else if(stripos($vendor, $version) === false)
{
$os = $vendor . ' ' . $version;
}
else
{
$os = $vendor;
}
if(($break_point = strpos($os, ':')) > 0)
{
@@ -1258,7 +1291,7 @@ class phodevi_system extends phodevi_device_interface
}
if(($x_bin = pts_client::executable_in_path('Xorg')) || ($x_bin = pts_client::executable_in_path('X')))
if(($x_bin = (is_executable('/usr/libexec/Xorg.bin') ? '/usr/libexec/Xorg.bin' : false)) || ($x_bin = pts_client::executable_in_path('Xorg')) || ($x_bin = pts_client::executable_in_path('X')))
{
// Find graphics subsystem version
$info = shell_exec($x_bin . ' ' . (phodevi::is_solaris() ? ':0' : '') . ' -version 2>&1');
@@ -1648,7 +1681,7 @@ class phodevi_system extends phodevi_device_interface
}
else if(is_file('/sys/class/drm/card0/device/vendor'))
{
$vendor_id = file_get_contents('/sys/class/drm/card0/device/vendor');
$vendor_id = pts_file_io::file_get_contents('/sys/class/drm/card0/device/vendor');
switch($vendor_id)
{

View File

@@ -149,6 +149,7 @@ class phodevi_parser
if(isset(phodevi::$vfs->xorg_log))
{
$xorg_log = phodevi::$vfs->xorg_log;
if(($module_start = strpos($xorg_log, $module)) > 0)
{
$xorg_log = substr($xorg_log, $module_start);

View File

@@ -45,7 +45,11 @@ class phodevi_vfs
'i915_capabilities' => array('type' => 'F', 'F' => '/sys/kernel/debug/dri/0/i915_capabilities', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'GPU'),
'i915_cur_delayinfo' => array('type' => 'F', 'F' => '/sys/kernel/debug/dri/0/i915_cur_delayinfo', 'cacheable' => false, 'preserve' => true, 'subsystem' => 'GPU'),
'i915_drpc_info' => array('type' => 'F', 'F' => '/sys/kernel/debug/dri/0/i915_drpc_info', 'cacheable' => false, 'preserve' => true, 'subsystem' => 'GPU'),
'xorg_log' => array('type' => 'F', 'F' => '/var/log/Xorg.0.log', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'System', 'remove_timestamps' => true),
'xorg_log' => array(
array('type' => 'F', 'F' => '/var/log/Xorg.0.log', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'System', 'remove_timestamps' => true),
array('type' => 'C', 'C' => 'journalctl -o cat /usr/bin/Xorg', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'System', 'remove_timestamps' => true),
array('type' => 'C', 'C' => 'journalctl -o cat /usr/libexec/Xorg.bin', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'System', 'remove_timestamps' => true)
),
'xorg_conf' => array('type' => 'F', 'F' => '/etc/X11/xorg.conf', 'cacheable' => true, 'preserve' => true, 'subsystem' => 'System'),
'dmesg' => array('type' => 'C', 'C' => 'dmesg', 'cacheable' => false, 'preserve' => true, 'subsystem' => 'System', 'remove_timestamps' => true),
);
@@ -130,36 +134,58 @@ class phodevi_vfs
}
else if(PTS_IS_CLIENT && isset($this->options[$name]))
{
if($this->options[$name]['type'] == 'F')
if(isset($this->options[$name]['type']))
{
$contents = file_get_contents($this->options[$name]['F']);
$tries = array($this->options[$name]);
}
else if($this->options[$name]['type'] == 'C')
else
{
$command = pts_client::executable_in_path(pts_strings::first_in_string($this->options[$name]['C']));
$descriptor_spec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);
$proc = proc_open($command, $descriptor_spec, $pipes, null, null);
$contents = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($proc);
$tries = $this->options[$name];
}
if(isset($this->options[$name]['remove_timestamps']) && $this->options[$name]['remove_timestamps'])
{
// remove leading timestamps such as from dmesg and Xorg.0.log
$contents = pts_strings::remove_line_timestamps($contents);
}
$contents = null;
if($this->options[$name]['cacheable'])
foreach($tries as &$try)
{
$this->cache[$name] = $contents;
}
return PHP_EOL . $contents . PHP_EOL;
if($try['type'] == 'F' && is_file($try['F']))
{
$contents = file_get_contents($try['F']);
}
else if($try['type'] == 'C')
{
$command = pts_client::executable_in_path(pts_strings::first_in_string($try['C']));
if($command != null)
{
$descriptor_spec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);
$proc = proc_open($try['C'], $descriptor_spec, $pipes, null, null);
$contents = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$return_value = proc_close($proc);
}
}
if(isset($try['remove_timestamps']) && $try['remove_timestamps'])
{
// remove leading timestamps such as from dmesg and Xorg.0.log
$contents = pts_strings::remove_line_timestamps($contents);
}
if($contents != null)
{
if($try['cacheable'])
{
$this->cache[$name] = $contents;
}
return PHP_EOL . $contents . PHP_EOL;
}
}
}
return false;
@@ -179,7 +205,22 @@ class phodevi_vfs
if(!isset($isset_cache[$name]))
{
$isset_cache[$name] = ($this->options[$name]['type'] == 'F' && is_readable($this->options[$name]['F'])) || ($this->options[$name]['type'] == 'C' && pts_client::executable_in_path(pts_strings::first_in_string($this->options[$name]['C'])));
if(isset($this->options[$name]['type']))
{
$isset_cache[$name] = ($this->options[$name]['type'] == 'F' && is_readable($this->options[$name]['F'])) || ($this->options[$name]['type'] == 'C' && pts_client::executable_in_path(pts_strings::first_in_string($this->options[$name]['C'])));
}
else
{
$isset_cache[$name] = false;
foreach($this->options[$name] as $try)
{
$isset_cache[$name] = ($try['type'] == 'F' && is_readable($try['F'])) || ($try['type'] == 'C' && pts_client::executable_in_path(pts_strings::first_in_string($try['C'])));
if($isset_cache[$name])
{
break;
}
}
}
}
return $isset_cache[$name];

View File

@@ -44,27 +44,62 @@ class phoromatic_server
{
return self::phoromatic_path() . 'accounts/' . $account_id . '/';
}
public static function phoromatic_account_result_path($account_id, $result_id = null)
{
return self::phoromatic_account_path($account_id) . 'results/' . ($result_id != null ? $result_id . '/' : null);
}
public static function prepare_database()
{
self::$db = new SQLite3(self::phoromatic_path() . 'phoromatic.db');
if(self::read_database_version() == 0)
switch(self::read_database_version())
{
// Account Database
self::$db->exec('CREATE TABLE phoromatic_accounts (AccountID TEXT PRIMARY KEY, ValidateID TEXT NOT NULL, CreatedOn TEXT NOT NULL, Salt TEXT NOT NULL)');
self::$db->exec('CREATE TABLE phoromatic_account_settings (AccountID TEXT PRIMARY KEY, ArchiveResultsLocally INTEGER, UploadSystemLogs INTEGER, RunInstallCommand INTEGER, ForceInstallTests INTEGER, SystemSensorMonitoring INTEGER)');
self::$db->exec('CREATE TABLE phoromatic_users (UserID TEXT PRIMARY KEY, AccountID TEXT NOT NULL, UserName TEXT UNIQUE, Email TEXT, Password TEXT NOT NULL, CreatedOn TEXT NOT NULL, LastLogin TEXT, LastIP TEXT)');
self::$db->exec('CREATE TABLE phoromatic_schedules (AccountID TEXT, ScheduleID INTEGER, Title TEXT, Description TEXT, State INTEGER, ActiveOn TEXT, RunAt TEXT, SetContextPreInstall TEXT, SetContextPostInstall TEXT, SetContextPreRun TEXT, SetContextPostRun TEXT, LastModifiedBy TEXT, LastModifiedOn TEXT, PublicKey TEXT, UNIQUE(AccountID, ScheduleID) ON CONFLICT IGNORE)');
//self::$db->exec('CREATE TABLE phoromatic_schedules_systems (AccountID TEXT UNIQUE, ScheduleID INTEGER UNIQUE, SystemID TEXT UNIQUE)');
self::$db->exec('CREATE TABLE phoromatic_schedules_tests (AccountID TEXT, ScheduleID INTEGER, TestProfile TEXT, TestArguments TEXT, TestDescription TEXT, UNIQUE(AccountID, ScheduleID, TestArguments) ON CONFLICT REPLACE)');
self::$db->exec('CREATE TABLE phoromatic_schedules_triggers (AccountID TEXT, ScheduleID INTEGER, Trigger TEXT, TriggerTarget TEXT, TriggeredOn TEXT, UNIQUE(AccountID, ScheduleID, Trigger) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_user_settings (AccountID TEXT UNIQUE, UserID TEXT UNIQUE, NotifyOnResultUploads INTEGER, NotifyOnWarnings INTEGER, NotifyOnNewSystems INTEGER)');
self::$db->exec('CREATE TABLE phoromatic_systems (AccountID TEXT, SystemID TEXT, Title TEXT, Description TEXT, Groups TEXT, Hardware TEXT, Software TEXT, ClientVersion TEXT, GSID TEXT, CurrentTask TEXT, EstimatedTimeForTask TEXT, CreatedOn TEXT, LastCommunication TEXT, LastIP TEXT, State INTEGER, LocalIP TEXT, NetworkMAC TEXT, Flags TEXT, UNIQUE(AccountID, SystemID) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_system_warnings (AccountID TEXT, SystemID TEXT, Warning TEXT, WarningTime TEXT)');
self::$db->exec('CREATE TABLE phoromatic_results (AccountID TEXT UNIQUE, UploadID INTEGER, ScheduleID INTEGER, Trigger TEXT, UploadTime TEXT, Title TEXT, OpenBenchmarkingID TEXT, SystemID TEXT)');
self::$db->exec('CREATE TABLE phoromatic_groups (AccountID TEXT, GroupName TEXT, Description TEXT, UNIQUE(AccountID, GroupName) ON CONFLICT IGNORE)');
case 0:
// Account Database
self::$db->exec('CREATE TABLE phoromatic_accounts (AccountID TEXT PRIMARY KEY, ValidateID TEXT NOT NULL, CreatedOn TEXT NOT NULL, Salt TEXT NOT NULL)');
self::$db->exec('CREATE TABLE phoromatic_account_settings (AccountID TEXT PRIMARY KEY, ArchiveResultsLocally INTEGER, UploadSystemLogs INTEGER, RunInstallCommand INTEGER, ForceInstallTests INTEGER, SystemSensorMonitoring INTEGER)');
self::$db->exec('CREATE TABLE phoromatic_users (UserID TEXT PRIMARY KEY, AccountID TEXT NOT NULL, UserName TEXT UNIQUE, Email TEXT, Password TEXT NOT NULL, CreatedOn TEXT NOT NULL, LastLogin TEXT, LastIP TEXT)');
self::$db->exec('CREATE TABLE phoromatic_schedules (AccountID TEXT, ScheduleID INTEGER, Title TEXT, Description TEXT, State INTEGER, ActiveOn TEXT, RunAt TEXT, SetContextPreInstall TEXT, SetContextPostInstall TEXT, SetContextPreRun TEXT, SetContextPostRun TEXT, LastModifiedBy TEXT, LastModifiedOn TEXT, PublicKey TEXT, UNIQUE(AccountID, ScheduleID) ON CONFLICT IGNORE)');
//self::$db->exec('CREATE TABLE phoromatic_schedules_systems (AccountID TEXT UNIQUE, ScheduleID INTEGER UNIQUE, SystemID TEXT UNIQUE)');
self::$db->exec('CREATE TABLE phoromatic_schedules_tests (AccountID TEXT, ScheduleID INTEGER, TestProfile TEXT, TestArguments TEXT, TestDescription TEXT, UNIQUE(AccountID, ScheduleID, TestProfile, TestArguments) ON CONFLICT REPLACE)');
self::$db->exec('CREATE TABLE phoromatic_schedules_triggers (AccountID TEXT, ScheduleID INTEGER, Trigger TEXT, TriggerTarget TEXT, TriggeredOn TEXT, UNIQUE(AccountID, ScheduleID, Trigger) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_user_settings (AccountID TEXT, UserID TEXT, NotifyOnResultUploads INTEGER, NotifyOnWarnings INTEGER, NotifyOnNewSystems INTEGER, UNIQUE(AccountID, UserID) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_systems (AccountID TEXT, SystemID TEXT, Title TEXT, Description TEXT, Groups TEXT, Hardware TEXT, Software TEXT, ClientVersion TEXT, GSID TEXT, CurrentTask TEXT, EstimatedTimeForTask TEXT, CreatedOn TEXT, LastCommunication TEXT, LastIP TEXT, State INTEGER, LocalIP TEXT, NetworkMAC TEXT, Flags TEXT, UNIQUE(AccountID, SystemID) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_system_warnings (AccountID TEXT, SystemID TEXT, Warning TEXT, WarningTime TEXT)');
self::$db->exec('CREATE TABLE phoromatic_results (AccountID TEXT, UploadID INTEGER, ScheduleID INTEGER, Trigger TEXT, UploadTime TEXT, Title TEXT, OpenBenchmarkingID TEXT, SystemID TEXT, UNIQUE(AccountID, UploadID) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_groups (AccountID TEXT, GroupName TEXT, Description TEXT, UNIQUE(AccountID, GroupName) ON CONFLICT IGNORE)');
self::$db->exec('PRAGMA user_version = 1');
self::$db->exec('PRAGMA user_version = 1');
case 1:
// phoromatic_results changes for schema mostly from OB
// Changes made 20 September / post 5.4-M1
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN Description TEXT');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN SystemCount INTEGER');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN ResultCount INTEGER');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN DisplayStatus INTEGER DEFAULT 1');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN TimesViewed INTEGER DEFAULT 0');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN XmlUploadHash TEXT');
self::$db->exec('ALTER TABLE phoromatic_results ADD COLUMN ComparisonHash TEXT');
// Add phoromatic_results_results as test_results_results equivalent from OB
self::$db->exec('CREATE TABLE phoromatic_results_results (AccountID TEXT, UploadID INTEGER, AbstractID INTEGER, TestProfile TEXT, ComparisonHash TEXT, UNIQUE(AccountID, UploadID, AbstractID) ON CONFLICT IGNORE)');
self::$db->exec('CREATE TABLE phoromatic_results_systems (AccountID TEXT, UploadID INTEGER, SystemIdentifier TEXT, Hardware TEXT, Software TEXT, UNIQUE(AccountID, UploadID, SystemIdentifier) ON CONFLICT IGNORE)');
self::$db->exec('PRAGMA user_version = 2');
case 2:
// Change made 4 October to introduce machine self ID as a new identifier for local systems without Internet not having OpenBenchmarking.org GSID, etc
self::$db->exec('ALTER TABLE phoromatic_systems ADD COLUMN MachineSelfID TEXT');
self::$db->exec('PRAGMA user_version = 3');
case 3:
// Change made 8 October for targeting the SystemID / GroupNames of systems to test in schedules
self::$db->exec('ALTER TABLE phoromatic_schedules ADD COLUMN RunTargetSystems TEXT');
self::$db->exec('ALTER TABLE phoromatic_schedules ADD COLUMN RunTargetGroups TEXT');
self::$db->exec('PRAGMA user_version = 4');
case 4:
// Change made 11 October for administrative level
self::$db->exec('ALTER TABLE phoromatic_users ADD COLUMN AdminLevel INTEGER DEFAULT 1');
self::$db->exec('PRAGMA user_version = 5');
case 5:
self::$db->exec('CREATE TABLE phoromatic_activity_stream (AccountID TEXT, ActivityTime TEXT, ActivityCreator TEXT, ActivityCreatorType TEXT, ActivityEvent TEXT, ActivityEventID TEXT, ActivityEventType TEXT)');
self::$db->exec('PRAGMA user_version = 6');
}
}
public static function send_email($to, $subject, $from, $body)

View File

@@ -124,7 +124,7 @@ class pts_HorizontalBoxPlotGraph extends pts_HorizontalBarGraph
}
}
$maximum = (ceil(round($real_maximum * 1.01) / $this->i['mark_count']) + 1) * $this->i['mark_count'];
$maximum = (ceil(round($real_maximum * 1.03) / $this->i['mark_count']) + 1) * $this->i['mark_count'];
$maximum = round(ceil($maximum / $this->i['mark_count']), (0 - strlen($maximum) + 2)) * $this->i['mark_count'];
return $maximum;
}

View File

@@ -164,7 +164,7 @@ class pts_LineGraph extends pts_Graph
$x_end = $x_start + $this->i['key_item_width'] * ($num_cols - 1);
// draw the "Min Avg Max" text
$stat_header_offset = $this->i['key_longest_string_width'] + $square_length + 6;
$stat_header_offset = $this->i['key_longest_string_width'] + $square_length + 10;
for($x = $x_start + $stat_header_offset; $x <= $x_end + $stat_header_offset; $x += $this->i['key_item_width'])
{
$this->draw_stat_text($x, array('y' => $y_start - 14, 'font-size' => 6.5, 'fill' => self::$c['color']['notches']));
@@ -194,7 +194,7 @@ class pts_LineGraph extends pts_Graph
'font-size' => self::$c['size']['key'], 'fill' => $this_color));
// draw min/avg/max
$x_stat_loc = $x + $square_length + $this->i['key_longest_string_width'] + 6;
$x_stat_loc = $x + $square_length + $this->i['key_longest_string_width'] + 10;
$this->draw_result_stats($this->graph_data[$i], $precision, $x_stat_loc,
array('y' => $y, 'font-size' => self::$c['size']['key'], 'fill' => $this_color));
}
@@ -403,11 +403,11 @@ class pts_LineGraph extends pts_Graph
$this->i['key_line_height'] = 16;
$this->i['key_longest_string_width'] = $this->text_string_width(pts_strings::find_longest_string($this->graph_data_title), self::$c['size']['key']);
$item_width_spacing = 30;
$item_width_spacing = 32;
$this->i['key_item_width'] = $this->i['key_longest_string_width'] + $this->get_stat_word_width() * 3 + $item_width_spacing;
// if there are <=4 data sets, then use a single column, otherwise, try and multi-col it
if (count($this->graph_data_title) <= 4)
if (count($this->graph_data_title) <= 3)
{
$this->i['keys_per_line'] = 1;
}

View File

@@ -163,7 +163,7 @@ class pts_OverviewGraph extends pts_Graph
switch($result_object->test_profile->get_result_proportion())
{
case 'HIB':
$value = $buffer_item->get_result_value() / $divide_value;
$value = $divide_value != 0 ? $buffer_item->get_result_value() / $divide_value : 0;
break;
case 'LIB':
$value = $divide_value / $buffer_item->get_result_value();

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2013, Phoronix Media
Copyright (C) 2008 - 2013, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,24 +23,29 @@
class pts_network
{
private static $disable_network_support = false;
private static $disable_internet_support = false;
private static $network_proxy = false;
public static function is_proxy_setup()
{
return self::$network_proxy == false;
}
public static function internet_support_available()
{
return self::network_support_available() && self::$disable_internet_support == false;
}
public static function network_support_available()
{
return self::$disable_network_support == false;
}
public static function http_get_contents($url, $override_proxy = false, $override_proxy_port = false)
public static function http_get_contents($url, $override_proxy = false, $override_proxy_port = false, $http_timeout = -1)
{
if(!pts_network::network_support_available())
{
return false;
}
$stream_context = pts_network::stream_context_create(null, $override_proxy, $override_proxy_port);
$stream_context = pts_network::stream_context_create(null, $override_proxy, $override_proxy_port, $http_timeout);
$contents = pts_file_io::file_get_contents($url, 0, $stream_context);
return $contents;
@@ -85,14 +90,14 @@ class pts_network
pts_client::$display->test_install_progress_completed();
}
}
public static function curl_download($download, $download_to)
public static function curl_download($download, $download_to, $download_port_number = false)
{
if(!function_exists('curl_init'))
{
return false;
}
// with curl_multi_init we could do multiple downloads at once...
// XXX: with curl_multi_init we could do multiple downloads at once...
$cr = curl_init();
$fh = fopen($download_to, 'w');
@@ -105,6 +110,11 @@ class pts_network
curl_setopt($cr, CURLOPT_BUFFERSIZE, 64000);
curl_setopt($cr, CURLOPT_USERAGENT, pts_codename(true));
if($download_port_number)
{
curl_setopt($ch, CURLOPT_PORT, $port);
}
if(stripos($download, 'sourceforge') === false)
{
// Setting the referer causes problems for SourceForge downloads
@@ -172,7 +182,7 @@ class pts_network
return false;
}
public static function stream_context_create($parameters = null, $proxy_address = false, $proxy_port = false)
public static function stream_context_create($parameters = null, $proxy_address = false, $proxy_port = false, $http_timeout = -1)
{
if(!is_array($parameters))
{
@@ -191,7 +201,15 @@ class pts_network
$parameters['http']['request_fulluri'] = true;
}
$parameters['http']['timeout'] = defined('NETWORK_TIMEOUT') ? NETWORK_TIMEOUT : 20;
if(is_numeric($http_timeout) && $http_timeout > 1)
{
$parameters['http']['timeout'] = $http_timeout;
}
else
{
$parameters['http']['timeout'] = defined('NETWORK_TIMEOUT') ? NETWORK_TIMEOUT : 20;
}
$parameters['http']['user_agent'] = pts_codename(true);
$parameters['http']['header'] = "Content-Type: application/x-www-form-urlencoded\r\n";
@@ -262,6 +280,11 @@ class pts_network
echo PHP_EOL . 'The allow_url_fopen option in your PHP configuration must be enabled for network support.' . PHP_EOL . PHP_EOL;
self::$disable_network_support = true;
}
else if(pts_config::read_bool_config('PhoronixTestSuite/Options/Networking/NoInternetCommunication', 'FALSE'))
{
echo PHP_EOL . 'Internet Communication Is Disabled For Your User Configuration.' . PHP_EOL . PHP_EOL;
self::$disable_internet_support = true;
}
else if(pts_config::read_bool_config('PhoronixTestSuite/Options/Networking/NoNetworkCommunication', 'FALSE'))
{
echo PHP_EOL . 'Network Communication Is Disabled For Your User Configuration.' . PHP_EOL . PHP_EOL;
@@ -286,8 +309,8 @@ class pts_network
if(gethostbyname('google.com') == 'google.com')
{
echo PHP_EOL;
trigger_error('No Network Connectivity', E_USER_WARNING);
self::$disable_network_support = true;
trigger_error('No Internet Connectivity', E_USER_WARNING);
self::$disable_internet_support = true;
}
}
}
@@ -317,10 +340,90 @@ class pts_network
}
$offset = $ipv4_pos + 1;
}
if($local_ip == null)
{
while(($ipv4_pos = strpos($ifconfig, 'inet ', $offset)) !== false)
{
$ipv4 = substr($ifconfig, $ipv4_pos + strlen('inet '));
$ipv4 = substr($ipv4, 0, strpos($ipv4, ' '));
$local_ip = $ipv4;
if($local_ip != '127.0.0.1' && $local_ip != null)
{
break;
}
$offset = $ipv4_pos + 1;
}
}
}
return $local_ip;
}
public static function get_network_mac()
{
$mac = false;
if(($ifconfig = pts_client::executable_in_path('ifconfig')))
{
$ifconfig = shell_exec($ifconfig . ' 2>&1');
$offset = 0;
while(($hwaddr_pos = strpos($ifconfig, 'HWaddr ', $offset)) !== false || ($hwaddr_pos = strpos($ifconfig, 'ether ', $offset)) !== false)
{
$hw_addr = substr($ifconfig, $hwaddr_pos);
$hw_addr = substr($hw_addr, (strpos($hw_addr, ' ') + 1));
$hw_addr = substr($hw_addr, 0, strpos($hw_addr, ' '));
$mac = $hw_addr;
if($mac != null)
{
break;
}
$offset = $hwaddr_pos + 1;
}
}
return $mac;
}
public static function find_zeroconf_phoromatic_servers($find_multiple = false)
{
if(!pts_network::network_support_available())
{
return null;
}
$hosts = $find_multiple ? array() : null;
if(PTS_IS_CLIENT && pts_client::executable_in_path('avahi-browse'))
{
$avahi_browse = explode(PHP_EOL, shell_exec('avahi-browse -p -r -t _http._tcp 2>&1'));
foreach(array_reverse($avahi_browse) as $avahi_line)
{
if(strrpos($avahi_line, 'phoromatic-server') !== false)
{
$avahi_line = explode(';', $avahi_line);
if(isset($avahi_line[8]) && ip2long($avahi_line[7]) !== false && is_numeric($avahi_line[8]))
{
$server_ip = $avahi_line[7];
$server_port = $avahi_line[8];
//echo $server_ip . ':' . $server_port;
if($find_multiple)
{
array_push($hosts, array($server_ip, $server_port));
}
else
{
$hosts = array($server_ip, $server_port);
break;
}
}
}
}
}
return $hosts;
}
}
?>

View File

@@ -111,7 +111,7 @@ class pts_openbenchmarking
{
$is_id = false;
if(self::is_string_openbenchmarking_result_id_compliant($id))
if(self::is_string_openbenchmarking_result_id_compliant($id) && pts_network::internet_support_available())
{
$json_response = pts_openbenchmarking::make_openbenchmarking_request('is_openbenchmarking_result', array('i' => $id));
$json_response = json_decode($json_response, true);
@@ -126,6 +126,11 @@ class pts_openbenchmarking
}
public static function clone_openbenchmarking_result(&$id, $return_xml = false)
{
if(!pts_network::internet_support_available())
{
return false;
}
$json_response = pts_openbenchmarking::make_openbenchmarking_request('clone_openbenchmarking_result', array('i' => $id));
$json_response = json_decode($json_response, true);
$valid = false;
@@ -166,6 +171,11 @@ class pts_openbenchmarking
}
public static function clone_openbenchmarking_result_system_logs(&$id, $extract_to, $sha1_compare = null)
{
if(!pts_network::internet_support_available())
{
return false;
}
$system_log_response = pts_openbenchmarking::make_openbenchmarking_request('clone_openbenchmarking_system_logs', array('i' => $id));
$extracted = false;
@@ -277,6 +287,7 @@ class pts_openbenchmarking
}
$index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo_name . '.index';
$server_index = null;
if(is_file($index_file))
{
@@ -304,17 +315,39 @@ class pts_openbenchmarking
// The index is new enough
continue;
}
if(pts_network::internet_support_available())
{
$server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_index', array('repo' => $repo_name));
self::$openbenchmarking_index_refreshed = true;
}
if(!$server_index && $phoromatic_cache_index = self::phoromatic_server_ob_cache_request('index', $repo_name))
{
// Ensure the Phoromatic cache has a newer version of the index than what's currently on the system
$repo_index = json_decode($phoromatic_cache_index, true);
if(isset($repo_index['main']['generated']))
{
$cache_generated_time = $repo_index['main']['generated'];
$server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_index', array('repo' => $repo_name));
self::$openbenchmarking_index_refreshed = true;
if($cache_generated_time > $generated_time)
{
$server_index = $phoromatic_cache_index;
}
self::$openbenchmarking_index_refreshed = true;
}
}
}
else
else if(pts_network::internet_support_available())
{
$server_index = pts_openbenchmarking::make_openbenchmarking_request('repo_index', array('repo' => $repo_name));
self::$openbenchmarking_index_refreshed = true;
}
if(json_decode($server_index) != false)
if(!$server_index && $phoromatic_cache_index = self::phoromatic_server_ob_cache_request('index', $repo_name))
{
$server_index = $phoromatic_cache_index;
}
if($server_index != null && json_decode($server_index) != false)
{
file_put_contents($index_file, $server_index);
}
@@ -367,14 +400,26 @@ class pts_openbenchmarking
return pts_network::http_upload_via_post($url, $to_post);
}
public static function read_repository_index($repo_name)
public static function is_repository($repo_name)
{
return is_file(PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo_name . '.index');
}
public static function read_repository_index($repo_name, $do_decode = true)
{
$index_file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo_name . '.index';
if(is_file($index_file))
{
$index_file = file_get_contents($index_file);
$index_file = json_decode($index_file, true);
if($do_decode)
{
$index_file = json_decode($index_file, true);
}
}
else
{
$index_file = null;
}
return $index_file;
@@ -404,20 +449,33 @@ class pts_openbenchmarking
if(!is_file($file))
{
// TODO cache this somewhere
$hash_json = pts_openbenchmarking::make_openbenchmarking_request('test_hash', array('i' => $qualified_identifier));
$hash_json = json_decode($hash_json, true);
$hash_check = isset($hash_json['openbenchmarking']['test']['hash']) ? $hash_json['openbenchmarking']['test']['hash'] : null; // should also check for ['openbenchmarking']['test']['error'] problems
$test_profile = pts_openbenchmarking::make_openbenchmarking_request('download_test', array('i' => $qualified_identifier));
if($test_profile != null && ($hash_check == null || $hash_check == sha1($test_profile)))
if(pts_network::internet_support_available())
{
// save it
file_put_contents($file, $test_profile);
$hash_check = null;
$hash_json = pts_openbenchmarking::make_openbenchmarking_request('test_hash', array('i' => $qualified_identifier));
$hash_json = json_decode($hash_json, true);
$hash_check = isset($hash_json['openbenchmarking']['test']['hash']) ? $hash_json['openbenchmarking']['test']['hash'] : null; // should also check for ['openbenchmarking']['test']['error'] problems
$test_profile = pts_openbenchmarking::make_openbenchmarking_request('download_test', array('i' => $qualified_identifier));
if($test_profile != null && ($hash_check == null || $hash_check == sha1($test_profile)))
{
// save it
file_put_contents($file, $test_profile);
$hash_check = null;
}
}
else if(PTS_IS_CLIENT && $test_profile === false)
if(!is_file($file) && $test_profile = self::phoromatic_server_ob_cache_request('test', substr($qualified_identifier, 0, strpos($qualified_identifier, '/')), substr($qualified_identifier, strpos($qualified_identifier, '/') + 1)))
{
if($b64 = base64_decode($test_profile))
{
$test_profile = $b64;
}
file_put_contents($file, $test_profile);
}
if(PTS_IS_CLIENT && !is_file($file))
{
trigger_error('Network support is needed to obtain ' . $qualified_identifier . ' data.' . PHP_EOL, E_USER_ERROR);
return false;
@@ -429,11 +487,42 @@ class pts_openbenchmarking
// extract it
pts_file_io::mkdir(PTS_TEST_PROFILE_PATH . dirname($qualified_identifier));
pts_file_io::mkdir(PTS_TEST_PROFILE_PATH . $qualified_identifier);
return pts_compression::zip_archive_extract($file, PTS_TEST_PROFILE_PATH . $qualified_identifier);
pts_compression::zip_archive_extract($file, PTS_TEST_PROFILE_PATH . $qualified_identifier);
if(is_file(PTS_TEST_PROFILE_PATH . $qualified_identifier . '/test-definition.xml'))
{
return true;
}
else
{
unlink($file);
return false;
}
}
return false;
}
public static function phoromatic_server_ob_cache_request($type_request, $repo = null, $test = null)
{
if(PTS_IS_CLIENT == false)
{
return null;
}
$archived_servers = pts_client::available_phoromatic_servers();
foreach($archived_servers as $archived_server)
{
$cache = pts_network::http_get_contents('http://' . $archived_server['ip'] . ':' . $archived_server['http_port'] . '/openbenchmarking-cache.php?' . $type_request . '&repo=' . $repo . '&test=' . $test);
if(!empty($cache))
{
return $cache;
}
}
return null;
}
public static function available_tests($download_tests = true)
{
$available_tests = array();
@@ -446,7 +535,7 @@ class pts_openbenchmarking
{
foreach(array_keys($repo_index['tests']) as $identifier)
{
if($download_tests && pts_network::network_support_available())
if($download_tests)
{
$version = array_shift($repo_index['tests'][$identifier]['versions']);
if(self::download_test_profile($repo . '/' . $identifier . '-' . $version) == false)
@@ -475,7 +564,7 @@ class pts_openbenchmarking
{
foreach(array_keys($repo_index['suites']) as $identifier)
{
if($download_suites && pts_network::network_support_available())
if($download_suites && pts_network::internet_support_available())
{
$version = array_shift($repo_index['suites'][$identifier]['versions']);
if(self::download_test_suite($repo . '/' . $identifier . '-' . $version) == false)
@@ -499,37 +588,64 @@ class pts_openbenchmarking
$file = PTS_OPENBENCHMARKING_SCRATCH_PATH . $qualified_identifier . '.zip';
$hash_json = pts_openbenchmarking::make_openbenchmarking_request('suite_hash', array('i' => $qualified_identifier));
$hash_json = json_decode($hash_json, true);
$hash_check = isset($hash_json['openbenchmarking']['suite']['hash']) ? $hash_json['openbenchmarking']['suite']['hash'] : null; // should also check for ['openbenchmarking']['suite']['error'] problems
if(pts_network::internet_support_available())
{
$hash_json = pts_openbenchmarking::make_openbenchmarking_request('suite_hash', array('i' => $qualified_identifier));
$hash_json = json_decode($hash_json, true);
$hash_check = isset($hash_json['openbenchmarking']['suite']['hash']) ? $hash_json['openbenchmarking']['suite']['hash'] : null; // should also check for ['openbenchmarking']['suite']['error'] problems
}
if(!is_file($file))
{
$test_suite = pts_openbenchmarking::make_openbenchmarking_request('download_suite', array('i' => $qualified_identifier));
if(pts_network::internet_support_available())
{
$test_suite = pts_openbenchmarking::make_openbenchmarking_request('download_suite', array('i' => $qualified_identifier));
if($test_suite != null && ($hash_check == null || $hash_check == sha1($test_suite)))
if($test_suite != null && ($hash_check == null || $hash_check == sha1($test_suite)))
{
// save it
file_put_contents($file, $test_suite);
$hash_check = null;
}
else if(is_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') && ($hash_check == null || sha1_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') == $hash_check))
{
copy('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip', $file);
}
}
if(!is_file($file) && $test_suite = self::phoromatic_server_ob_cache_request('suite', substr($qualified_identifier, 0, strpos($qualified_identifier, '/')), substr($qualified_identifier, strpos($qualified_identifier, '/') + 1)))
{
// save it
if($b64 = base64_decode($test_suite))
{
$test_suite = $b64;
}
file_put_contents($file, $test_suite);
$hash_check = null;
}
else if(is_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') && ($hash_check == null || sha1_file('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip') == $hash_check))
{
copy('/var/cache/phoronix-test-suite/openbenchmarking.org/' . $qualified_identifier . '.zip', $file);
}
else if(PTS_IS_CLIENT && $test_suite === false)
if(PTS_IS_CLIENT && !is_file($file))
{
trigger_error('Network support is needed to obtain ' . $qualified_identifier . ' data.' . PHP_EOL, E_USER_ERROR);
return false;
}
}
if(!is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml') && ($hash_check == null || (is_file($file) && sha1_file($file) == $hash_check)))
if(!is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml') && is_file($file) && ($hash_check == null || (is_file($file) && sha1_file($file) == $hash_check)))
{
// extract it
pts_file_io::mkdir(PTS_TEST_SUITE_PATH . dirname($qualified_identifier));
pts_file_io::mkdir(PTS_TEST_SUITE_PATH . $qualified_identifier);
return pts_compression::zip_archive_extract($file, PTS_TEST_SUITE_PATH . $qualified_identifier);
pts_compression::zip_archive_extract($file, PTS_TEST_SUITE_PATH . $qualified_identifier);
if(is_file(PTS_TEST_SUITE_PATH . $qualified_identifier . '/suite-definition.xml'))
{
return true;
}
else
{
unlink($file);
return false;
}
}
return false;

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009, Phoronix Media
Copyright (C) 2009, Michael Larabel
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -84,10 +84,12 @@ class pts_pdf_template extends FPDF
case 'h2':
$this->CreateBookmark($value, 2);
$this->SetLeftMargin(10);
$this->SetFont('Arial', 'B', 13);
$this->SetFont('Arial', 'B', 14);
$this->SetTextColor(50, 51, 49);
$this->Ln();
$this->SetTopMargin(30);
$this->html_text_interpret('h2', $dom_item);
$this->Ln();
break;
case 'h3':
$this->SetLeftMargin(10);
@@ -95,6 +97,8 @@ class pts_pdf_template extends FPDF
$this->SetTextColor(97, 99, 96);
$this->Ln();
$this->html_text_interpret('h3', $dom_item);
$this->SetLeftMargin(10);
$this->Ln();
break;
case 'ol':
case 'ul':
@@ -152,6 +156,9 @@ class pts_pdf_template extends FPDF
case 'em':
$this->SetFont(null, 'I', (substr($apply_as_tag, 0, 1) == 'h' ? '12' : null));
break;
case 'u':
$this->SetFont(null, 'U', (substr($apply_as_tag, 0, 1) == 'h' ? '12' : null));
break;
case 'strong':
$this->SetFont(null, 'B');
break;
@@ -165,7 +172,7 @@ class pts_pdf_template extends FPDF
$this->SetTextColor(0, 0, 0);
break;
default:
echo "UNSUPPORTED: $name\n";
//echo "UNSUPPORTED: $name: $value\n";
break;
}

View File

@@ -38,6 +38,17 @@ class pts_result_file
{
return $this->get_identifier();
}
public function sanitize_user_strings($value)
{
if(is_array($value))
{
return array_map(array($this, 'sanitize_user_strings'), $value);
}
else
{
return strip_tags($value);
}
}
public static function is_test_result_file($identifier)
{
return is_file(PTS_SAVE_RESULTS_PATH . $identifier . '/composite.xml');
@@ -56,35 +67,35 @@ class pts_result_file
}
public function get_system_hardware()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Hardware');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Hardware'));
}
public function get_system_software()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Software');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Software'));
}
public function get_system_json()
{
return array_map(array('pts_arrays', 'json_decode'), $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/JSON'));
return $this->sanitize_user_strings(array_map(array('pts_arrays', 'json_decode'), $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/JSON')));
}
public function get_system_user()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/User');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/User'));
}
public function get_system_notes()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Notes');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Notes'));
}
public function get_system_date()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/TimeStamp');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/TimeStamp'));
}
public function get_system_pts_version()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/TestClientVersion');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/TestClientVersion'));
}
public function get_system_identifiers()
{
return $this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Identifier');
return $this->sanitize_user_strings($this->xml_parser->getXMLArrayValues('PhoronixTestSuite/System/Identifier'));
}
public function get_system_count()
{
@@ -92,23 +103,23 @@ class pts_result_file
}
public function get_title()
{
return $this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Title');
return $this->sanitize_user_strings($this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Title'));
}
public function get_description()
{
return $this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Description');
return $this->sanitize_user_strings($this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Description'));
}
public function get_notes()
{
return $this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Notes');
return $this->sanitize_user_strings($this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/Notes'));
}
public function get_internal_tags()
{
return $this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/InternalTags');
return $this->sanitize_user_strings($this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/InternalTags'));
}
public function get_reference_id()
{
return $this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/ReferenceID');
return $this->sanitize_user_strings($this->xml_parser->getXMLValue('PhoronixTestSuite/Generated/ReferenceID'));
}
public function get_preset_environment_variables()
{
@@ -130,11 +141,11 @@ class pts_result_file
{
return count($this->get_unique_test_titles());
}
public function get_contained_tests_hash()
public function get_contained_tests_hash($raw_output = true)
{
$result_object_hashes = $this->get_result_object_hashes();
sort($result_object_hashes);
return sha1(implode(',', $result_object_hashes), true);
return sha1(implode(',', $result_object_hashes), $raw_output);
}
public function get_result_object_hashes()
{

View File

@@ -304,7 +304,7 @@ class pts_test_profile extends pts_test_profile_parser
return $supported;
}
public static function generate_comparison_hash($test_identifier, $arguments, $attributes = null, $version = null)
public static function generate_comparison_hash($test_identifier, $arguments, $attributes = null, $version = null, $raw_output = true)
{
$hash_table = array(
$test_identifier,
@@ -313,7 +313,7 @@ class pts_test_profile extends pts_test_profile_parser
$version
);
return sha1(implode(',', $hash_table), true);
return sha1(implode(',', $hash_table), $raw_output);
}
public function get_test_executable_dir()
{

View File

@@ -100,7 +100,7 @@ class pts_test_result
{
return $this->result_max;
}
public function get_comparison_hash($show_version_and_attributes = true)
public function get_comparison_hash($show_version_and_attributes = true, $raw_output = true)
{
if($show_version_and_attributes)
{
@@ -109,11 +109,11 @@ class pts_test_result
// this removal is done since the zz segment should be maintainable between comparisons
$tp = substr($tp, 0, strrpos($tp, '.'));
return pts_test_profile::generate_comparison_hash($tp, $this->get_arguments(), $this->get_arguments_description(), $this->test_profile->get_app_version());
return pts_test_profile::generate_comparison_hash($tp, $this->get_arguments(), $this->get_arguments_description(), $this->test_profile->get_app_version(), $raw_output);
}
else
{
return pts_test_profile::generate_comparison_hash($this->test_profile->get_identifier(false), $this->get_arguments());
return pts_test_profile::generate_comparison_hash($this->test_profile->get_identifier(false), $this->get_arguments(), null, null, $raw_output);
}
}
public function __toString()
@@ -190,11 +190,14 @@ class pts_test_result
}
}
foreach($keys as $k)
if($divide_value != 0)
{
$normalized = pts_math::set_precision(($this->test_result_buffer->buffer_items[$k]->get_result_value() / $divide_value), $this->result_precision);
$this->test_result_buffer->buffer_items[$k]->reset_result_value($normalized);
$this->test_result_buffer->buffer_items[$k]->reset_raw_value(0);
foreach($keys as $k)
{
$normalized = pts_math::set_precision(($this->test_result_buffer->buffer_items[$k]->get_result_value() / $divide_value), $this->result_precision);
$this->test_result_buffer->buffer_items[$k]->reset_result_value($normalized);
$this->test_result_buffer->buffer_items[$k]->reset_raw_value(0);
}
}
}

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2013, Phoronix Media
Copyright (C) 2010 - 2013, Michael Larabel
Copyright (C) 2010 - 2014, Phoronix Media
Copyright (C) 2010 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -495,6 +495,7 @@ class pts_test_result_parser
$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');
@@ -558,11 +559,11 @@ class pts_test_result_parser
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 $i => $r_check)
foreach($result_template_r as $x => $r_check)
{
if(isset($result_key[$i]) && strpos($r_check, $result_key[$i]) !== false)
if(isset($result_key[$x]) && strpos($r_check, $result_key[$x]) !== false)
{
$result_template_r_pos = $i;
$result_template_r_pos = $x;
break;
}
}
@@ -674,6 +675,26 @@ class pts_test_result_parser
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]);

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2010 - 2013, Phoronix Media
Copyright (C) 2010 - 2013, Michael Larabel
Copyright (C) 2010 - 2014, Phoronix Media
Copyright (C) 2010 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,6 +46,7 @@ class pts_test_result_parser_writer
$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');
@@ -64,6 +65,7 @@ class pts_test_result_parser_writer
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/LineBeforeHint', $result_line_before_hint[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/LineAfterHint', $result_line_after_hint[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultBeforeString', $result_before_string[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/ResultAfterString', $result_after_string[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/StripFromResult', $strip_from_result[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/StripResultPostfix', $strip_result_postfix[$i]);
$this->xml_writer->addXmlNodeWNE('PhoronixTestSuite/ResultsParser/MultiMatch', $multi_match[$i]);

View File

@@ -95,15 +95,19 @@ class pts_webui
{
$pts_ws_port = getenv('PTS_WEBSOCKET_PORT');
// For some reason websockets don't seem to like ::1 which is ipv6 localhost.
// So we will work around it by just pointing to localhost instead.
if($_SERVER['REMOTE_ADDR'] === '::1')
// http://www.phoronix.com/forums/showthread.php?102512-Remote-gui-not-accessible-in-Phoronix-Test-Suite-5-2&p=430312#post430312
if(!isset($_SERVER['SERVER_ADDR']))
{
$_SERVER['SERVER_ADDR'] = gethostbyname(gethostname());
}
if($_SERVER['SERVER_ADDR'] === '::1')
{
$server_address = 'localhost';
}
else
{
$server_address = $_SERVER['REMOTE_ADDR'];
$server_address = $_SERVER['SERVER_ADDR'];
}
define('PTS_WEBSOCKET_SERVER', 'ws://' . $server_address . ':' . $pts_ws_port . '/');

View File

@@ -14,7 +14,7 @@
<xs:element name="Generated">
<xs:complexType>
<xs:sequence>
<xs:element name="Title" type="TitleString" />
<xs:element name="Title" type="ResultTitleString" />
<xs:element name="LastModified" type="TimeStamp" />
<xs:element name="TestClient" type="xs:string" />
<xs:element name="Description" type="DescriptionString" />

View File

@@ -21,6 +21,7 @@
<xs:element name="LineBeforeHint" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="LineAfterHint" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="ResultBeforeString" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="ResultAfterString" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="StripFromResult" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="StripResultPostfix" type="xs:string" minOccurs="0" maxOccurs="1" />
<xs:element name="MultiMatch" type="xs:string" minOccurs="0" maxOccurs="1" />

View File

@@ -7,10 +7,16 @@
Copyright (C) 2008 - 2014, Michael Larabel
</xs:documentation>
</xs:annotation>
<xs:simpleType name="ResultTitleString">
<xs:restriction base="xs:string">
<xs:minLength value="2" />
<xs:maxLength value="126" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TitleString">
<xs:restriction base="xs:string">
<xs:minLength value="2" />
<xs:maxLength value="64" />
<xs:maxLength value="50" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="SystemIdentifier">

View File

@@ -0,0 +1,23 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
?>

View File

@@ -19,34 +19,141 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//error_reporting(E_ALL | E_NOTICE | E_STRICT);
if($SCHEDULE_ID == null || $TRIGGER_STRING == null || $OTHER == null || $OPENBENCHMARKING_ID == null)
if(!function_exists('sqlite_escape_string'))
{
$json['phoromatic']['error'] = 'Missing Information For Result Upload.';
echo json_encode($json);
exit;
function sqlite_escape_string($str)
{
// TODO XXX SQLite3::escapeString
return $str;
}
}
$json = array();
if($COMPOSITE_XML != null)
{
$composite_xml = base64_decode($_POST['composite_xml']);
}
else if($COMPOSITE_XML_GZ != null && function_exists('gzinflate'))
{
$composite_xml = gzinflate(base64_decode($_POST['composite_xml_gz']));
}
else
{
$composite_xml = null;
}
if($composite_xml == null || sha1($composite_xml) != $COMPOSITE_XML_HASH)
{
$json['phoromatic']['error'] = 'XML Hash Mismatch';
echo json_encode($json);
return false;
}
// VALIDATE
$result_file = new pts_result_file($composite_xml);
// Validate the XML
if($result_file->xml_parser->validate() == false)
{
$json['phoromatic']['error'] = 'XML Did Not Match Schema Definition';
echo json_encode($json);
return false;
}
/*$Featured_Results = -1;
$Featured = pts_result_file_analyzer::analyze_result_file_intent($result_file, $Featured_Results);
if(!is_array($Featured))
{
$Featured = array(null, null);
}*/
// DETERMINE UNIQUE UPLOAD ID
// IP = INET_ATON($_SERVER["REMOTE_ADDR"]);
$stmt = phoromatic_server::$db->prepare('SELECT UploadID FROM phoromatic_results WHERE AccountID = :account_id ORDER BY UploadID DESC LIMIT 1');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$result = $stmt->execute();
$row = $result->fetchArray();
$upload_id = (isset($row['UploadID']) ? $row['UploadID'] : 0) + 1;
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results (AccountID, SystemID, UploadID, ScheduleID, Trigger, UploadTime, Title, OpenBenchmarkingID) VALUES (:account_id, :system_id, :upload_id, :schedule_id, :trigger, :upload_time, :title, :openbenchmarking_id)');
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results (AccountID, SystemID, UploadID, ScheduleID, Trigger, UploadTime, Title, Description, SystemCount, ResultCount, DisplayStatus, XmlUploadHash, ComparisonHash) VALUES (:account_id, :system_id, :upload_id, :schedule_id, :trigger, :upload_time, :title, :description, :system_count, :result_count, :display_status, :xml_upload_hash, :comparison_hash)');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':system_id', SYSTEM_ID);
$stmt->bindValue(':upload_id', $upload_id);
$stmt->bindValue(':schedule_id', $SCHEDULE_ID);
$stmt->bindValue(':trigger', $TRIGGER_STRING);
$stmt->bindValue(':upload_time', phoromatic_server::current_time());
$stmt->bindValue(':title', $OTHER);
$stmt->bindValue(':openbenchmarking_id', $OPENBENCHMARKING_ID);
$stmt->bindValue(':title', sqlite_escape_string($result_file->get_title()));
$stmt->bindValue(':description', sqlite_escape_string($result_file->get_description()));
$stmt->bindValue(':system_count', $result_file->get_system_count());
$stmt->bindValue(':result_count', $result_file->get_test_count());
$stmt->bindValue(':display_status', 1);
$stmt->bindValue(':xml_upload_hash', sha1($composite_xml));
$stmt->bindValue(':comparison_hash', $result_file->get_contained_tests_hash(false));
$result = $stmt->execute();
//echo phoromatic_server::$db->lastErrorMsg();
$result_directory = phoromatic_server::phoromatic_account_result_path(ACCOUNT_ID, $upload_id);
pts_file_io::mkdir($result_directory);
//phoromatic_add_activity_stream_event('result', $upload_id, 'uploaded');
$json['phoromatic']['response'] = 'Result Upload: ' . $upload_id;
file_put_contents($result_directory . 'composite.xml', $composite_xml);
if($SYSTEM_LOGS_ZIP != null && $SYSTEM_LOGS_HASH != null)
{
if(sha1($SYSTEM_LOGS_ZIP) == $SYSTEM_LOGS_HASH)
{
$system_logs_zip = $result_directory . 'system-logs.zip';
file_put_contents($system_logs_zip, base64_decode($_POST['system_logs_zip']));
/*if(filesize($system_logs_zip) > 2097152)
{
unlink($system_logs_zip);
}*/
}
unset($SYSTEM_LOGS_ZIP);
}
$relative_id = 0;
foreach($result_file->get_result_objects() as $result_object)
{
$relative_id++;
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results_results (AccountID, UploadID, AbstractID, TestProfile, ComparisonHash) VALUES (:account_id, :upload_id, :abstract_id, :test_profile, :comparison_hash)');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':upload_id', $upload_id);
$stmt->bindValue(':abstract_id', $relative_id);
$stmt->bindValue(':test_profile', $result_object->test_profile->get_identifier());
$stmt->bindValue(':comparison_hash', $result_object->get_comparison_hash(true, false));
$result = $stmt->execute();
}
if($relative_id > 0)
{
$ids = $result_file->get_system_identifiers();
$hw = $result_file->get_system_hardware();
$sw = $result_file->get_system_software();
for($i = 0; $i < count($ids) && $i < count($hw) && $i < count($sw); $i++)
{
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_results_systems (AccountID, UploadID, SystemIdentifier, Hardware, Software) VALUES (:account_id, :upload_id, :system_identifier, :hardware, :software)');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':upload_id', $upload_id);
$stmt->bindValue(':system_identifier', sqlite_escape_string($ids[$i]));
$stmt->bindValue(':hardware', sqlite_escape_string($hw[$i]));
$stmt->bindValue(':software', sqlite_escape_string($sw[$i]));
$result = $stmt->execute();
}
$json['phoromatic']['response'] = 'Result Upload: ' . $upload_id;
echo json_encode($json);
return true;
}
$json['phoromatic']['error'] = 'End Termination Error';
echo json_encode($json);
exit;
return false;
?>

View File

@@ -28,6 +28,31 @@ $stmt->bindValue(':account_id', ACCOUNT_ID);
$result = $stmt->execute();
while($result && $row = $result->fetchArray())
{
// Make sure this test schedule is supposed to work on given system
if(!in_array(SYSTEM_ID, explode(',', $row['RunTargetSystems'])))
{
// The system ID isn't in the run target but see if system ID belongs to a group in the run target
$stmt = phoromatic_server::$db->prepare('SELECT Groups FROM phoromatic_systems WHERE AccountID = :account_id AND SystemID = :system_id LIMIT 1');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':system_id', SYSTEM_ID);
$sys_result = $stmt->execute();
$sys_row = $sys_result->fetchArray();
$matches_to_group = false;
foreach(explode(',', $row['RunTargetGroups']) as $group)
{
if(stripos($sys_row['Groups'], '#' . $group . '#') !== false)
{
$matches_to_group = true;
break;
}
}
if($matches_to_group == false)
continue;
}
// See if test is a time-based schedule due to run today and now or past the time scheduled to run
if(strpos($row['ActiveOn'], strval($day_of_week_int)) !== false && $row['RunAt'] <= date('H.i'))
{

View File

@@ -0,0 +1,131 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_account_activity implements pts_webui_interface
{
public static function page_title()
{
return 'Account Activity';
}
public static function page_header()
{
return null;
}
public static function preload($PAGE)
{
return true;
}
public static function render_page_process($PATH)
{
$main = '<li><h1>Recent Account Activity</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_activity_stream WHERE AccountID = :account_id ORDER BY ActivityTime DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$prev_date = null;
do
{
if($prev_date != substr($row['ActivityTime'], 0, 10))
{
if($prev_date != null)
$main .= '<hr />';
$prev_date = substr($row['ActivityTime'], 0, 10);
$new_date = strtotime($row['ActivityTime']);
if(date('Y-m-d') == $prev_date)
{
$main .= '<h2>Today</h2>';
}
else if($new_date > (time() - (60 * 60 * 24 * 6)))
{
$main .= '<h2>' . date('l', $new_date) . '</h2>';
}
else
{
$main .= '<h2>' . date('j F Y', $new_date) . '</h2>';
}
}
$id_link_format = $row['ActivityEventID'];
switch($row['ActivityEvent'])
{
case 'settings':
$event_link_format = '<a href="?settings">settings</a>';
break;
case 'users':
$event_link_format = '<a href="?users">a user</a>';
break;
case 'schedule':
$event_link_format = '<a href="?schedules">schedule</a>';
$stmt1 = phoromatic_server::$db->prepare('SELECT Title FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':schedule_id', $row['ActivityEventID']);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$id_link_format = '<a href="?schedules/' . $row['ActivityEventID'] . '">' . $row1['Title'] . '</a>';
break;
case 'tests_for_schedule':
$event_link_format = 'a test for a schedule';
$stmt1 = phoromatic_server::$db->prepare('SELECT Title FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':schedule_id', $row['ActivityEventID']);
$result1 = $stmt1->execute();
$row1 = $result1->fetchArray();
$id_link_format = '<a href="?schedules/' . $row['ActivityEventID'] . '">' . $row1['Title'] . '</a>';
break;
case 'groups':
$event_link_format = '<a href="?systems#group_edit">a group</a>';
break;
default:
$event_link_format = $row['ActivityEvent'];
break;
}
if($row['ActivityCreatorType'] == 'USER')
{
$main .= '<p><em>' . date('H:i', strtotime($row['ActivityTime'])) . '</em> &nbsp; <strong>' . $row['ActivityCreator'] . '</strong> <strong> ' . $row['ActivityEventType'] . '</strong> <strong>' . $event_link_format . '</strong>';
if($id_link_format != null)
$main .= ': ' . $id_link_format;
$main .= '</p>' . PHP_EOL;
}
//$main .= '<p>' . $row['ActivityCreator'] . ' ' . $row['ActivityCreatorType'] . ' ' . $row['ActivityEvent'] . ' ' . $row['ActivityEventID'] . ' ' . $row['ActivityEventType'] . '</p>';
}
while($row = $result->fetchArray());
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
}
?>

View File

@@ -0,0 +1,85 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_caches implements pts_webui_interface
{
public static function page_title()
{
return 'Download Caches';
}
public static function page_header()
{
return null;
}
public static function preload($PAGE)
{
return true;
}
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main = '<h1>Cache Settings</h1>
<h2>Test Profile Download Cache</h2>
<p>Below are a list of files for verification/debugging purposes that are currently cached by the Phoromatic Server and available for Phoronix Test Suite client systems to download. These are files that are needed by various test profiles in the Phoronix Test Suite. To add more data to this Phoromatic Server cache, from the server run <strong>phoronix-test-suite make-download-cache</strong> while passing the names of any tests/suites you wish to have download and generate a cache for so they can be made available to the Phoronix Test Suite clients on your network.</p>';
if(is_file(PTS_DOWNLOAD_CACHE_PATH . 'pts-download-cache.json'))
{
$cache_json = file_get_contents(PTS_DOWNLOAD_CACHE_PATH . 'pts-download-cache.json');
$cache_json = json_decode($cache_json, true);
if($cache_json && isset($cache_json['phoronix-test-suite']['download-cache']))
{
$total_file_size = 0;
$main .= '<table><tr><th>File</th><th>Size</th></tr>';
foreach($cache_json['phoronix-test-suite']['download-cache'] as $file_name => $inf)
{
$total_file_size += $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'];
$main .= '<tr><td>' . $file_name . '</td><td>' . round(max(0.1, $cache_json['phoronix-test-suite']['download-cache'][$file_name]['file_size'] / 1000000), 1) . 'MB</td></tr>';
}
$main .= '</table>';
$main .= '<p><strong>' . count($cache_json['phoronix-test-suite']['download-cache']) . ' Files / ' . round($total_file_size / 1000000) . ' MB Cache Size</strong></p>';
}
}
else
{
$main .= '<h3>No download cache file could be found; on the Phoromatic Server you should run <strong>phoronix-test-suite make-download-cache</strong>.</h3>'; // TODO XXX implement from the GUI
}
$main .= '<hr /><h2>OpenBenchmarking.org Cache Data</h2>';
$main .= '<p>Below is information pertaining to the OpenBenchmarking.org cache present on the Phoromatic Server. To update this cache, run <strong>phoronix-test-suite make-openbenchmarking-cache</strong> from the server.</p>';
$index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
$main .= '<table><tr><th>Repository</th><th>Last Updated</th></tr>';
foreach($index_files as $index_file)
{
$index_data = json_decode(file_get_contents($index_file), true);
$main .= '<tr><td>' . basename($index_file, '.index') . '</td><td>' . date('d F Y H:i', $index_data['main']['generated']) . '</td></tr>';
}
$main .= '</table>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
}
?>

View File

@@ -38,28 +38,33 @@ class phoromatic_main implements pts_webui_interface
public static function render_page_process($PATH)
{
echo phoromatic_webui_header_logged_in();
$main .= '<h2 style="color: red;">Phoromatic is currently under development with the Phoronix Test Suite 5.2-Khanino release. With the 5.2 release the public Phoromatic code is intended as a &quot;technical preview&quot; and is a work-in-progress. All basic functionality should be implemented while other features are forthcoming (<em>see the TODO list for more details</em>). Your code contributions are welcome via our GitHub. We also accept <a href="http://www.phoronix-test-suite.com/?k=commercial">custom engineering work / commercial sponsorship</a> and other forms of support to continue its public, open-source development.</h2><hr />';
$main = '<h2 style="">Phoromatic is under very active development right now for this version of the Phoronix Test Suite. Please keep up with the latest Git activity via <a href="https://github.com/phoronix-test-suite/phoronix-test-suite">GitHub</a>. All basic functionality should be implemented while other features are forthcoming (<em>see the TODO list for more details</em>). Your code contributions are welcome via our GitHub. We also accept <a href="http://www.phoronix-test-suite.com/?k=commercial">custom engineering work / commercial sponsorship</a> and other forms of support to continue its public, open-source development.</h2><hr />';
$main .= '<h1>Phoromatic</h1>';
$main .= phoromatic_systems_needing_attention();
$main .= '<h2>Welcome</h2>
<p>Phoromatic is the remote management and test orchestration component to the <a href="http://www.phoronix-test-suite.com/">Phoronix Test Suite</a>. Phoromatic allows you to exploit the Phoronix Test Suite\'s vast feature-set across multiple systems over the LAN/WAN, manage entire test farms of systems for benchmarking via a centralized interface, centrally collect test results, and carry out other enteprise-focused tasks. To get started with your new account, the basic steps to get started include:</p>
<p>Phoromatic is the remote management and test orchestration component to the <a href="http://www.phoronix-test-suite.com/">Phoronix Test Suite</a>. Phoromatic allows you to exploit the Phoronix Test Suite\'s vast feature-set across multiple systems over the LAN/WAN, manage entire test farms of systems for benchmarking via a centralized interface, centrally collect test results, and carry out other enteprise-focused tasks.</p>';
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<p>To get started with your new account, the basic steps to get started include:</p>
<ol>
<li>Connect/sync the Phoronix Test Suite client systems (the systems to be benchmarked) to this account. In the simplest form, you just need to run the following command on the test systems: <strong>phoronix-test-suite phoromatic.connect ' . phoromatic_web_socket_server_addr() . '</strong>. For more information view the instructions on the <a href="?systems">systems page</a>.</li>
<li>Configure your <a href="?settings">account settings</a>.</li>
<li><a href="?schedules">Create a test schedule</a>. A schedule is for running test(s) on selected system(s) on a routine, timed basis or whenever a custom trigger is passed to the Phoromatic server. A test schedule could be for running benchmarks on a daily basis, whenever a new Git commit is applied to a code-base, or other events occurred. You can also enrich the potential by adding pre/post-test hooks for ensuring the system is set to a proper state for benchmarking.</li>
<li>View the automatically generated <a href="?results">test results</a>.</li>
<li>If you like Phoromatic and the Phoronix Test Suite for enterprise testing, please <a href="http://commercial.phoronix-test-suite.com/">contact us</a> for commercial support, our behind-the-firewall licensed versions of Phoromatic and OpenBenchmarking.org, custom engineering services, and other professional services. It\'s not without corporate support that we can continue to develop this leading Linux benchmarking software in our Phoronix mission of enriching the Linux hardware experience. If you run into any problems with our open-source software or would like to contribute patches, you can do so via our <a href="https://github.com/phoronix-test-suite/phoronix-test-suite">GitHub</a>.</li>
</ol>
</ol>';
}
<hr />
$main .= '<hr />
<div class="pts_phoromatic_info_box_area">';
// ACTIVE TEST SCHEDULES
$main .= '<div style="float: left; width: 100%;"><ul><li><h1>Active Test Schedules</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC');
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
@@ -72,12 +77,13 @@ class phoromatic_main implements pts_webui_interface
{
do
{
$main .= '<a href="?schedules/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><span style="color: #065695;"><em>' . $row['Description'] . '</em></span></li></a>';
$system_count = empty($row['RunTargetSystems']) ? 0 : count(explode(',', $row['RunTargetSystems']));
$group_count = empty($row['RunTargetGroups']) ? 0 : count(explode(',', $row['RunTargetGroups']));
$main .= '<a href="?schedules/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><em><strong>' . $system_count . ' Systems | ' . $group_count . ' Groups</strong> ' . $row['Description'] . ' </em></li></a>';
}
while($row = $result->fetchArray());
}
$main .= '</ul></div>';
// TODAY'S TEST RESULTS
$main .= '<div style="float: left; width: 100%;"><ul><li><h1>Today\'s Test Results</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, ScheduleID, UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id ORDER BY UploadTime DESC');
@@ -91,7 +97,7 @@ class phoromatic_main implements pts_webui_interface
{
break;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><span style="color: #065695;"><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . '</em></span></li></a>';
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . '</em></li></a>';
$results_today++;
}
@@ -112,7 +118,7 @@ class phoromatic_main implements pts_webui_interface
{
break;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><span style="color: #065695;"><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . '</em></span></li></a>';
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . '</em></li></a>';
}
while($test_result_row = $test_result_result->fetchArray());
$main .= '</ul></div>';
@@ -130,7 +136,7 @@ class phoromatic_main implements pts_webui_interface
{
break;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><span style="color: #065695;"><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></span></li></a>';
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></li></a>';
}
while($test_result_row = $test_result_result->fetchArray());
$main .= '</ul></div>';
@@ -157,7 +163,7 @@ class phoromatic_main implements pts_webui_interface
{
do
{
$main .= '<a href="?systems/' . $row['SystemID'] . '"><li>' . $row['Title'] . '<br /><span style="color: #065695;"><em>' . $row['LocalIP'] . ' - ' . $row['CurrentTask'] . '</em></span></li></a>';
$main .= '<a href="?systems/' . $row['SystemID'] . '"><li>' . $row['Title'] . '<br /><em>' . $row['LocalIP'] . ' - ' . $row['CurrentTask'] . '</em></li></a>';
}
while($row = $result->fetchArray());
}

View File

@@ -0,0 +1,104 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_result implements pts_webui_interface
{
public static function page_title()
{
return 'Result';
}
public static function page_header()
{
return null;
}
public static function preload($PAGE)
{
return true;
}
public static function render_page_process($PATH)
{
$main = null;
if(isset($PATH[0]))
{
$upload_ids = explode(',', $PATH[0]);
$result_file = array();
foreach($upload_ids as $upload_id)
{
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND UploadID = :upload_id LIMIT 1');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':upload_id', $upload_id);
$result = $stmt->execute();
$row = $result->fetchArray();
$composite_xml = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $upload_id) . 'composite.xml';
if(!is_file($composite_xml))
{
echo 'File Not Found: ' . $composite_xml;
return false;
}
array_push($result_file, new pts_result_merge_select($composite_xml));
}
$writer = new pts_result_file_writer(null);
$attributes = array();
pts_merge::merge_test_results_process($writer, $result_file, $attributes);
$result_file = new pts_result_file($writer->get_xml());
$extra_attributes = array();
$intent = null;
$main .= '<h1>' . $result_file->get_title() . '</h1>';
if($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true)))
{
$table = new pts_ResultFileCompactSystemsTable($result_file, $intent);
}
else
{
$table = new pts_ResultFileSystemsTable($result_file);
}
$main .= '<p class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
foreach($result_file->get_result_objects() as $i => $result_object)
{
$main .= '<h2><a name="r-' . $i . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
$main .= '<p class="result_object">';
$main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
$main .= '</p>';
}
}
else
{
// No result
}
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
}
?>

View File

@@ -40,48 +40,26 @@ class phoromatic_results implements pts_webui_interface
echo phoromatic_webui_header_logged_in();
$main = null;
if(isset($PATH[0]))
if(!PHOROMATIC_USER_IS_VIEWER && isset($PATH[0]) && $PATH[0] == 'delete')
{
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_results WHERE AccountID = :account_id AND UploadID = :upload_id LIMIT 1');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':upload_id', $PATH[0]);
$result = $stmt->execute();
$row = $result->fetchArray();
$upload_ids = explode(',', $PATH[1]);
if($row)
foreach($upload_ids as $upload_id)
{
$main .= '<h1>' . $row['Title'] . '</h1>';
pts_openbenchmarking::clone_openbenchmarking_result($row['OpenBenchmarkingID']);
$result_file = new pts_result_file($row['OpenBenchmarkingID']);
$stmt = phoromatic_server::$db->prepare('DELETE FROM phoromatic_results WHERE AccountID = :account_id AND UploadID = :upload_id LIMIT 1');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':upload_id', $upload_id);
$result = $stmt->execute();
$extra_attributes = array();
$intent = null;
if($result_file->get_system_count() == 1 || ($intent = pts_result_file_analyzer::analyze_result_file_intent($result_file, $intent, true)))
{
$table = new pts_ResultFileCompactSystemsTable($result_file, $intent);
}
else
{
$table = new pts_ResultFileSystemsTable($result_file);
}
$main .= '<p class="result_object">' . pts_render::render_graph_inline_embed($table, $result_file, $extra_attributes) . '</p>';
foreach($result_file->get_result_objects() as $i => $result_object)
{
$main .= '<h2><a name="r-' . $i . '"></a>' . $result_object->test_profile->get_title() . '</h2>';
$main .= '<p class="result_object">';
$main .= pts_render::render_graph_inline_embed($result_object, $result_file, $extra_attributes);
$main .= '</p>';
}
$upload_dir = phoromatic_server::phoromatic_account_result_path($_SESSION['AccountID'], $upload_id);
pts_file_io::delete($upload_dir);
}
}
if($main == null)
{
$main = '<h1>Test Results</h1>';
$main .= '<div id="pts_phoromatic_top_result_button_area"></div>';
$main .= '<div class="pts_phoromatic_info_box_area">';
$main .= '<div style="float: left; width: 100%;"><ul><li><h1>Recent Test Results</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, ScheduleID, UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id ORDER BY UploadTime DESC');
@@ -94,7 +72,7 @@ class phoromatic_results implements pts_webui_interface
{
break;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><span style="color: #065695;"><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></span></li></a>';
$main .= '<a onclick="javascript:phoromatic_click_results(\'' . $test_result_row['UploadID'] . '\');"><li id="result_select_' . $test_result_row['UploadID'] . '">' . $test_result_row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></li></a>';
$results++;
}
@@ -103,7 +81,8 @@ class phoromatic_results implements pts_webui_interface
$main .= '<li class="light" style="text-align: center;">No Results Found</li>';
}
$main .= '</ul></div>';
$main .= '</div><h3>TODO A lot of other result analysis functionality powered by OpenBenchmarking.org to come in next few days...';
$main .= '</div>';
$main .= '<div id="pts_phoromatic_bottom_result_button_area"></div>';
}
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());

View File

@@ -0,0 +1,262 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_sched implements pts_webui_interface
{
public static function page_title()
{
return 'Test Scheduling';
}
public static function page_header()
{
return null;
}
public static function preload($PAGE)
{
return true;
}
public static function render_page_process($PATH)
{
if(PHOROMATIC_USER_IS_VIEWER)
return;
$is_new = true;
if(!empty($PATH[0]) && is_numeric($PATH[0]))
{
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_schedules WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$result = $stmt->execute();
$e_schedule = $result->fetchArray();
if(!empty($e_schedule))
{
$is_new = false;
}
}
if(isset($_POST['schedule_title']) && !empty($_POST['schedule_title']))
{
$title = phoromatic_get_posted_var('schedule_title');
$description = phoromatic_get_posted_var('schedule_description');
$pre_install_context = phoromatic_get_posted_var('pre_install_set_context');
$post_install_context = phoromatic_get_posted_var('post_install_set_context');
$pre_run_context = phoromatic_get_posted_var('pre_run_set_context');
$post_run_context = phoromatic_get_posted_var('post_run_set_context');
$system_all = phoromatic_get_posted_var('system_all');
$run_target_systems = phoromatic_get_posted_var('run_on_systems', array());
$run_target_groups = phoromatic_get_posted_var('run_on_groups', array());
if(!is_array($run_target_systems)) $run_target_systems = array();
if(!is_array($run_target_groups)) $run_target_groups = array();
$run_target_systems = implode(',', $run_target_systems);
$run_target_groups = implode(',', $run_target_groups);
$schedule_hour = phoromatic_get_posted_var('schedule_hour');
$schedule_minute = phoromatic_get_posted_var('schedule_minute');
$days_active = phoromatic_get_posted_var('days_active');
$context_files = array('SetContextPreInstall' => 'pre_install_set_context', 'SetContextPostInstall' => 'post_install_set_context', 'SetContextPreRun' => 'pre_run_set_context', 'SetContextPostRun' => 'post_run_set_context');
foreach($context_files as $i => $context)
$$context = $is_new ? null : $e_schedule[$i];
foreach($context_files as $context)
{
$$context = null;
if($_FILES[$context]['error'] == 0 && $_FILES[$context]['size'] > 0)
{
$sha1_hash = sha1_file($_FILES[$context]['tmp_name']);
if(!is_file(phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash))
{
move_uploaded_file($_FILES[$context]['tmp_name'], phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash);
}
$$context = $sha1_hash;
}
}
// TODO XXX: Validation of input
// Need a unique schedule ID
if($is_new)
{
do
{
$schedule_id = rand(10, 9999);
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND ScheduleID = \'' . $schedule_id . '\'');
}
while(!empty($matching_schedules));
// Need a unique public ID
do
{
$public_key = pts_strings::random_characters(12, true);;
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND PublicKey = \'' . $public_key . '\'');
}
while(!empty($matching_schedules));
}
else
{
$schedule_id = $e_schedule['ScheduleID'];
$public_key = $e_schedule['PublicKey'];
}
// Add schedule
$stmt = phoromatic_server::$db->prepare('INSERT OR REPLACE INTO phoromatic_schedules (AccountID, ScheduleID, Title, Description, State, ActiveOn, RunAt, SetContextPreInstall, SetContextPostInstall, SetContextPreRun, SetContextPostRun, LastModifiedBy, LastModifiedOn, PublicKey, RunTargetGroups, RunTargetSystems) VALUES (:account_id, :schedule_id, :title, :description, :state, :active_on, :run_at, :context_pre_install, :context_post_install, :context_pre_run, :context_post_run, :modified_by, :modified_on, :public_key, :run_target_groups, :run_target_systems)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $schedule_id);
$stmt->bindValue(':title', $title);
$stmt->bindValue(':description', $description);
$stmt->bindValue(':state', 1);
$stmt->bindValue(':active_on', implode(',', $days_active));
$stmt->bindValue(':run_at', $schedule_hour . '.' . $schedule_minute);
$stmt->bindValue(':context_pre_install', $pre_install_set_context);
$stmt->bindValue(':context_post_install', $post_install_set_context);
$stmt->bindValue(':context_pre_run', $pre_run_set_context);
$stmt->bindValue(':context_post_run', $post_run_set_context);
$stmt->bindValue(':modified_by', $_SESSION['UserName']);
$stmt->bindValue(':modified_on', phoromatic_server::current_time());
$stmt->bindValue(':public_key', $public_key);
$stmt->bindValue(':run_target_groups', $run_target_groups);
$stmt->bindValue(':run_target_systems', $run_target_systems);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('schedule', $schedule_id, ($is_new ? 'added' : 'modified'));
if($result)
{
header('Location: ?schedules/' . $schedule_id);
}
}
echo phoromatic_webui_header_logged_in();
$main = '
<hr />
<h2>' . ($is_new ? 'Create' : 'Edit') . ' A Schedule</h2>
<p>A test schedule is used to facilitate automatically running a set of test(s)/suite(s) on either a routine timed basis or whenever triggered by an external script.</p>';
$main .= '<form action="' . $_SERVER['REQUEST_URI'] . '" name="add_test" id="add_test" method="post" enctype="multipart/form-data" onsubmit="return validate_schedule();">
<h3>Title</h3>
<p><input type="text" name="schedule_title" value="' . (!$is_new ? $e_schedule['Title'] : null) . '" /></p>
<h3><em>Pre-Install Set Context Script:</em></h3>
<p><input type="file" name="pre_install_set_context" /></p>
<h3><em>Post-Install Set Context Script:</em></h3>
<p><input type="file" name="post_install_set_context" /></p>
<h3><em>Pre-Run Set Context Script:</em></h3>
<p><input type="file" name="pre_run_set_context" /></p>
<h3><em>Post-Run Set Context Script:</em></h3>
<p><input type="file" name="post_run_set_context" /></p>
<h3>System Targets:</h3>
<p>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if(!$is_new)
{
$e_schedule['RunTargetSystems'] = explode(',', $e_schedule['RunTargetSystems']);
$e_schedule['RunTargetGroups'] = explode(',', $e_schedule['RunTargetGroups']);
}
if($row = $result->fetchArray())
{
$main .= '<h4>Systems: ';
do
{
$main .= '<input type="checkbox" name="run_on_systems[]" value="' . $row['SystemID'] . '" ' . (!$is_new && in_array($row['SystemID'], $e_schedule['RunTargetSystems']) ? 'checked="checked" ' : null) . '/> ' . $row['Title'] . ' ';
}
while($row = $result->fetchArray());
$main .= '</h4>';
}
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if($row = $result->fetchArray())
{
$main .= '<h4>Groups: ';
do
{
$main .= '<input type="checkbox" name="run_on_groups[]" value="' . $row['GroupName'] . '" ' . (!$is_new && in_array($row['GroupName'], $e_schedule['RunTargetGroups']) ? 'checked="checked" ' : null) . '/> ' . $row['GroupName'] . ' ';
}
while($row = $result->fetchArray());
$main .= '</h4>';
}
$main .= '</p>
<h3>Description:</h3>
<p><textarea name="schedule_description" id="schedule_description" cols="50" rows="3">' . (!$is_new ? $e_schedule['Description'] : null) . '</textarea></p>
<table class="pts_phoromatic_schedule_type">
<tr>
<td><h3>Time-Based Testing</h3><em>Time-based testing allows tests to automatically commence at a given time on a defined cycle each day/week. This option is primarly aimed for those wishing to run a set of benchmarks every morning or night or at another defined period.</em></td>
<td><h3>Run Time:</h3>
<p><select name="schedule_hour" id="schedule_hour">';
if(!$is_new)
{
$run_at = explode('.', $e_schedule['RunAt']);
$days_active = explode(',', $e_schedule['ActiveOn']);
}
for($i = 0; $i <= 23; $i++)
{
$i_f = (strlen($i) == 1 ? '0' . $i : $i);
$main .= '<option value="' . $i_f . '"' . (!$is_new && $run_at[0] == $i ? 'selected="selected" ' : null) . '>' . $i_f . '</option>';
}
$main .= '</select> <select name="schedule_minute" id="schedule_minute">';
for($i = 0; $i < 60; $i += 10)
{
$i_f = (strlen($i) == 1 ? '0' . $i : $i);
$main .= '<option value="' . $i_f . '"' . (!$is_new && $run_at[1] == $i ? 'selected="selected" ' : null) . '>' . $i_f . '</option>';
}
$main .= '</select><h3>Active On:</h3><p>';
$week = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
foreach($week as $index => $day)
{
$main .= '<input type="checkbox" name="days_active[]" value="' . $index . '"' . (!$is_new && in_array($index, $days_active) ? 'checked="checked" ' : null) . '/> ' . $day;
}
$main .= '</p></td>
</tr>
<tr>
<td><h3>Trigger-Based Testing</h3><em>To carry out trigger-based testing, you can simply have an external process/script trigger (&quot;ping&quot;) a specialized URL whenever an event occurs to commence a new round of testing. This is the most customizable approach to having Phoromatic run tests on a system if you wish to have it occur whenever a Git/SVN commit takes place or other operations.</em></td>
<td><h3>Once creating the test schedule there will be a specialized URL you can use for &quot;pinging&quot; where you can pass it a Git commit hash, SVN revision number, date, or other unique identifiers to externally trigger the test schedules and systems to begin testing. This custom trigger is passed to any of the used context scripts for setting up the system in an appropriate state.</h3></td>
</tr>
</table>
<h3><em>Indicates optional field.</em></h3>
<p align="right"><input name="submit" value="' . ($is_new ? 'Create' : 'Edit') . ' Schedule" type="submit" onclick="return pts_rmm_validate_schedule();" /></p>
</form>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
}
?>

View File

@@ -37,75 +37,6 @@ class phoromatic_schedules implements pts_webui_interface
}
public static function render_page_process($PATH)
{
if(isset($_POST['schedule_title']) && !empty($_POST['schedule_title']))
{
$title = $_POST['schedule_title'];
$description = $_POST['schedule_description'];
$pre_install_context = $_POST['pre_install_set_context'];
$post_install_context = $_POST['post_install_set_context'];
$pre_run_context = $_POST['pre_run_set_context'];
$post_run_context = $_POST['post_run_set_context'];
$system_all = $_POST['system_all'];
$run_on_systems = $_POST['run_on_systems'];
$run_on_groups = $_POST['run_on_groups'];
$schedule_hour = $_POST['schedule_hour'];
$schedule_minute = $_POST['schedule_minute'];
$days_active = $_POST['days_active'];
$context_files = array('pre_install_set_context', 'post_install_set_context', 'pre_run_set_context', 'post_run_set_context');
foreach($context_files as $context)
{
$$context = null;
if($_FILES[$context]['error'] == 0 && $_FILES[$context]['size'] > 0)
{
$sha1_hash = sha1_file($_FILES[$context]['tmp_name']);
if(!is_file(phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash))
{
move_uploaded_file($_FILES[$context]['tmp_name'], phoromatic_server::phoromatic_account_path($_SESSION['AccountID']) . 'context_' . $sha1_hash);
}
$$context = $sha1_hash;
}
}
// TODO XXX: Validation of input
do
{
$schedule_id = rand(10, 9999);
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND ScheduleID = \'' . $schedule_id . '\'');
}
while(!empty($matching_schedules));
do
{
$public_key = pts_strings::random_characters(12, true);;
$matching_schedules = phoromatic_server::$db->querySingle('SELECT ScheduleID FROM phoromatic_schedules WHERE AccountID = \'' . $_SESSION['AccountID'] . '\' AND PublicKey = \'' . $public_key . '\'');
}
while(!empty($matching_schedules));
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_schedules (AccountID, ScheduleID, Title, Description, State, ActiveOn, RunAt, SetContextPreInstall, SetContextPostInstall, SetContextPreRun, SetContextPostRun, LastModifiedBy, LastModifiedOn, PublicKey) VALUES (:account_id, :schedule_id, :title, :description, :state, :active_on, :run_at, :context_pre_install, :context_post_install, :context_pre_run, :context_post_run, :modified_by, :modified_on, :public_key)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $schedule_id);
$stmt->bindValue(':title', $title);
$stmt->bindValue(':description', $description);
$stmt->bindValue(':state', 1);
$stmt->bindValue(':active_on', implode(',', $days_active));
$stmt->bindValue(':run_at', $schedule_hour . '.' . $schedule_minute);
$stmt->bindValue(':context_pre_install', $pre_install_set_context);
$stmt->bindValue(':context_post_install', $post_install_set_context);
$stmt->bindValue(':context_pre_run', $pre_run_set_context);
$stmt->bindValue(':context_post_run', $post_run_set_context);
$stmt->bindValue(':modified_by', $_SESSION['UserName']);
$stmt->bindValue(':modified_on', phoromatic_server::current_time());
$stmt->bindValue(':public_key', $public_key);
$result = $stmt->execute();
}
echo phoromatic_webui_header_logged_in();
if(!empty($PATH[0]) && is_numeric($PATH[0]))
@@ -151,9 +82,10 @@ class phoromatic_schedules implements pts_webui_interface
$stmt->bindValue(':test_arguments', $args);
$stmt->bindValue(':test_description', $args_name);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('tests_for_schedule', $PATH[0], 'added');
}
}
else if($PATH[1] == 'remove' && !empty($PATH[2]))
else if(isset($PATH[1]) && $PATH[1] == 'remove' && !empty($PATH[2]))
{
// REMOVE TEST
$to_remove = explode(PHP_EOL, base64_decode($PATH[2]));
@@ -163,14 +95,54 @@ class phoromatic_schedules implements pts_webui_interface
$stmt->bindValue(':test', $to_remove[0]);
$stmt->bindValue(':test_args', $to_remove[1]);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('tests_for_schedule', $to_remove[0] . ' - ' . $to_remove[1], 'removed');
}
else if(isset($PATH[1]) && in_array($PATH[1], array('activate', 'deactivate')))
{
switch($PATH[1])
{
case 'deactivate':
$new_state = 0;
break;
case 'activate':
default:
$new_state = 1;
break;
}
// REMOVE TEST
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_schedules SET State = :new_state WHERE AccountID = :account_id AND ScheduleID = :schedule_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':schedule_id', $PATH[0]);
$stmt->bindValue(':new_state', $new_state);
$result = $stmt->execute();
$row['State'] = $new_state;
phoromatic_add_activity_stream_event('schedule', $PATH[0], $PATH[1]);
}
$main = '<h1>' . $row['Title'] . '</h1>';
$main .= '<h3>' . $row['Description'] . '</h3>';
$main .= '<p>This schedule was last modified at <strong>' . $row['LastModifiedOn'] . '</strong> by <strong>' . $row['LastModifiedBy'] . '</strong>.';
$main .= '<p>This schedule was last modified on <strong>' . date('j F Y \a\t H:i', strtotime($row['LastModifiedOn'])) . '</strong> by <strong>' . $row['LastModifiedBy'] . '</strong>.';
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<p><a href="?sched/' . $PATH[0] . '">Edit Schedule</a> | ';
if($row['State'] == 1)
{
$main .= '<a href="?schedules/' . $PATH[0] . '/deactivate">Deactivate Schedule</a>';
}
else
{
$main .= '<a href="?schedules/' . $PATH[0] . '/activate">Activate Schedule</a>';
}
$main .= '</p>';
}
$main .= '<hr />';
$main .= '<h2>Active On</h2>';
$main .= '<h2>Schedule</h2>';
if(!empty($row['ActiveOn']))
{
$active_days = explode(',', $row['ActiveOn']);
@@ -187,7 +159,17 @@ class phoromatic_schedules implements pts_webui_interface
}
}
$main .= '<p>This test is scheduled to run on <strong>' . implode(', ', $active_days) . '</strong> at <strong>' . str_replace('.', ':', $row['RunAt']) . '</strong>.';
switch(count($active_days))
{
case 2:
$day_show = implode(' and ', $active_days);
break;
default:
$day_show = implode(', ', $active_days);
break;
}
$main .= '<p>This test is scheduled to run every <strong>' . $day_show . '</strong> at <strong>' . str_replace('.', ':', $row['RunAt']) . '</strong>.';
}
else
{
@@ -207,7 +189,7 @@ class phoromatic_schedules implements pts_webui_interface
while($row = $result->fetchArray())
{
$test_count++;
$main .= '<h3>' . $row['TestProfile'] . ($row['TestDescription'] != null ? ' - <em>' . $row['TestDescription'] . '</em>' : '') . ' <a href="?schedules/' . $PATH[0] . '/remove/' . base64_encode(implode(PHP_EOL, array($row['TestProfile'], $row['TestArguments']))) . '">Remove Test</a>' . '</h3>';
$main .= '<h3>' . $row['TestProfile'] . ($row['TestDescription'] != null ? ' - <em>' . $row['TestDescription'] . '</em>' : '') . (!PHOROMATIC_USER_IS_VIEWER ? ' <a href="?schedules/' . $PATH[0] . '/remove/' . base64_encode(implode(PHP_EOL, array($row['TestProfile'], $row['TestArguments']))) . '">Remove Test</a>' : null) . '</h3>';
}
if($test_count == 0)
@@ -215,16 +197,18 @@ class phoromatic_schedules implements pts_webui_interface
$main .= '<h3 style="text-transform: uppercase;">No tests have been added yet for this test schedule.</h3>';
}
$main .= '<hr /><h2>Add A Test</h2>';
$main .= '<form action="?schedules/' . $PATH[0] . '" name="add_test" id="add_test" method="post">';
$main .= '<select name="add_to_schedule_select_test" id="add_to_schedule_select_test" onchange="phoromatic_schedule_test_details();">';
foreach(pts_openbenchmarking::available_tests() as $test) {
$main .= '<option value="' . $test . '">' . $test . '</option>';
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<hr /><h2>Add A Test</h2>';
$main .= '<form action="?schedules/' . $PATH[0] . '" name="add_test" id="add_test" method="post">';
$main .= '<select name="add_to_schedule_select_test" id="add_to_schedule_select_test" onchange="phoromatic_schedule_test_details();">';
foreach(pts_openbenchmarking::available_tests() as $test) {
$main .= '<option value="' . $test . '">' . $test . '</option>';
}
$main .= '</select>';
$main .= '<p><div id="test_details"></div></p>';
$main .= '</form>';
}
$main .= '</select>';
$main .= '<p><div id="test_details"></div></p>';
$main .= '</form>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, ScheduleID, UploadID, UploadTime FROM phoromatic_results WHERE AccountID = :account_id AND ScheduleID = :schedule_id ORDER BY UploadTime DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
@@ -269,7 +253,7 @@ class phoromatic_schedules implements pts_webui_interface
<ul>
<li><h1>Active Test Schedules</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC');
$stmt = phoromatic_server::$db->prepare('SELECT Title, ScheduleID, Description, RunTargetSystems, RunTargetGroups FROM phoromatic_schedules WHERE AccountID = :account_id AND State >= 1 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
@@ -282,7 +266,9 @@ class phoromatic_schedules implements pts_webui_interface
{
do
{
$main .= '<a href="?schedules/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><em>' . $row['Description'] . '</em></li></a>';
$system_count = empty($row['RunTargetSystems']) ? 0 : count(explode(',', $row['RunTargetSystems']));
$group_count = empty($row['RunTargetGroups']) ? 0 : count(explode(',', $row['RunTargetGroups']));
$main .= '<a href="?schedules/' . $row['ScheduleID'] . '"><li>' . $row['Title'] . '<br /><em><strong>' . $system_count . ' Systems | ' . $group_count . ' Groups</strong> ' . $row['Description'] . ' </em></li></a>';
}
while($row = $result->fetchArray());
}
@@ -292,103 +278,13 @@ class phoromatic_schedules implements pts_webui_interface
</div>
</div>';
$main .= '
<hr />
<h2>Create A Schedule</h2>
<p>Account settings are system-wide, in cases where there are multiple individuals/accounts managing the same test systems and data.</p>';
$main .= '<form action="?schedules/add" name="add_test" id="add_test" method="post" enctype="multipart/form-data" onsubmit="return validate_schedule();">
<h3>Title</h3>
<p><input type="text" name="schedule_title" /></p>
<h3><em>Pre-Install Set Context Script:</em></h3>
<p><input type="file" name="pre_install_set_context" /></p>
<h3><em>Post-Install Set Context Script:</em></h3>
<p><input type="file" name="post_install_set_context" /></p>
<h3><em>Pre-Run Set Context Script:</em></h3>
<p><input type="file" name="pre_run_set_context" /></p>
<h3><em>Post-Run Set Context Script:</em></h3>
<p><input type="file" name="post_run_set_context" /></p>
<h3>System Targets:</h3>
<p>
<input type="checkbox" id="system_all" name="system_all" value="yes" checked="checked" onChange="javascript:pts_rmm_schedule_days_toggle(this);" /> <strong>All Systems</strong>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if($row = $result->fetchArray())
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<h4>Systems: ';
do
{
$main .= '<input type="checkbox" name="run_on_systems[]" value="' . $row['SystemID'] . '" /> ' . $row['Title'] . ' ';
}
while($row = $result->fetchArray());
$main .= '</h4>';
$main .= '
<hr />
<h2>Create A Schedule</h2>
<p><a href="?sched">Create a schedule</a> followed by adding tests/suites to run for that schedule on the selected systems.</p>';
}
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
if($row = $result->fetchArray())
{
$main .= '<h4>Groups: ';
do
{
$main .= '<input type="checkbox" name="run_on_groups[]" value="' . $row['GroupName'] . '" /> ' . $row['GroupName'] . ' ';
}
while($row = $result->fetchArray());
$main .= '</h4>';
}
$main .= '</p>
<h3>Description:</h3>
<p><textarea name="schedule_description" id="schedule_description" cols="50" rows="3"></textarea></p>
<table class="pts_phoromatic_schedule_type">
<tr>
<td><h3>Time-Based Testing</h3><em>Time-based testing allows tests to automatically commence at a given time on a defined cycle each day/week. This option is primarly aimed for those wishing to run a set of benchmarks every morning or night or at another defined period.</em></td>
<td><h3>Run Time:</h3>
<p><select name="schedule_hour" id="schedule_hour">';
for($i = 0; $i <= 23; $i++)
{
$i_f = (strlen($i) == 1 ? '0' . $i : $i);
$main .= '<option value="' . $i_f . '">' . $i_f . '</option>';
}
$main .= '</select> <select name="schedule_minute" id="schedule_minute">';
for($i = 0; $i < 60; $i += 10)
{
$i_f = (strlen($i) == 1 ? '0' . $i : $i);
$main .= '<option value="' . $i_f . '">' . $i_f . '</option>';
}
$main .= '</select><h3>Active On:</h3><p>';
$week = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
foreach($week as $index => $day)
{
$main .= '<input type="checkbox" name="days_active[]" value="' . $index . '" /> ' . $day;
}
$main .= '</p></td>
</tr>
<tr>
<td><h3>Trigger-Based Testing</h3><em>To carry out trigger-based testing, you can simply have an external process/script trigger (&quot;ping&quot;) a specialized URL whenever an event occurs to commence a new round of testing. This is the most customizable approach to having Phoromatic run tests on a system if you wish to have it occur whenever a Git/SVN commit takes place or other operations.</em></td>
<td><h3>Once creating the test schedule there will be a specialized URL you can use for &quot;pinging&quot; where you can pass it a Git commit hash, SVN revision number, date, or other unique identifiers to externally trigger the test schedules and systems to begin testing. This custom trigger is passed to any of the used context scripts for setting up the system in an appropriate state.</h3></td>
</tr>
<tr>
<td><h3>One-Time Test</h3><em>If you wish to just run a single set of tests once on a given set of systems via Phoromatic, without any further scheduling, this is the option.</em></td>
<td><h3>TODO IMPLEMENT UI</h3></td>
</tr>
</table>
<h3><em>Indicates optional field.</em></h3>
<p align="right"><input name="submit" value="Add Schedule" type="submit" onclick="return pts_rmm_validate_schedule();" /></p>
</form>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}

View File

@@ -90,55 +90,69 @@ class phoromatic_settings implements pts_webui_interface
$main .= '<p><input type="submit" value="Save User Settings" /></p>';
$main .= '</form>';
$main .= '<hr />
<h2>Account Settings</h2>
<p>Account settings are system-wide, in cases where there are multiple individuals/accounts managing the same test systems and data.</p>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_account_settings WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$account_settings = array(
'Email' => array(
'ArchiveResultsLocally' => 'Archive test results on local test systems after the results have been uploaded.',
'UploadSystemLogs' => 'Upload system logs when uploading test results.',
'RunInstallCommand' => 'Always run the install command for test(s) prior to running them on the system.',
'ForceInstallTests' => 'Force the test installation/re-installation of tests each time prior to running the test.',
'SystemSensorMonitoring' => 'Enable the system sensor monitoring while tests are taking place.'
)
);
$main .= '<form name="system_form" id="system_form" action="?settings" method="post">';
foreach($account_settings as $section => $section_settings)
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<h3>' . $section . '</h3><p>';
foreach($section_settings as $key => $setting)
$main .= '<hr />
<h2>Account Settings</h2>
<p>Account settings are system-wide, in cases where there are multiple individuals/accounts managing the same test systems and data.</p>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_account_settings WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$account_settings = array(
'Email' => array(
'ArchiveResultsLocally' => 'Archive test results on local test systems after the results have been uploaded.',
'UploadSystemLogs' => 'Upload system logs when uploading test results.',
'RunInstallCommand' => 'Always run the install command for test(s) prior to running them on the system.',
'ForceInstallTests' => 'Force the test installation/re-installation of tests each time prior to running the test.',
'SystemSensorMonitoring' => 'Enable the system sensor monitoring while tests are taking place.'
)
);
$main .= '<form name="system_form" id="system_form" action="?settings" method="post">';
$settings_updated = false;
foreach($account_settings as $section => $section_settings)
{
if(isset($_POST[$key]))
$main .= '<h3>' . $section . '</h3><p>';
foreach($section_settings as $key => $setting)
{
if($_POST[$key] == 'yes')
if(isset($_POST[$key]))
{
$row[$key] = 1;
}
else
{
$row[$key] = 0;
if($_POST[$key] == 'yes')
{
$row[$key] = 1;
}
else
{
$row[$key] = 0;
}
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_account_settings SET ' . $key . ' = :val WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':val', $row[$key]);
$stmt->execute();
if($settings_updated == false)
{
phoromatic_add_activity_stream_event('settings', null, 'modified');
$settings_updated = true;
}
//echo phoromatic_server::$db->lastErrorMsg();
}
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_account_settings SET ' . $key . ' = :val WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':val', $row[$key]);
$stmt->execute();
//echo phoromatic_server::$db->lastErrorMsg();
$main .= '<input type="checkbox" name="' . $key . '" ' . (isset($row[$key]) && $row[$key] == 1 ? 'checked="checked" ' : '') . 'value="yes" /> ' . $setting . '<br />';
}
$main .= '<input type="checkbox" name="' . $key . '" ' . (isset($row[$key]) && $row[$key] == 1 ? 'checked="checked" ' : '') . 'value="yes" /> ' . $setting . '<br />';
$main .= '</p>';
}
$main .= '</p>';
$main .= '<p><input type="submit" value="Save Account Settings" /></p>';
$main .= '</form>';
}
$main .= '<p><input type="submit" value="Save Account Settings" /></p>';
$main .= '</form>';
$main .= '<hr />
<h2>Cache Settings</h2>
<p>Proceed to the <a href="?caches">download cache page</a> for information about the Phoromatic Server\'s download caches.</p>';
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();

View File

@@ -40,7 +40,7 @@ class phoromatic_systems implements pts_webui_interface
echo phoromatic_webui_header_logged_in();
$main = null;
if(!empty($PATH[0]) && isset($_POST['system_title']) && !empty($_POST['system_title']) && isset($_POST['system_description']) && isset($_POST['system_state']))
if(!PHOROMATIC_USER_IS_VIEWER && !empty($PATH[0]) && isset($_POST['system_title']) && !empty($_POST['system_title']) && isset($_POST['system_description']) && isset($_POST['system_state']))
{
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Title = :title, Description = :description, State = :state, CurrentTask = \'Awaiting Task\' WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
@@ -62,7 +62,7 @@ class phoromatic_systems implements pts_webui_interface
{
$row = $result->fetchArray();
if($PATH[1] == 'edit')
if(!PHOROMATIC_USER_IS_VIEWER && isset($PATH[1]) && $PATH[1] == 'edit')
{
$main = '<h1>' . $row['Title'] . '</h1>';
$main .= '<form name="system_form" id="system_form" action="?systems/' . $PATH[0] . '" method="post" onsubmit="return phoromatic_system_edit(this);">
@@ -74,7 +74,10 @@ class phoromatic_systems implements pts_webui_interface
else
{
$main = '<h1>' . $row['Title'] . '</h1><p><em>' . ($row['Description'] != null ? $row['Description'] : 'No system description.') . '</em></p>';
$main .= '<p><a href="?systems/' . $PATH[0] . '/edit">Edit Task & Enable/Disable System</a></p>';
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= '<p><a href="?systems/' . $PATH[0] . '/edit">Edit Task & Enable/Disable System</a></p>';
}
}
switch($row['State'])
@@ -91,7 +94,7 @@ class phoromatic_systems implements pts_webui_interface
}
$main .= '<hr />';
$info_table = array('Status:' => $row['CurrentTask'], 'State:' => $state, 'Phoronix Test Suite Client:' => $row['ClientVersion'], 'Last IP:' => $row['LastIP'], 'Last Communication:' => phoromatic_user_friendly_timedate($row['LastCommunication']), 'Initial Creation:' => phoromatic_user_friendly_timedate($row['CreatedOn']), 'System ID:' => $row['SystemID']);
$info_table = array('Status:' => $row['CurrentTask'], 'State:' => $state, 'Phoronix Test Suite Client:' => $row['ClientVersion'], 'Last IP:' => $row['LastIP'], 'Initial Creation:' => phoromatic_user_friendly_timedate($row['CreatedOn']), 'Last Communication:' => phoromatic_user_friendly_timedate($row['LastCommunication']), 'System ID:' => $row['SystemID']);
$main .= '<h2>System State</h2>' . pts_webui::r2d_array_to_table($info_table, 'auto');
$main .= '<hr /><h2>System Components</h2><div style="float: left; width: 50%;">';
@@ -112,20 +115,20 @@ class phoromatic_systems implements pts_webui_interface
$main .= '<h2>Test Results</h2>';
$main .= '<div class="pts_phoromatic_info_box_area">';
$main .= '<div style="float: left; width: 100%;"><ul><li><h1>Recent Test Results</h1></li>';
}
do
{
if($results > 20)
do
{
break;
if($results > 20)
{
break;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></li></a>';
$results++;
}
$main .= '<a href="?results/' . $test_result_row['UploadID'] . '"><li>' . $test_result_row['Title'] . '<br /><span style="color: #065695;"><em>' . phoromatic_system_id_to_name($test_result_row['SystemID']) . ' - ' . phoromatic_user_friendly_timedate($test_result_row['UploadTime']) . '</em></span></li></a>';
$results++;
while($test_result_row = $test_result_result->fetchArray());
}
while($test_result_row = $test_result_result->fetchArray());
if($results > 0)
{
@@ -139,7 +142,7 @@ class phoromatic_systems implements pts_webui_interface
if($main == null)
{
if(isset($_POST['new_group']) && !empty($_POST['new_group']))
if(!PHOROMATIC_USER_IS_VIEWER && isset($_POST['new_group']) && !empty($_POST['new_group']))
{
$group = trim($_POST['new_group']);
@@ -149,29 +152,88 @@ class phoromatic_systems implements pts_webui_interface
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':group_name', $group);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('groups', $group, 'added');
if(!empty($_POST['systems_for_group']) && is_array($_POST['systems_for_group']))
{
foreach($_POST['systems_for_group'] as $sid)
{
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Groups = Groups || :new_group WHERE AccountID = :account_id AND SystemID = :system_id');
// Find current groups
$stmt = phoromatic_server::$db->prepare('SELECT Groups FROM phoromatic_systems WHERE AccountID = :account_id AND SystemID = :system_id ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $sid);
$stmt->bindValue(':new_group', '#' . $group . '#');
$result = $stmt->execute();
$row = $result->fetchArray();
$existing_groups = $row != false ? $row['Groups'] : null;
// Append new Group
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Groups = :new_group WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':system_id', $sid);
$stmt->bindValue(':new_group', $existing_groups . '#' . $group . '#');
$stmt->execute();
}
}
}
}
else if(!PHOROMATIC_USER_IS_VIEWER && isset($_POST['system_group_update']))
{
$stmt = phoromatic_server::$db->prepare('SELECT SystemID FROM phoromatic_systems WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('groups', null, 'modified');
while($row = $result->fetchArray())
{
if(isset($_POST['groups_' . $row['SystemID']]))
{
$group_string = null;
foreach($_POST['groups_' . $row['SystemID']] as $group)
{
$group_string .= '#' . $group . '#';
}
$stmt1 = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Groups = :new_groups WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':system_id', $row['SystemID']);
$stmt1->bindValue(':new_groups', $group_string);
$stmt1->execute();
}
}
}
else if(!PHOROMATIC_USER_IS_VIEWER && isset($_POST['remove_group']))
{
$stmt = phoromatic_server::$db->prepare('DELETE FROM phoromatic_groups WHERE AccountID = :account_id AND GroupName = :group_name');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':group_name', $_POST['remove_group']);
$stmt->execute();
phoromatic_add_activity_stream_event('groups', $group, 'removed');
$stmt = phoromatic_server::$db->prepare('SELECT SystemID, Groups FROM phoromatic_systems WHERE AccountID = :account_id AND Groups LIKE \'%#' . $_POST['remove_group'] . '#%\'');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
while($row = $result->fetchArray())
{
$revised_groups = str_replace('#' . $_POST['remove_group'] . '#', null, $row['Groups']);
$stmt1 = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET Groups = :new_groups WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt1->bindValue(':account_id', $_SESSION['AccountID']);
$stmt1->bindValue(':system_id', $row['SystemID']);
$stmt1->bindValue(':new_groups', $revised_groups);
$stmt1->execute();
}
}
$main = '<h1>Test Systems</h1>';
$main .= phoromatic_systems_needing_attention();
$main .= '<h2>Add A System</h2>
if(!PHOROMATIC_USER_IS_VIEWER)
{
$main .= phoromatic_systems_needing_attention();
$main .= '<h2>Add A System</h2>
<p>To connect a <a href="http://www.phoronix-test-suite.com/">Phoronix Test Suite</a> test system to this account for remotely managing and/or carrying out routine automated benchmarking, follow these simple and quick steps:</p>
<ol><li>From a system with <em>Phoronix Test Suite 5.2 or newer</em> run <strong>phoronix-test-suite phoromatic.connect ' . phoromatic_web_socket_server_addr() . '</strong>. (The test system must be able to access this server\'s correct IP address / domain name.)</li><li>When you have run the command from the test system, you will need to log into this page on Phoromatic server again where you can approve the system and configure the system settings so you can begin using it as part of this Phoromatic account.</li><li>Repeat the two steps for as many systems as you would like! When you are all done -- if you haven\'t done so already, you can start creating test schedules, groups, and other Phoromatic events.</li></ol>
<ol><li>From a system with <em>Phoronix Test Suite 5.4 or newer</em> run <strong>phoronix-test-suite phoromatic.connect ' . phoromatic_web_socket_server_addr() . '</strong>. (The test system must be able to access this server\'s correct IP address / domain name.)</li><li>When you have run the command from the test system, you will need to log into this page on Phoromatic server again where you can approve the system and configure the system settings so you can begin using it as part of this Phoromatic account.</li><li>Repeat the two steps for as many systems as you would like! When you are all done -- if you haven\'t done so already, you can start creating test schedules, groups, and other Phoromatic events.</li></ol>';
<hr />
}
$main .= '<hr />
<h2>Systems</h2>
<div class="pts_phoromatic_info_box_area">
@@ -193,7 +255,7 @@ class phoromatic_systems implements pts_webui_interface
{
do
{
$main .= '<a href="?systems/' . $row['SystemID'] . '"><li>' . $row['Title'] . '<br /><span style="color: #065695;"><em>' . $row['LocalIP'] . ' - ' . $row['CurrentTask'] . ' - Last Activity: ' . $row['LastCommunication'] . '</em></span></li></a>';
$main .= '<a href="?systems/' . $row['SystemID'] . '"><li>' . $row['Title'] . '<br /><em>' . $row['LocalIP'] . ' - ' . $row['CurrentTask'] . ' - Last Activity: ' . date('j F Y H:i', strtotime($row['LastCommunication'])) . '</em></li></a>';
}
while($row = $result->fetchArray());
}
@@ -201,58 +263,106 @@ class phoromatic_systems implements pts_webui_interface
$main .= '</ul>
</div>
</div>
</div>';
<hr />
<h2>System Groups</h2>
<p>System groups make it very easy to organize multiple test systems for targeting by test schedules. You can always add/remove systems to groups, create new groups, and add systems to multiple groups. After creating a group and adding systems to the group, you can begin targeting tests against a particular group of systems. Systems can always be added/removed from groups later and a system can belong to multiple groups.</p>';
$main .= '<div style="float: left;"><form name="new_group_form" id="new_group_form" action="?systems" method="post" onsubmit="return phoromatic_new_group(this);">
<p><div style="width: 200px; font-weight: bold; float: left;">New Group Name:</div> <input type="text" style="width: 300px;" name="new_group" value="" /></p>
<p><div style="width: 200px; font-weight: bold; float: left;">Select System(s) To Add To Group:</div><select name="systems_for_group[]" multiple="multiple" style="width: 300px;">';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
if($row != false)
if(!PHOROMATIC_USER_IS_VIEWER)
{
do
$main .= '<hr />
<h2>System Groups</h2>
<p>System groups make it very easy to organize multiple test systems for targeting by test schedules. You can always add/remove systems to groups, create new groups, and add systems to multiple groups. After creating a group and adding systems to the group, you can begin targeting tests against a particular group of systems. Systems can always be added/removed from groups later and a system can belong to multiple groups.</p>';
$main .= '<div style="float: left;"><form name="new_group_form" id="new_group_form" action="?systems" method="post" onsubmit="return phoromatic_new_group(this);">
<p><div style="width: 200px; font-weight: bold; float: left;">New Group Name:</div> <input type="text" style="width: 300px;" name="new_group" value="" /></p>
<p><div style="width: 200px; font-weight: bold; float: left;">Select System(s) To Add To Group:</div><select name="systems_for_group[]" multiple="multiple" style="width: 300px;">';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID FROM phoromatic_systems WHERE AccountID = :account_id AND State >= 0 ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
if($row != false)
{
$main .= '<option value="' . $row['SystemID'] . '">' . $row['Title'] . '</option>';
do
{
$main .= '<option value="' . $row['SystemID'] . '">' . $row['Title'] . '</option>';
}
while($row = $result->fetchArray());
}
while($row = $result->fetchArray());
}
$main .= '</select></p>
<p><div style="width: 200px; font-weight: bold; float: left;">&nbsp;</div> <input type="submit" value="Create Group" /></p></form></div>';
$main .= '</select></p>
<p><div style="width: 200px; font-weight: bold; float: left;">&nbsp;</div> <input type="submit" value="Create Group" /></p></form></div>';
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
if($row != false)
{
$main .= '<div style="float: left; margin-left: 90px;"><h3>Current System Groups</h3>';
do
if($row != false)
{
$stmt_count = phoromatic_server::$db->prepare('SELECT COUNT(SystemID) AS system_count FROM phoromatic_systems WHERE AccountID = :account_id AND Groups LIKE \'%#' . $row['GroupName'] . '#%\'');
$stmt_count->bindValue(':account_id', $_SESSION['AccountID']);
$result_count = $stmt_count->execute();
$row_count = $result_count->fetchArray();
$row_count['system_count'] = isset($row_count['system_count']) ? $row_count['system_count'] : 0;
$main .= '<div style="float: left; margin-left: 90px;"><h3>Current System Groups</h3>';
$main .= '<p><div style="width: 200px; float: left; font-weight: bold;">' . $row['GroupName'] . '</div> ' . $row_count['system_count'] . ' System' . ($row_count['system_count'] != 1 ? 's' : '') . '</p>';
do
{
$stmt_count = phoromatic_server::$db->prepare('SELECT COUNT(SystemID) AS system_count FROM phoromatic_systems WHERE AccountID = :account_id AND Groups LIKE \'%#' . $row['GroupName'] . '#%\'');
$stmt_count->bindValue(':account_id', $_SESSION['AccountID']);
$result_count = $stmt_count->execute();
$row_count = $result_count->fetchArray();
$row_count['system_count'] = isset($row_count['system_count']) ? $row_count['system_count'] : 0;
$main .= '<p><div style="width: 200px; float: left; font-weight: bold;">' . $row['GroupName'] . '</div> ' . $row_count['system_count'] . ' System' . ($row_count['system_count'] != 1 ? 's' : '') . '</p>';
}
while($row = $result->fetchArray());
$main .= '</div>';
$main .= '<hr /><a name="group_edit"></a><h2>System Group Editing</h2><div style="text-align: center;"><form action="' . $_SERVER['REQUEST_URI'] . '" name="update_groups" method="post"><input type="hidden" name="system_group_update" value="1" />';
$main .= '<table style="margin: 5px auto; overflow: auto;">';
$main .= '<tr>';
$main .= '<th></th>';
$stmt = phoromatic_server::$db->prepare('SELECT GroupName FROM phoromatic_groups WHERE AccountID = :account_id ORDER BY GroupName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$all_groups = array();
while($row = $result->fetchArray())
{
$main .= '<th>' . $row['GroupName'] . '</th>';
array_push($all_groups, $row['GroupName']);
}
$main .= '</tr>';
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Groups FROM phoromatic_systems WHERE AccountID = :account_id ORDER BY Title ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
while($row = $result->fetchArray())
{
$main .= '<tr>';
$main .= '<th>' . $row['Title'] . '</th>';
foreach($all_groups as $group)
{
$checked = stripos($row['Groups'], '#' . $group . '#') !== false ? 'checked="checked" ' : null;
$main .= '<td><input type="checkbox" name="groups_' . $row['SystemID'] . '[]" value="' . $group . '" ' . $checked . '/></td>';
}
$main .= '</tr>';
}
$main .= '</table><p><input name="submit" value="Update Groups" type="submit" /></p></form></div>';
$main .= '<hr /><h2>Remove A Group</h2><p>Removing a group is a permanent action that cannot be undone.</p>';
$main .= '<p><form action="' . $_SERVER['REQUEST_URI'] . '" name="remove_group" method="post"><select name="remove_group" id="remove_group">';
foreach($all_groups as $group)
{
$main .= '<option value="' . $group . '">' . $group . '</option>';
}
$main .= '</select> <input name="submit" value="Remove Group" type="submit" /></form></p>';
}
while($row = $result->fetchArray());
$main .= '</div>';
}
}

View File

@@ -0,0 +1,196 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class phoromatic_users implements pts_webui_interface
{
public static function page_title()
{
return 'Account Administrator';
}
public static function page_header()
{
return null;
}
public static function preload($PAGE)
{
return true;
}
public static function render_page_process($PATH)
{
if($_SESSION['AdminLevel'] !== 1)
{
echo phoromatic_error_page('Unauthorized Access', 'You aren\'t an account administrator!');
return;
}
if(isset($_POST['username']) && isset($_POST['password']) && isset($_POST['confirm_password']) && isset($_POST['email']))
{
// REGISTER NEW USER
if(strlen($_POST['username']) < 4 || strpos($_POST['username'], ' ') !== false)
{
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied username is at least four characters long and contains no spaces.');
return false;
}
if(in_array(strtolower($_POST['username']), array('admin', 'administrator')))
{
phoromatic_error_page('Oops!', $_POST['username'] . ' is a reserved and common username that may be used for other purposes, please make a different selection.');
return false;
}
if(strlen($_POST['password']) < 6)
{
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied password is at least six characters long.');
return false;
}
if($_POST['password'] != $_POST['confirm_password'])
{
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied password matches the password confirmation.');
return false;
}
if($_POST['email'] == null || filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) == false)
{
phoromatic_error_page('Oops!', 'Please enter a valid email address.');
return false;
}
$valid_user_name_chars = '1234567890-_.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
for($i = 0; $i < count($_POST['username']); $i++)
{
if(strpos($valid_user_name_chars, substr($_POST['username'], $i, 1)) === false)
{
phoromatic_error_page('Oops!', 'Please go back and ensure a valid user-name. The character <em>' . substr($_POST['username'], $i, 1) . '</em> is not allowed.');
return false;
}
}
$matching_users = phoromatic_server::$db->querySingle('SELECT UserName FROM phoromatic_users WHERE UserName = \'' . SQLite3::escapeString($_POST['username']) . '\'');
if(!empty($matching_users))
{
phoromatic_error_page('Oops!', 'The user-name is already taken.');
return false;
}
if(!isset($_POST['admin_level']) || $_POST['admin_level'] == 1 || !is_numeric($_POST['admin_level']))
{
phoromatic_error_page('Oops!', 'Invalid administration level.');
return false;
}
$stmt = phoromatic_server::$db->prepare('SELECT Salt FROM phoromatic_accounts WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
$account_salt = $row['Salt'];
$user_id = pts_strings::random_characters(4, true);
$salted_password = hash('sha256', $account_salt . $_POST['password']);
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' created a new account: ' . $user_id . ' - ' . $_SESSION['AccountID']);
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_users (UserID, AccountID, UserName, Email, Password, CreatedOn, LastIP, AdminLevel) VALUES (:user_id, :account_id, :user_name, :email, :password, :current_time, :last_ip, :admin_level)');
$stmt->bindValue(':user_id', $user_id);
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':user_name', $_POST['username']);
$stmt->bindValue(':email', $_POST['email']);
$stmt->bindValue(':password', $salted_password);
$stmt->bindValue(':last_ip', $_SERVER['REMOTE_ADDR']);
$stmt->bindValue(':current_time', phoromatic_server::current_time());
$stmt->bindValue(':admin_level', $_POST['admin_level']);
$result = $stmt->execute();
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_user_settings (UserID, AccountID) VALUES (:user_id, :account_id)');
$stmt->bindValue(':user_id', $user_id);
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
phoromatic_add_activity_stream_event('users', $_POST['username'], 'added');
}
$main = '<h2>Users</h2>
<p>Users associated with this account. Phoromatic users can be one of several tiers with varying privileges:</p>
<ol>
<li><strong>Main Administrator:</strong> The user with full control over the account, the one who originally signed up for the Phoromatic account.</li>
<li><strong>Administrator:</strong> Additional users created by the main administrator with the same access rights as the main administrator.</li>
<li><strong>Viewer:</strong> Additional users created by the main administrator that have access to view data but not to create new schedules, alter system settings, etc.</li>
</ol>
<div class="pts_phoromatic_info_box_area">
<div style="float: left; width: 100%;">
<ul>
<li><h1>All Users</h1></li>';
$stmt = phoromatic_server::$db->prepare('SELECT * FROM phoromatic_users WHERE AccountID = :account_id ORDER BY UserName ASC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();
$row = $result->fetchArray();
do
{
switch($row['AdminLevel'])
{
case 0:
$level = 'Disabled';
break;
case 1:
$level = 'Main Administrator';
break;
case 2:
$level = 'Administrator';
break;
case 10:
$level = 'Viewer';
break;
}
$main .= '<a href="#"><li>' . $row['UserName'] . '<br /><em><strong>' . $level . '</strong> - Last Login: ' . (empty($row['LastLogin']) ? 'Never' : date('j F Y H:i', strtotime($row['LastLogin']))) . '</em></li></a>';
}
while($row = $result->fetchArray());
$main .= '</ul>
</div>
</div>';
$main .= '<hr /><form action="' . $_SERVER['REQUEST_URI'] . '" name="add_user" id="add_user" method="post" onsubmit="return validate_new_user();"><h2>Create Additional Account</h2>
<p>Administrators can create extra accounts to be associated with this account\'s systems, schedules, and test data.</p>
<h3>User</h3>
<p><input type="text" name="username" /></p>
<h3>Password</h3>
<p><input type="password" name="password" /></p>
<h3>Confirm Password</h3>
<p><input type="password" name="confirm_password" /></p>
<h3>Email</h3>
<p><input type="text" name="email" /></p>
<h3>Administration Level</h3>
<p><select name="admin_level">
<option value="2">Administrator</option>
<option value="10">Viewer</option>
</select></p>
<p><input name="submit" value="Add User" type="submit" /></p>
</form>';
echo phoromatic_webui_header_logged_in();
echo phoromatic_webui_main($main, phoromatic_webui_right_panel_logged_in());
echo phoromatic_webui_footer();
}
}
?>

View File

@@ -45,6 +45,11 @@ class phoromatic_welcome implements pts_webui_interface
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied username is at least four characters long and contains no spaces.');
return false;
}
if(in_array(strtolower($_POST['register_username']), array('admin', 'administrator')))
{
phoromatic_error_page('Oops!', $_POST['register_username'] . ' is a reserved and common username that may be used for other purposes, please make a different selection.');
return false;
}
if(strlen($_POST['register_password']) < 6)
{
phoromatic_error_page('Oops!', 'Please go back and ensure the supplied password is at least six characters long.');
@@ -89,6 +94,8 @@ class phoromatic_welcome implements pts_webui_interface
$user_id = pts_strings::random_characters(4, true);
$salted_password = hash('sha256', $account_salt . $_POST['register_password']);
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' created a new account: ' . $user_id . ' - ' . $account_id);
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_accounts (AccountID, ValidateID, CreatedOn, Salt) VALUES (:account_id, :validate_id, :current_time, :salt)');
$stmt->bindValue(':account_id', $account_id);
$stmt->bindValue(':validate_id', pts_strings::random_characters(4, true));
@@ -96,7 +103,7 @@ class phoromatic_welcome implements pts_webui_interface
$stmt->bindValue(':current_time', phoromatic_server::current_time());
$result = $stmt->execute();
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_users (UserID, AccountID, UserName, Email, Password, CreatedOn, LastIP) VALUES (:user_id, :account_id, :user_name, :email, :password, :current_time, :last_ip)');
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_users (UserID, AccountID, UserName, Email, Password, CreatedOn, LastIP, AdminLevel) VALUES (:user_id, :account_id, :user_name, :email, :password, :current_time, :last_ip, :admin_level)');
$stmt->bindValue(':user_id', $user_id);
$stmt->bindValue(':account_id', $account_id);
$stmt->bindValue(':user_name', $_POST['register_username']);
@@ -104,6 +111,7 @@ class phoromatic_welcome implements pts_webui_interface
$stmt->bindValue(':password', $salted_password);
$stmt->bindValue(':last_ip', $_SERVER['REMOTE_ADDR']);
$stmt->bindValue(':current_time', phoromatic_server::current_time());
$stmt->bindValue(':admin_level', 1);
$result = $stmt->execute();
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_user_settings (UserID, AccountID) VALUES (:user_id, :account_id)');
@@ -133,13 +141,14 @@ class phoromatic_welcome implements pts_webui_interface
}
else if(isset($_POST['username']) && isset($_POST['password']))
{
$matching_user = phoromatic_server::$db->querySingle('SELECT UserName, Password, AccountID, UserID FROM phoromatic_users WHERE UserName = \'' . SQLite3::escapeString($_POST['username']) . '\'', true);
$matching_user = phoromatic_server::$db->querySingle('SELECT UserName, Password, AccountID, UserID, AdminLevel FROM phoromatic_users WHERE UserName = \'' . SQLite3::escapeString($_POST['username']) . '\'', true);
if(!empty($matching_user))
{
$user_id = $matching_user['UserID'];
$user = $matching_user['UserName'];
$hashed_password = $matching_user['Password'];
$account_id = $matching_user['AccountID'];
$admin_level = $matching_user['AdminLevel'];
if($user == $_POST['username'])
{
@@ -156,28 +165,30 @@ class phoromatic_welcome implements pts_webui_interface
$_SESSION['UserID'] = $user_id;
$_SESSION['UserName'] = $user;
$_SESSION['AccountID'] = $account_id;
$account_salt = phoromatic_server::$db->exec('UPDATE phoromatic_users SET LastIP = \'' . $_SERVER['REMOTE_ADDR'] . '\', LastLogin = \'' . phoromatic_server::current_time() . ' WHERE UserName = \'' . $matching_user['UserName'] . '\'');
$_SESSION['AdminLevel'] = $admin_level;
$account_salt = phoromatic_server::$db->exec('UPDATE phoromatic_users SET LastIP = \'' . $_SERVER['REMOTE_ADDR'] . '\', LastLogin = \'' . phoromatic_server::current_time() . '\' WHERE UserName = "' . $matching_user['UserName'] . '"');
session_write_close();
if(!is_dir(phoromatic_server::phoromatic_account_path($account_id)))
{
mkdir(phoromatic_server::phoromatic_account_path($account_id));
}
pts_file_io::mkdir(phoromatic_server::phoromatic_account_path($account_id));
pts_file_io::mkdir(phoromatic_server::phoromatic_account_result_path($account_id));
echo phoromatic_webui_header(array('Welcome, ' . $user), '');
$box = '<h1>Log-In Successful</h1>
<p><strong>' . $user . '</strong>, we are now redirecting you to your account portal. If you are not redirected within a few seconds, please <a href="?main">click here</a>.<script type="text/javascript">window.location.href = "?main";</script></p>';
echo phoromatic_webui_box($box);
echo phoromatic_webui_footer();
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' successfully logged in as user: ' . $user);
}
else
{
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' failed a log-in attempt as: ' . $_POST['username']);
phoromatic_error_page('Invalid Information', 'The user-name or password did not match our records.');
return false;
}
}
else
{
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' failed a log-in attempt as: ' . $_POST['username']);
phoromatic_error_page('Invalid Information', 'The user-name was not found within our system.');
return false;
}
@@ -200,13 +211,28 @@ class phoromatic_welcome implements pts_webui_interface
<h1>Register</h1>
<p>Creating a new Phoromatic account is free and easy. The public, open-source version of the Phoronix Test Suite client is limited in its Phoromatic server abilities when it comes to result management and local storage outside of the OpenBenchmarking.org cloud. For organizations looking for behind-the-firewall support and other enterprise features, <a href="http://www.phoronix-test-suite.com/?k=commercial">contact us</a>. To create a new account for this Phoromatic server, simply fill out the form below.</p>';
$register = array(
array('Username', 'Password', 'Confirm Password', 'Email'),
array('<input type="text" name="register_username" />', '<input type="password" name="register_password" />', '<input type="password" name="register_password_confirm" />', '<input type="text" name="register_email" />'),
array('&nbsp;', '&nbsp;', '&nbsp;', '&nbsp;'),
array(' ', ' ', ' ', '<input type="submit" value="Submit" />')
);
$box .= '<form name="register_form" id="register_form" action="?register" method="post" onsubmit="return phoromatic_initial_registration(this);">' . pts_webui::r2d_array_to_table($register) . '</form>';
$box .= '<form name="register_form" id="register_form" action="?register" method="post" onsubmit="return phoromatic_initial_registration(this);">
<div style="clear: both; font-weight: bold;">
<div style="float: left; width: 25%;">Username</div>
<div style="float: left; width: 25%;">Password</div>
<div style="float: left; width: 25%;">Confirm Password</div>
<div style="float: left; width: 25%;">Email Address</div>
</div>
<div style="clear: both;">
<div style="float: left; width: 25%;"><input type="text" name="register_username" /> <sup>1</sup></div>
<div style="float: left; width: 25%;"><input type="password" name="register_password" /> <sup>2</sup></div>
<div style="float: left; width: 25%;"><input type="password" name="register_password_confirm" /></div>
<div style="float: left; width: 25%;"><input type="text" name="register_email" /> <sup>3</sup><br /><br /><input type="submit" value="Create Account" /></div>
</div>
</form>';
$box .= '<p style="font-size: 11px;"><sup>1</sup> Usernames shall be at least four characters long, not contain any spaces, and only be composed of normal ASCII characters.<br />
<sup>2</sup> Passwords shall be at least six characters long.<br />
<sup>3</sup> A valid email address is required for notifications, password reset, and other verification purposes.<br />
</p>';
$box .= '<hr /><hr />';

View File

@@ -20,6 +20,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('PHOROMATIC_USER_IS_VIEWER', !isset($_SESSION['AdminLevel']) || $_SESSION['AdminLevel'] >= 10 || $_SESSION['AdminLevel'] < 1 ? true : false);
function phoromatic_user_friendly_timedate($time)
{
return date('j F H:i', strtotime($time));
@@ -37,6 +39,10 @@ function phoromatic_webui_header($left_items, $right)
return $ret;
}
function phoromatic_get_posted_var($name, $default_value = null)
{
return isset($_POST[$name]) ? $_POST[$name] : null;
}
function phoromatic_webui_main($main, $right)
{
return '<div id="pts_phoromatic_main"><div id="pts_phoromatic_menu_right">' . $right . '</div><div id="pts_phoromatic_main_area">' . $main . '</div><div style="clear: both;"></div></div>';
@@ -52,10 +58,28 @@ function phoromatic_webui_footer()
<p style="margin: 6px 15px;">Copyright &copy; 2008 - ' . date('Y') . ' by <a href="http://www.phoronix-media.com/">Phoronix Media</a>. All rights reserved.<br />
All trademarks used are properties of their respective owners.<br />' . pts_title(true) . ' - Core Version ' . PTS_CORE_VERSION . ' - PHP ' . PHP_VERSION . '</p></div>';
}
function phoromatic_add_activity_stream_event($activity_event, $activity_event_id, $activity_event_type)
{
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_activity_stream (AccountID, ActivityTime, ActivityCreator, ActivityCreatorType, ActivityEvent, ActivityEventID, ActivityEventType) VALUES (:account_id, :activity_time, :activity_creator, :activity_creator_type, :activity_event, :activity_event_id, :activity_event_type)');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':activity_time', phoromatic_server::current_time());
$stmt->bindValue(':activity_creator', $_SESSION['UserName']);
$stmt->bindValue(':activity_creator_type', 'USER');
$stmt->bindValue(':activity_event', $activity_event);
$stmt->bindValue(':activity_event_id', $activity_event_id);
$stmt->bindValue(':activity_event_type', $activity_event_type);
return $stmt->execute();
}
function phoromatic_webui_header_logged_in()
{
$html_links = array();
$pages = array('Main', 'Systems', 'Settings', 'Schedules', 'Results');
if(isset($_SESSION['AdminLevel']) && $_SESSION['AdminLevel'] == 1)
{
array_push($pages, 'Users');
}
foreach($pages as $page)
{
if(strtolower($page) == PAGE_REQUEST)
@@ -138,7 +162,13 @@ function phoromatic_webui_right_panel_logged_in($add = null)
$result = $stmt->execute();
$row = $result->fetchArray();
$result_count = $row['ResultCount'];
$right .= '<hr /><p><strong>' . date('H:i T - j F Y') . '</strong><br />' . $system_count . ' System' . ($system_count == 1 ? '' : 's') . '<br />' . $schedule_count . ' Schedule' . ($schedule_count == 1 ? '' : 's') . '<br />' . $result_count . ' Result' . ($result_count == 1 ? '' : 's') .'<br /><a href="?logout"><strong>Log-Out</strong></a></p>';
$stmt = phoromatic_server::$db->prepare('SELECT COUNT(ActivityTime) AS ActivityCount FROM phoromatic_activity_stream WHERE AccountID = :account_id AND ActivityTime LIKE :today_date');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$stmt->bindValue(':today_date', date('Y-m-d') . '%');
$result = $stmt->execute();
$row = $result->fetchArray();
$activity_count = $row['ActivityCount'];
$right .= '<hr /><p><strong>' . date('H:i T - j F Y') . '</strong><br /><a href="?systems">' . $system_count . ' System' . ($system_count == 1 ? '' : 's') . '</a><br /><a href="?schedules">' . $schedule_count . ' Schedule' . ($schedule_count == 1 ? '' : 's') . '</a><br /><a href="?results">' . $result_count . ' Result' . ($result_count == 1 ? '' : 's') . '</a><br /><a href="?account_activity">' . $activity_count . ' Activity Events Today</a><br /><a href="?logout"><strong>Log-Out</strong></a></p>';
return $right;
}
@@ -178,6 +208,7 @@ function phoromatic_error_page($title, $description)
}
function phoromatic_systems_needing_attention()
{
$main = null;
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, State, LastIP, LocalIP, LastCommunication FROM phoromatic_systems WHERE AccountID = :account_id AND State = 0 ORDER BY LastCommunication DESC');
$stmt->bindValue(':account_id', $_SESSION['AccountID']);
$result = $stmt->execute();

View File

@@ -0,0 +1,62 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2009 - 2014, Phoronix Media
Copyright (C) 2009 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// INIT
define('PHOROMATIC_SERVER', true);
define('REMOTE_ACCESS', true); // XXX TODO: Is this still used with new Phoromatic?
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
error_reporting(E_ALL);
include('../../pts-core.php');
pts_client::init();
if(isset($_GET['repo']))
{
// Supply the JSON repository listing to the client
if(is_file(PTS_DOWNLOAD_CACHE_PATH . 'pts-download-cache.json'))
{
readfile(PTS_DOWNLOAD_CACHE_PATH . 'pts-download-cache.json');
}
else if(is_file(PTS_SHARE_PATH . 'download-cache/pts-download-cache.json'))
{
readfile(PTS_SHARE_PATH . 'download-cache/pts-download-cache.json');
}
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested a copy of the download cache JSON');
}
else if(isset($_GET['download']))
{
$requested_file = str_replace(array('..', '/'), null, $_GET['download']);
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' is attempting to download ' . $requested_file . ' from the download cache');
if(is_file(PTS_DOWNLOAD_CACHE_PATH . $requested_file))
{
readfile(PTS_DOWNLOAD_CACHE_PATH . $requested_file);
}
else if(is_file(PTS_SHARE_PATH . 'download-cache/' . $requested_file))
{
readfile(PTS_SHARE_PATH . 'download-cache/' . $requested_file);
}
}
?>

View File

@@ -19,6 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define('PHOROMATIC_SERVER', true);
error_reporting(E_ALL);
session_start();
include('../phoromatic_functions.php');

View File

@@ -0,0 +1,88 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// INIT
define('PHOROMATIC_SERVER', true);
define('REMOTE_ACCESS', true); // XXX TODO: Is this still used with new Phoromatic?
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
//error_reporting(E_ALL);
include('../../pts-core.php');
pts_client::init();
if(isset($_GET['index']))
{
$requested_repo = str_replace(array('..', '/'), null, $_GET['repo']);
$repo_index = pts_openbenchmarking::read_repository_index($requested_repo, false);
echo $repo_index;
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' downloaded a copy of the ' . $requested_repo . ' OpenBenchmarking.org repository index');
}
else if(isset($_GET['repos']))
{
$index_files = pts_file_io::glob(PTS_OPENBENCHMARKING_SCRATCH_PATH . '*.index');
$json_repos = array();
foreach($index_files as $index_file)
{
$index_data = json_decode(file_get_contents($index_file), true);
$json_repos['repos'][basename($index_file, '.index')] = array(
'title' => basename($index_file, '.index'),
'generated' => $index_data['main']['generated'],
);
}
echo json_encode($json_repos);
}
else if(isset($_GET['test']))
{
$repo = str_replace(array('..', '/'), null, $_GET['repo']);
$test = str_replace(array('..', '/'), null, $_GET['test']);
if(pts_openbenchmarking::is_repository($repo))
{
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested a copy of the ' . $repo . '/' . $test . ' test profile');
$realpath_file = realpath(PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo . '/' . $test . '.zip');
if(is_file($realpath_file) && strpos($realpath_file, PTS_OPENBENCHMARKING_SCRATCH_PATH) === 0)
{
echo base64_encode(file_get_contents($realpath_file));
}
}
}
else if(isset($_GET['suite']))
{
$repo = str_replace(array('..', '/'), null, $_GET['repo']);
$test = str_replace(array('..', '/'), null, $_GET['test']);
if(pts_openbenchmarking::is_repository($repo))
{
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested a copy of the ' . $repo . '/' . $test . ' test suite');
$realpath_file = realpath(PTS_OPENBENCHMARKING_SCRATCH_PATH . $repo . '/' . $test . '.zip');
if(is_file($realpath_file) && strpos($realpath_file, PTS_OPENBENCHMARKING_SCRATCH_PATH) === 0)
{
echo base64_encode(file_get_contents($realpath_file));
}
}
}
?>

View File

@@ -19,24 +19,24 @@ div#pts_phoromatic_top_header
linear,
left top,
left bottom,
color-stop(0, #065695),
color-stop(1, #043e6d)
color-stop(0, #0983E0),
color-stop(1, #076DBA)
);
background-image: -o-linear-gradient(bottom, #065695 0%, #043e6d 100%);
background-image: -moz-linear-gradient(bottom, #065695 0%, #043e6d 100%);
background-image: -webkit-linear-gradient(bottom, #065695 0%, #043e6d 100%);
background-image: -ms-linear-gradient(bottom, #065695 0%, #043e6d 100%);
background-image: linear-gradient(to bottom, #065695 0%, #043e6d 100%);
border: #000 1px solid;
background-image: -o-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -moz-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -webkit-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -ms-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: linear-gradient(to bottom, #0983E0 0%, #076DBA 100%);
border: #1F1F1F 1px solid;
border-top-left-radius: 14px;
border-bottom-left-radius: 14px;
border-top-right-radius: 14px;
overflow: hidden;
line-height: 78px;
line-height: 80px;
margin: 20px 20px 0;
box-shadow: 1px 1px 4px #000;
-moz-box-shadow: 1px 1px 4px #000;
-webkit-box-shadow: 1px 1px 4px #000;
box-shadow: 1px 1px 4px #1F1F1F;
-moz-box-shadow: 1px 1px 4px #1F1F1F;
-webkit-box-shadow: 1px 1px 4px #1F1F1F;
}
div#pts_phoromatic_top_header input, div#pts_phoromatic_top_header button
{
@@ -44,8 +44,19 @@ div#pts_phoromatic_top_header input, div#pts_phoromatic_top_header button
}
div#pts_phoromatic_bottom_footer
{
background: #272727;
border: #000 1px solid;
background-image: -webkit-gradient(
linear,
left top,
left bottom,
color-stop(0, #0983E0),
color-stop(1, #076DBA)
);
background-image: -o-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -moz-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -webkit-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: -ms-linear-gradient(bottom, #0983E0 0%, #076DBA 100%);
background-image: linear-gradient(to bottom, #0983E0 0%, #076DBA 100%);
border: #1F1F1F 1px solid;
border-bottom-left-radius: 14px;
border-bottom-right-radius: 14px;
border-top-left-radius: 14px;
@@ -54,15 +65,15 @@ div#pts_phoromatic_bottom_footer
overflow: hidden;
font-size: 55%;
line-height: 150%;
color: #BDBDBD;
color: #E0E0E0;
margin: 0 20px 20px;
box-shadow: 1px 1px 4px #000;
-moz-box-shadow: 1px 1px 4px #000;
-webkit-box-shadow: 1px 1px 4px #000;
box-shadow: 1px 1px 4px #1F1F1F;
-moz-box-shadow: 1px 1px 4px #1F1F1F;
-webkit-box-shadow: 1px 1px 4px #1F1F1F;
}
div#pts_phoromatic_bottom_footer a img
{
opacity: 0.5;
opacity: 0.6;
}
div#pts_phoromatic_bottom_footer a:hover img
{
@@ -92,8 +103,8 @@ div#pts_phoromatic_top_header ul
div#pts_phoromatic_top_header ul li u
{
text-decoration: none;
color: #DDD;
border-bottom: 1px solid #DDD;
color: #E0E0E0;
border-bottom: 1px solid #E0E0E0;
padding-bottom: 6px;
}
div#pts_phoromatic_top_header ul li
@@ -106,7 +117,7 @@ div#pts_phoromatic_top_header ul li
}
div#pts_phoromatic_top_header ul li a:hover
{
color: #CCC;
color: #E0E0E0;
text-shadow: -1px 0 #000, 0 1px #000, 1px 0 #000, 0 -1px #000;
}
div#pts_phoromatic_menu_right p
@@ -121,14 +132,14 @@ div#pts_phoromatic_menu_right
linear,
left top,
right top,
color-stop(0, #065695),
color-stop(1, #043e6d)
color-stop(0, #0983E0),
color-stop(1, #076DBA)
);
background-image: -o-linear-gradient(left, #065695 0%, #043e6d 100%);
background-image: -moz-linear-gradient(left, #065695 0%, #043e6d 100%);
background-image: -webkit-linear-gradient(left, #065695 0%, #043e6d 100%);
background-image: -ms-linear-gradient(left, #065695 0%, #043e6d 100%);
background-image: linear-gradient(to left, #065695 0%, #043e6d 100%);
background-image: -o-linear-gradient(left, #0983E0 0%, #076DBA 100%);
background-image: -moz-linear-gradient(left, #0983E0 0%, #076DBA 100%);
background-image: -webkit-linear-gradient(left, #0983E0 0%, #076DBA 100%);
background-image: -ms-linear-gradient(left, #0983E0 0%, #076DBA 100%);
background-image: linear-gradient(to left, #0983E0 0%, #076DBA 100%);
width: 15%;
height: 100%;
float: right;
@@ -138,9 +149,9 @@ div#pts_phoromatic_menu_right
color: #e4e4e4;
margin: 0 0 -2500px;
padding-bottom: 2500px;
box-shadow: 1px 1px 4px #000;
-moz-box-shadow: 1px 1px 4px #000;
-webkit-box-shadow: 1px 1px 4px #000;
box-shadow: 1px 1px 4px #1F1F1F;
-moz-box-shadow: 1px 1px 4px #1F1F1F;
-webkit-box-shadow: 1px 1px 4px #1F1F1F;
}
div#pts_phoromatic_menu_right ul
{
@@ -167,9 +178,9 @@ div#pts_phoromatic_menu_right ul li a:hover, div#pts_phoromatic_menu_right p a:h
}
div#pts_phoromatic_menu_right hr
{
border: #949494 1px solid;
border: #E0E0E0 1px solid;
border-width: 0 0 1px 0;
background-color: #949494;
background-color: #E0E0E0;
width: 96%;
height: 1px;
opacity: 0.5;
@@ -182,8 +193,6 @@ div#pts_phoromatic_main_box
{
margin: 0 20px;
padding: 30px 0;
border: #eee 1px solid;
border-width: 0 1px 0 0;
}
div#pts_phoromatic_main_box hr
{
@@ -193,16 +202,15 @@ div#pts_phoromatic_main_box hr
}
div#pts_phoromatic_main_box_inside
{
width: 90%;
margin: 0 auto;
padding: 10px 20px;
background: #e4e4e4;
border: #000 1px solid;
background: #f5f5f5;
border: #1F1F1F 1px solid;
border-radius: 14px;
min-height: 500px;
box-shadow: 1px 1px 4px #000;
-moz-box-shadow: 1px 1px 4px #000;
-webkit-box-shadow: 1px 1px 4px #000;
box-shadow: 1px 1px 4px #1F1F1F;
-moz-box-shadow: 1px 1px 4px #1F1F1F;
-webkit-box-shadow: 1px 1px 4px #1F1F1F;
}
div#pts_phoromatic_main
{
@@ -216,7 +224,7 @@ div#pts_phoromatic_main_area
min-height: 1000px;
background: #FFF;
overflow: hidden;
color: #555555;
color: #555;
margin: 5px 5px -1000px 0;
padding-bottom: 1000px;
}
@@ -252,7 +260,7 @@ div#pts_phoromatic_main_area h2 a
}
div#pts_phoromatic_main_area h2 a.phx_alt
{
color: #FF0000;
color: #e08a09;
}
div#pts_phoromatic_main_area h2 a:hover
{
@@ -285,6 +293,17 @@ div#pts_phoromatic_main_area hr
height: 1px;
margin: 20px 0;
}
div#pts_phoromatic_main_area ol
{
list-style: none;
margin: 10px 10px 20px 0;
padding: 0;
}
div#pts_phoromatic_main_area ol li
{
margin: 0 0 10px;
}
div#pts_phoromatic_main_area p a, div#pts_phoromatic_main_area a, div#pts_phoromatic_main_area h6 a, div#pts_phoromatic_main_area h5 a, div#pts_phoromatic_main_box p a
{
color: #e08a09;
@@ -321,7 +340,7 @@ div.pts_phoromatic_info_box_area ul:last-child a:last-child li
div.pts_phoromatic_info_box_area ul h1
{
font-size: 120%;
color: #212121;
color: #1F1F1F;
margin: 1px 0;
font-weight: normal;
text-align: center;
@@ -338,53 +357,104 @@ div.pts_phoromatic_info_box_area ul a li, div.pts_phoromatic_info_box_area ul li
}
div.pts_phoromatic_info_box_area ul a li em
{
color: #076DBA;
font-size: 80%;
font-weight: normal;
}
div.pts_phoromatic_info_box_area ul a li em strong
{
text-transform: uppercase;
}
div#pts_phoromatic_main_area div.pts_phoromatic_info_box_area ul a:hover li, div#pts_phoromatic_main_area div.pts_phoromatic_info_box_area ul:hover a
{
background: #d2d2d2;
background: #E0E0E0;
text-decoration: none;
}
input[type=submit]
{
font-weight: bold;
}
input, select, textarea, checkbox
input, select, textarea, checkbox, button
{
border: solid #000 1px;
background-color: #edd2ab;
color: #000;
border: solid #1F1F1F 1px;
background-color: #E0E0E0;
color: #1F1F1F;
padding: 4px 10px;
border-radius: 10px;
box-shadow: 1px 1px 4px #222;
-moz-box-shadow: 1px 1px 4px #222;
-webkit-box-shadow: 1px 1px 4px #222;
transition: all 0.3s;
}
button
textarea
{
border: solid #000 1px;
background-color: #272727;
color: #E08A09;
font-weight: bold;
}
input:focus, textarea:focus
{
background: #666; color: #FFF;
}
table.pts_phoromatic_schedule_type
{
padding: 10px 0;
}
table.pts_phoromatic_schedule_type td
table.pts_phoromatic_schedule_type td, table.pts_phoromatic_schedule_type tr:nth-child(odd) td
{
border: 5px solid transparent;
border-width: 0 5px;
border-collapse: collapse;
background: #f1f1f1;
border: solid #d2d2d2 1px;
padding: 2px 10px;
}
table.pts_phoromatic_schedule_type tr td:first-child
{
vertical-align: top;
background: #f1f1f1;
border: solid #d2d2d2 1px;
padding: 2px 10px;
max-width: 20%;
}
table.pts_phoromatic_schedule_type tr td:last-child
{
min-width: 80%;
}
table.pts_phoromatic_schedule_type tr:hover td
{
background: inherit;
color: inherit;
}
table
{
color: #333;
border-collapse: collapse;
border-spacing: 0;
margin-bottom: 10px;
}
td, th
{
border: 1px solid transparent;
transition: all 0.2s;
}
th
{
background: #DFDFDF;
font-weight: bold;
padding: 2px 6px;
text-align: left;
}
td
{
background: #FAFAFA;
padding: 0 4px;
}
tr:nth-child(even) td
{
background: #F1F1F1;
}
tr:nth-child(odd) td
{
background: #FEFEFE;
}
tr:hover td
{
background: #666;
color: #FFF;
}

View File

@@ -1,3 +1,47 @@
var phoromatic_results_clicked = new Array();
function phoromatic_click_results(new_id)
{
if(phoromatic_results_clicked.indexOf(new_id) != -1)
{
window.location.href = "?result/" + new_id;
}
else
{
document.getElementById("result_select_" + new_id).style.background = "#949494";
phoromatic_results_clicked.push(new_id);
}
var new_button_area = "<p>";
if(phoromatic_results_clicked.length > 0)
{
var plurality = "";
if(phoromatic_results_clicked.length > 1)
plurality = "s";
new_button_area += " <button type=\"button\" onclick=\"javascript:phoromatic_delete_results();\">Delete Result" + plurality + "</button>";
new_button_area += " <button type=\"button\" onclick=\"javascript:phoromatic_compare_results();\">Compare Result" + plurality + "</button>";
}
new_button_area += "</p>";
document.getElementById("pts_phoromatic_bottom_result_button_area").innerHTML = new_button_area;
document.getElementById("pts_phoromatic_top_result_button_area").innerHTML = new_button_area;
}
function phoromatic_compare_results()
{
if(phoromatic_results_clicked.length > 1)
{
window.location.href = "?result/" + phoromatic_results_clicked.join(",");
}
}
function phoromatic_delete_results()
{
if(phoromatic_results_clicked.length > 0 && confirm("Press OK to delete these results!"))
{
window.location.href = "?results/delete/" + phoromatic_results_clicked.join(",");
}
}
function phoromatic_initial_registration(form)
{
if(form.register_username.value.length < 4 || form.register_username.value.indexOf(" ") != -1)

View File

@@ -39,10 +39,12 @@ $environmental_variables = array(
'a' => 'ACTIVITY',
'r' => 'REQUEST',
'pts' => 'CLIENT_VERSION',
'pts_core' => 'CLIENT_CORE_VERSION',
'h' => 'CLIENT_HARDWARE',
's' => 'CLIENT_SOFTWARE',
'i' => 'ID',
'o' => 'OTHER',
'nm' => 'NETWORK_CLIENT_MAC',
'n' => 'HOSTNAME',
'ti' => 'TEST_IDENTIFIER',
'ts' => 'TRIGGER_STRING',
@@ -50,7 +52,13 @@ $environmental_variables = array(
'c' => 'COMPOSITE_XML',
'ob' => 'OPENBENCHMARKING_ID',
'sched' => 'SCHEDULE_ID',
'lip' => 'LOCAL_IP'
'lip' => 'LOCAL_IP',
'composite_xml' => 'COMPOSITE_XML',
'composite_xml_gz' => 'COMPOSITE_XML_GZ',
'composite_xml_hash' => 'COMPOSITE_XML_HASH',
'system_logs_zip' => 'SYSTEM_LOGS_ZIP',
'system_logs_hash' => 'SYSTEM_LOGS_HASH',
'msi' => 'PTS_MACHINE_SELF_ID',
);
foreach($environmental_variables as $get_var => $to_var)
@@ -65,9 +73,10 @@ foreach($environmental_variables as $get_var => $to_var)
}
}
if($GSID == null || $ACCOUNT_ID == null)
if($CLIENT_CORE_VERSION < 5312)
{
$json['phoromatic']['error'] = 'Invalid Credentials';
// Due to major PTS 5.4 development changes, client version bump will be necessary
$json['phoromatic']['error'] = 'You must update your Phoronix Test Suite clients for compatibility with this Phoromatic server.';
echo json_encode($json);
exit;
}
@@ -75,6 +84,30 @@ if($GSID == null || $ACCOUNT_ID == null)
// DATABASE SETUP
phoromatic_server::prepare_database();
if($ACCOUNT_ID == null && $PTS_MACHINE_SELF_ID != null)
{
// Try to find the account
$stmt = phoromatic_server::$db->prepare('SELECT AccountID FROM phoromatic_systems WHERE MachineSelfID = :machine_self_id');
$stmt->bindValue(':machine_self_id', $PTS_MACHINE_SELF_ID);
$result = $stmt->execute();
if(!empty($result))
{
$result = $result->fetchArray();
$ACCOUNT_ID = $result['AccountID'];
$json['phoromatic']['account_id'] = $result['AccountID'];
echo json_encode($json);
exit;
}
}
if(($GSID == null && $PTS_MACHINE_SELF_ID == null) || $ACCOUNT_ID == null)
{
$json['phoromatic']['error'] = 'Invalid Credentials';
echo json_encode($json);
exit;
}
// CHECK FOR VALID ACCOUNT
$stmt = phoromatic_server::$db->prepare('SELECT AccountID FROM phoromatic_accounts WHERE AccountID = :account_id');
$stmt->bindValue(':account_id', $ACCOUNT_ID);
@@ -92,11 +125,27 @@ define('ACCOUNT_ID', $ACCOUNT_ID);
// CHECK IF SYSTEM IS ALREADY CONNECTED TO THE ACCOUNT
// self::$db->exec('CREATE TABLE phoromatic_systems (AccountID TEXT UNIQUE, SystemID TEXT UNIQUE, Title TEXT, Description TEXT, Groups TEXT Hardware TEXT, Software TEXT, ClientVersion TEXT, GSID TEXT, CurrentTask TEXT, EstimatedTimeForTask TEXT, CreatedOn TEXT, LastCommunication TEXT, LastIP TEXT, LocalIP TEXT)');
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Groups, State FROM phoromatic_systems WHERE AccountID = :account_id AND GSID = :gsid');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':gsid', $GSID);
$result = $stmt->execute();
$result = $result->fetchArray();
if($PTS_MACHINE_SELF_ID != null)
{
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Groups, State FROM phoromatic_systems WHERE AccountID = :account_id AND MachineSelfID = :machine_self_id');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':machine_self_id', $PTS_MACHINE_SELF_ID);
$result = $stmt->execute();
$result = $result->fetchArray();
}
if(!isset($result) || empty($result))
{
// TODO XXX: This block of code can be dropped when doing away with older PTS client support... pre-5.4 support
// See if before the client was connecting from an older PTS version without a MachineSelfID....
$stmt = phoromatic_server::$db->prepare('SELECT Title, SystemID, Groups, State FROM phoromatic_systems WHERE AccountID = :account_id AND GSID = :gsid AND MachineSelfID = :machine_self_id');
$stmt->bindValue(':account_id', ACCOUNT_ID);
$stmt->bindValue(':gsid', $GSID);
$stmt->bindValue(':machine_self_id', null);
$result = $stmt->execute();
$result = $result->fetchArray();
}
if(empty($result))
{
// APPARENT FIRST TIME FOR THIS SYSTEM CONNECTING TO THIS ACCOUNT
@@ -106,7 +155,7 @@ if(empty($result))
$matching_system = phoromatic_server::$db->querySingle('SELECT AccountID FROM phoromatic_systems WHERE SystemID = \'' . $system_id . '\'');
}
while(!empty($matching_system));
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_systems (AccountID, SystemID, Hardware, Software, ClientVersion, GSID, CurrentTask, CreatedOn, LastCommunication, LastIP, LocalIP, Title, State) VALUES (:account_id, :system_id, :client_hardware, :client_software, :client_version, :gsid, \'Awaiting Authorization\', :current_time, :current_time, :access_ip, :local_ip, :title, 0)');
$stmt = phoromatic_server::$db->prepare('INSERT INTO phoromatic_systems (AccountID, SystemID, Hardware, Software, ClientVersion, GSID, CurrentTask, CreatedOn, LastCommunication, LastIP, LocalIP, Title, State, MachineSelfID) VALUES (:account_id, :system_id, :client_hardware, :client_software, :client_version, :gsid, \'Awaiting Authorization\', :current_time, :current_time, :access_ip, :local_ip, :title, 0, :machine_self_id)');
$stmt->bindValue(':account_id', $ACCOUNT_ID);
$stmt->bindValue(':system_id', $system_id);
$stmt->bindValue(':client_hardware', $CLIENT_HARDWARE);
@@ -117,6 +166,7 @@ if(empty($result))
$stmt->bindValue(':local_ip', $LOCAL_IP);
$stmt->bindValue(':title', $HOSTNAME);
$stmt->bindValue(':current_time', phoromatic_server::current_time());
$stmt->bindValue(':machine_self_id', $PTS_MACHINE_SELF_ID);
$result = $stmt->execute();
$json['phoromatic']['response'] = 'Information Added; Waiting For Approval From Administrator.';
echo json_encode($json);
@@ -128,7 +178,7 @@ define('SYSTEM_GROUPS', $result['Groups']);
$SYSTEM_STATE = $result['State'];
define('GSID', $GSID);
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET LastIP = :access_ip, LocalIP = :local_ip, LastCommunication = :current_time, Hardware = :client_hardware, Software = :client_software, ClientVersion = :client_version WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt = phoromatic_server::$db->prepare('UPDATE phoromatic_systems SET LastIP = :access_ip, LocalIP = :local_ip, LastCommunication = :current_time, Hardware = :client_hardware, Software = :client_software, ClientVersion = :client_version, MachineSelfID = :machine_self_id, NetworkMAC = :network_mac WHERE AccountID = :account_id AND SystemID = :system_id');
$stmt->bindValue(':account_id', $ACCOUNT_ID);
$stmt->bindValue(':system_id', SYSTEM_ID);
$stmt->bindValue(':client_hardware', $CLIENT_HARDWARE);
@@ -137,6 +187,8 @@ $stmt->bindValue(':client_version', $CLIENT_VERSION);
$stmt->bindValue(':access_ip', $_SERVER['REMOTE_ADDR']);
$stmt->bindValue(':local_ip', $LOCAL_IP);
$stmt->bindValue(':current_time', phoromatic_server::current_time());
$stmt->bindValue(':machine_self_id', $PTS_MACHINE_SELF_ID);
$stmt->bindValue(':network_mac', $NETWORK_CLIENT_MAC);
$stmt->execute();
//echo phoromatic_server::$db->lastErrorMsg();
if($SYSTEM_STATE < 1)

View File

@@ -0,0 +1,52 @@
<?php
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2014, Phoronix Media
Copyright (C) 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if(isset($_GET['phoromatic_info']))
{
define('PHOROMATIC_SERVER', true);
define('REMOTE_ACCESS', true); // XXX TODO: Is this still used with new Phoromatic?
//ini_set('memory_limit', '64M');
define('PTS_MODE', 'WEB_CLIENT');
define('PTS_AUTO_LOAD_OBJECTS', true);
error_reporting(E_ALL);
include('../../pts-core.php');
pts_client::init();
$json_info = array(
'http_server' => $_SERVER['SERVER_SOFTWARE'],
'pts' => pts_title(),
'pts_core' => PTS_CORE_VERSION,
'ws_port' => getenv('PTS_WEBSOCKET_PORT'),
'download_cache' => '/download-cache.php',
'openbenchmarking_cache' => '/openbenchmarking-cache.php',
);
echo json_encode($json_info);
pts_logger::add_to_log($_SERVER['REMOTE_ADDR'] . ' requested the Phoromatic Server deployment details');
}
else
{
include('../../pts-core.php');
echo pts_title(true) . ' Phoromatic Server [' . $_SERVER['SERVER_SOFTWARE'] . ']';
}
?>

View File

@@ -34,7 +34,10 @@ if(!defined('PTS_MODE'))
}
// Any PHP default memory limit should be fine for PTS, until you run image quality comparison tests that begins to consume memory
ini_set('memory_limit', '256M');
if(stripos(phpversion(), 'hhvm') === false)
{
ini_set('memory_limit', '256M');
}
if(getenv('PTS_MODE') == 'CLIENT' && ini_get('open_basedir') != false)
{

View File

@@ -137,9 +137,9 @@ function pts_version_codenames()
);
}
pts_define('PTS_VERSION', '5.2.1');
pts_define('PTS_CORE_VERSION', 5210);
pts_define('PTS_CODENAME', 'KHANINO');
pts_define('PTS_VERSION', '5.4.0m3');
pts_define('PTS_CORE_VERSION', 5330);
pts_define('PTS_CODENAME', 'LIPKI');
pts_define('PTS_IS_CLIENT', (defined('PTS_MODE') && strstr(PTS_MODE, 'CLIENT') !== false));
pts_define('PTS_IS_WEB_CLIENT', (defined('PTS_MODE') && PTS_MODE == 'WEB_CLIENT'));
pts_define('PTS_IS_DEV_BUILD', (substr(PTS_VERSION, -2, 1) == 'm'));

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Phoronix Test Suite Phoromatic Client
After=syslog.target
After=network.target
[Service]
TimeoutStartSec=300
ExecStart=/usr/bin/phoronix-test-suite phoromatic.connect
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,13 @@
[Unit]
Description=Phoronix Test Suite Phoromatic Server
After=syslog.target
After=network.target
[Service]
TimeoutStartSec=300
ExecStart=/usr/bin/phoronix-test-suite start-phoromatic-server
[Install]
WantedBy=multi-user.target

View File

@@ -3,8 +3,8 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2013, Phoronix Media
Copyright (C) 2008 - 2013, Michael Larabel
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008 - 2014, Michael Larabel
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,6 +26,12 @@ if(!is_executable("phoronix-test-suite") || !is_dir("pts-core/"))
echo "Example: php5 pts-core/static/scripts/package-build-deb.php\n";
exit(0);
}
if(!is_executable('/usr/bin/dpkg'))
{
echo PHP_EOL . "dpkg must be present on the system to generate the phoronix-test-suite Debian package." . PHP_EOL . PHP_EOL;
exit;
}
@require("pts-core/pts-core.php");
if(!defined("PTS_VERSION"))

View File

@@ -3,7 +3,7 @@
/*
Phoronix Test Suite
URLs: http://www.phoronix.com, http://www.phoronix-test-suite.com/
Copyright (C) 2008 - 2011, Phoronix Media
Copyright (C) 2008 - 2014, Phoronix Media
Copyright (C) 2008, Andrew Schofield
This program is free software; you can redistribute it and/or modify
@@ -20,12 +20,18 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if(!is_file("phoronix-test-suite") || !is_dir("pts/") || !is_dir("pts-core/"))
if(!is_file("phoronix-test-suite") || !is_dir("pts-core/"))
{
echo "\nYou must run this script from the root directory of the phoronix-test-suite/ folder!\n";
echo "Example: php5 pts-core/scripts/package-build-rpm.php\n";
exit(0);
}
if(!is_executable('/usr/bin/rpmbuild'))
{
echo PHP_EOL . "rpmbuild must be present on the system. Try: yum install rpm-build." . PHP_EOL . PHP_EOL;
exit;
}
@require("pts-core/pts-core.php");
if(!defined("PTS_VERSION"))
@@ -48,7 +54,7 @@ $spec_file .= "Group: Utilities\n";
$spec_file .= "URL: http://www.phoronix-test-suite.com/\n";
$spec_file .= "Source: phoronix-test-suite-" . PTS_VERSION . ".tar.bz2\n";
$spec_file .= "Packager: Phoronix Media <trondheim-pts@phoronix-test-suite.com>\n";
$spec_file .= "Requires: php-cli, php-gd\n";
$spec_file .= "Requires: php-cli, php-xml\n";
$spec_file .= "BuildArch: noarch\n";
$spec_file .= "BuildRoot: %{_tmppath}/%{name}-%{version}-root\n";
$spec_file .= "%description\n";
@@ -65,18 +71,25 @@ $spec_file .= "rm -rf %{buildroot}\n";
$spec_file .= "%files\n";
$spec_file .= "%{_bindir}/phoronix-test-suite\n";
$spec_file .= "%{_datadir}/phoronix-test-suite/*\n";
$spec_file .= "%{_datadir}/applications/*\n";
$spec_file .= "%{_datadir}/icons/hicolor/*\n";
$spec_file .= "%{_datadir}/appdata/%{name}.appdata.xml\n";
$spec_file .= "%{_datadir}/doc/*\n";
$spec_file .= "%{_mandir}/man1/%{name}.1*\n";
$spec_file .= "%config(noreplace) %{_sysconfdir}/bash_completion.d\n";
$spec_file .= "%config(noreplace) %{_sysconfdir}/systemd/system/*\n";
$spec_file .= "%config(noreplace) %{_sysconfdir}/init/*\n";
$spec_file .= "%changelog\n";
$spec_file .= "* Fri Jun 06 2008 Andrew Schofield <andrew_s@fahmon.net>\n";
$spec_file .= "* " . date('D M d Y') . " Phoronix Media <phoronix@phoronix.com>\n";
$spec_file .= "- Initial release.";
file_put_contents("/tmp/pts-rpm-builder/SPECS/pts.spec", $spec_file);
shell_exec("mv -f " . pts_client::user_home_directory() . ".rpmmacros /tmp/pts-rpm-builder");
file_put_contents(pts_client::user_home_directory() .".rpmmacros", "%_topdir /tmp/pts-rpm-builder");
shell_exec("mv -f " . getenv('HOME') . "/.rpmmacros /tmp/pts-rpm-builder 2>&1");
file_put_contents(getenv('HOME') ."/.rpmmacros", "%_topdir /tmp/pts-rpm-builder");
shell_exec("rpmbuild -ba --verbose /tmp/pts-rpm-builder/SPECS/pts.spec");
shell_exec("cp /tmp/pts-rpm-builder/RPMS/noarch/phoronix-test-suite-" . PTS_VERSION . "-1.noarch.rpm ./");
shell_exec("rm -f " . pts_client::user_home_directory() . "/.rpmmacros");
shell_exec("mv -f /tmp/pts-rpm-builder/.rpmmacros " . pts_client::user_home_directory());
shell_exec("rm -f " . getenv('HOME') . "/.rpmmacros");
shell_exec("mv -f /tmp/pts-rpm-builder/.rpmmacros " . getenv('HOME') . ' 2>1');
shell_exec("rm -rf /tmp/pts-rpm-builder");
?>

View File

@@ -0,0 +1,11 @@
description "Phoronix Test Suite Phoromatic Client"
author "Phoronix Media"
start on started network
start on stopped load-modules ok
stop on stopping network
stop on starting shutdown
console output
exec /usr/bin/phoronix-test-suite phoromatic.client

View File

@@ -0,0 +1,11 @@
description "Phoronix Test Suite Phoromatic Server"
author "Phoronix Media"
start on started network
start on stopped load-modules ok
stop on stopping network
stop on starting shutdown
console output
exec /usr/bin/phoronix-test-suite start-phoromatic-server

View File

@@ -13,6 +13,7 @@
<DefaultBrowser></DefaultBrowser>
<UsePhodeviCache>TRUE</UsePhodeviCache>
<DefaultDisplayMode>DEFAULT</DefaultDisplayMode>
<PhoromaticServers></PhoromaticServers>
</General>
<Modules>
<LoadModules>toggle_screensaver, update_checker, graphics_event_checker</LoadModules>
@@ -55,6 +56,7 @@
<Configured>FALSE</Configured>
</BatchMode>
<Networking>
<NoInternetCommunication>FALSE</NoInternetCommunication>
<NoNetworkCommunication>FALSE</NoNetworkCommunication>
<Timeout>20</Timeout>
<ProxyAddress></ProxyAddress>
@@ -64,6 +66,7 @@
<RemoteAccessPort>-1</RemoteAccessPort>
<Password></Password>
<WebSocketPort></WebSocketPort>
<AdvertiseServiceZeroConf>TRUE</AdvertiseServiceZeroConf>
</Server>
</Options>
</PhoronixTestSuite>

View File

@@ -25,6 +25,8 @@
<p>If this option is set to <em>TRUE</em>, the Phoronix Test Suite will use the Phodevi smart cache (if available). The Phodevi smart cache will automatically cache relevant system hardware/software attributes that can be safely stored and will be used until the system's software/hardware has changed or the system rebooted. Enabling this option will speed up the detection of installed hardware and software through the Phoronix Test Suite. If this option is set to <em>FALSE</em>, Phodevi will not generate a smart cache. The default value is <em>TRUE</em>.</p>
<h3>DefaultDisplayMode: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/General/DefaultDisplayMode" /></span></h3>
<p>This option affects how text is displayed on the command-line interface during the testing process. If this option is set to <em>DEFAULT</em>, the text interface will be the traditional Phoronix Test Suite output. If this option is set to <em>CONCISE</em>, the display mode is shorter and more concise. This is the default mode used during batch testing. The default value is <em>DEFAULT</em>.</p>
<h3>PhoromaticServers: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/General/PhoromaticServers" /></span></h3>
<p>This option can be used to specify the IP address(es) and port(s) of any Phoromatic Servers you wish to connect to for obtaining cached data, connecting to Phoromatic as a client test system, etc. The Phoronix Test Suite will attempt zero-conf network discovery but if that fails you can add the <em>IP:port</em> (the Phoromatic Server's HTTP port) to this element for targeted probing by the Phoronix Test Suite. Multiple Phoromatic Servers can be added if delimited by a comma; e.g. <em>IP:port,IP:port, IP:port</em>.</p>
<h1>Modules Options</h1>
<h3>LoadModules: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Modules/LoadModules" /></span></h3>
@@ -86,8 +88,10 @@
<p>If this option is set to <em>TRUE</em>, when running in batch mode the user will be prompted to enter a test name. If this option is set to <em>FALSE</em>, a test name will be automatically generated.</p>
<h1>Networking Options</h1>
<h3>NoInternetCommunication: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Networking/NoInternetCommunication" /></span></h3>
<p>If you wish to disable Internet communication within the Phoronix Test Suite by default, set this option to <em>TRUE</em>. The default value is <em>FALSE</em>. Setting this to <em>FALSE</em> will still allow Phoromatic to communicate with network servers such as for intranet-based download caches or a Phoromatic Server. Internet support is generally required for downloading test profiles from OpenBenchmarking.org, acquiring necessary test files from their respective sources, etc.</p>
<h3>NoNetworkCommunication: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Networking/NoNetworkCommunication" /></span></h3>
<p>If you wish to disable network support entirely within the Phoronix Test Suite, set this option to <em>TRUE</em>. The default value is <em>FALSE</em>.</p>
<p>If you wish to disable network support (including Internet access) entirely within the Phoronix Test Suite, set this option to <em>TRUE</em>. The default value is <em>FALSE</em>.</p>
<h3>Timeout: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Networking/Timeout" /></span></h3>
<p>This is the read timeout (in seconds) for network connections. The default value is <em>20</em>.</p>
<h3>ProxyAddress: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Networking/ProxyAddress" /></span></h3>
@@ -102,7 +106,8 @@
<p>If you wish to require a password when entering the web-based interface to the Phoronix Test Suite -- either locally or remotely -- specify the password here using the password's SHA256 sum as the value.</p>
<h3>WebSocketPort: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Server/WebSocketPort" /></span></h3>
<p>The default port to use when running a WebSocket server. If no port is assigned, a random port will be chosen.</p>
<h3>AdvertiseServiceZeroConf: <span style="color: #CC0000;"><xsl:value-of select="PhoronixTestSuite/Options/Server/AdvertiseServiceZeroConf" /></span></h3>
<p>If this option is set to <em>TRUE</em> when starting a Phoromatic Server instance, the software will attempt to broadcast its service using zeroconf networking (Avahi on Linux assuming <em>avahi-publish</em> is present).</p>
</div>
<div style="text-align: center; font-size: 12px;">Copyright &#xA9; 2008 - 2014 by <a href="http://www.phoronix-media.com/" style="text-decoration: none; color: #000;">Phoronix Media</a>.</div>
</body>