Skip to content

Instantly share code, notes, and snippets.

@geerlingguy
Last active November 4, 2023 02:11
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Raspberry Pi Benchmark Suite - Phoronix
#!/bin/bash
#
# Benchmark script for Raspberry Pi OS.
#
# 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
# Fail on error.
set -e
# 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.
apt-get install -y php8.2-cli php8.2-xml
# Download test suite.
curl -LO https://www.phoronix-test-suite.com/releases/phoronix-test-suite-10.8.4.tar.gz
tar -xvf phoronix-test-suite-10.8.4.tar.gz
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
# Ensure config directory exists.
mkdir -p $PHORONIX_CONFIG_PATH/test-suites/local/raspberrypi
# Copy configuration into place.
tee $PHORONIX_CONFIG_PATH/test-suites/local/raspberrypi/suite-definition.xml <<EOF
<?xml version="1.0"?>
<!--Phoronix Test Suite v10.8.4-->
<PhoronixTestSuite>
<SuiteInformation>
<Title>RaspberryPi</Title>
<Version>1.0.1</Version>
<TestType>System</TestType>
<Description>General system tests for the Raspberry Pi.</Description>
<Maintainer>Jeff Geerling</Maintainer>
</SuiteInformation>
<Execute>
<Test>pts/encode-mp3</Test>
</Execute>
<Execute>
<Test>pts/x264</Test>
</Execute>
<Execute>
<Test>pts/phpbench</Test>
</Execute>
</PhoronixTestSuite>
EOF
# Run benchmark suite.
./phoronix-test-suite benchmark raspberrypi
@geerlingguy
Copy link
Author

Updated to run on Debian 12 'Bookworm', with PHP 8.2 and the latest version of PTS as of today.

@geerlingguy
Copy link
Author

I also added build-linux-kernel, and right now the only non-interactive portion of the script is the pause after test installation, when the following prompt is displayed:

    Would you like to save these test results (Y/n): 

It looks like I could bypass that by setting up some defaults, e.g. /etc/phoronix-test-suite.xml with:

<BatchMode>
<SaveResults>FALSE</SaveResults>
<OpenBrowser>FALSE</OpenBrowser>
<UploadResults>FALSE</UploadResults>
<PromptForTestIdentifier>FALSE</PromptForTestIdentifier>
<PromptForTestDescription>FALSE</PromptForTestDescription>
<PromptSaveName>FALSE</PromptSaveName>
<RunAllTestCombinations>TRUE</RunAllTestCombinations>
<Configured>TRUE</Configured>
</BatchMode>

(But that would necessitate batch mode... I want to make it so I can bypass that question and not save results by default if using the suite...)

@geerlingguy
Copy link
Author

I added pts/build-linux-kernel with just defconfig but that doesn't seem to be working out... it runs both that and all deps.

  <Execute>
    <Test>pts/build-linux-kernel</Test>
    <Arguments>defconfig</Arguments>
  </Execute>

@geerlingguy
Copy link
Author

geerlingguy commented Nov 4, 2023

I took out the build-linux-kernel test because it doesn't seem to accept the argument, it just runs all options which means it takes forever.

You can run it separately:

./phoronix-test-suite benchmark pts/build-linux-kernel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment