Last active
August 3, 2026 16:26
-
-
Save geerlingguy/570e13f4f81a40a5395688667b1f79af to your computer and use it in GitHub Desktop.
SBC Benchmark Suite - Phoronix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # | |
| # Benchmark script for SBCs (Debian or Ubuntu). | |
| # | |
| # WARNING: This script is meant to be run as the root user. | |
| # This script should never be run on a system/partition you | |
| # care about. You should only run this on a system that you | |
| # intend to use only for benchmarking and can reinstall or | |
| # re-flash easily. | |
| # | |
| # It's a good idea to make sure your system is updated prior | |
| # to running this script: | |
| # | |
| # sudo apt-get update | |
| # sudo apt-get dist-upgrade -y | |
| # | |
| # Usage: | |
| # sudo ./pi-general-benchmark.sh | |
| # | |
| # PTS is cloned from git master, since the last tagged release | |
| # (10.8.4, from 2022) predates fixes for newer PHP releases. To | |
| # pin a specific ref (tag, branch, or commit) instead: | |
| # sudo PTS_REF="v10.8.4" ./pi-general-benchmark.sh | |
| # Fail on error. | |
| set -e | |
| # Allow the PTS git ref to be overridden. | |
| PTS_REF="${PTS_REF:-master}" | |
| # Set this to "~/.phoronix-test-suite" if not running as root. | |
| PHORONIX_CONFIG_PATH="/var/lib/phoronix-test-suite" | |
| # Verify script is running as root. | |
| if [ "$EUID" -ne 0 ] | |
| then echo "Please run this script as root (e.g. with sudo)." | |
| exit | |
| fi | |
| # Change directories into home folder. | |
| cd ~ | |
| # Install prerequisites. | |
| source /etc/os-release | |
| case $ID in | |
| debian|ubuntu|mint) | |
| apt-get install -y git php-cli php-xml | |
| ;; | |
| fedora|rhel|centos|rocky) | |
| dnf install -y git php-cli php-xml | |
| ;; | |
| *) | |
| echo -n "Unsupported Linux distribution." | |
| ;; | |
| esac | |
| # Download test suite (shallow clone of the requested ref). | |
| rm -rf phoronix-test-suite | |
| git clone --depth=1 --branch "${PTS_REF}" \ | |
| https://github.com/phoronix-test-suite/phoronix-test-suite.git | |
| cd phoronix-test-suite | |
| # Accept terms and print system info. | |
| ./phoronix-test-suite system-info <<-END | |
| y | |
| n | |
| n | |
| END | |
| # List recommended tests. | |
| # ./phoronix-test-suite list-recommended-tests | |
| # Batch setup | |
| # Thanks to https://stackoverflow.com/a/77707788/100134 for the assist. | |
| printf 'y\nn\nn\nn\nn\nn\nn\n' | ./phoronix-test-suite batch-setup | |
| # Install test suites. | |
| ./phoronix-test-suite install pts/encode-mp3 | |
| ./phoronix-test-suite install pts/x264 | |
| ./phoronix-test-suite install pts/phpbench | |
| ./phoronix-test-suite install pts/build-linux-kernel | |
| # Run standard test suites. | |
| ./phoronix-test-suite batch-run pts/encode-mp3 | |
| ./phoronix-test-suite batch-run pts/phpbench | |
| # Run test suite requiring option selection. | |
| echo 3 | ./phoronix-test-suite batch-run pts/x264 | |
| echo 1 | ./phoronix-test-suite batch-run pts/build-linux-kernel |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I updated the script to git clone PTS at
PTS_REFinstead of installing 10.8.4. It doesn't seem like version tags propagate to releases anymore, and you're meant to just 'run from master'. Which seems a little annoying since I like targeting releases for benchmark tools... but oh well :)