Test script to emulate a relatively heavy workload for battery life testing.
MIT License
This repository contains a simple test script to emulate a relatively heavy workload for battery life testing. It downloads a copy of Drupal VM and repeatedly builds and destroys a Virtual Machine running Drupal.
The script does the following, in a loop:
pmset
) to a results file.vagrant up
to configure a VM running Drupal on a standard LAMP stack.vagrant destroy -f
to destroy the VM.To run the script, you should already have the latest versions of Vagrant and VirtualBox installed.
Note about Vagrant plugins: The author runs the tests without
vagrant-cachier
installed for consistency's sake. If you use Vagrant regularly, check to make sure you don't have any plugins installed which could affect the consistency of this test usingvagrant plugin list
!
This test script should run on any platform which supports Vagrant and VirtualBox, though it's only been tested on macOS, Fedora, and Ubuntu at this time.
caffeinate
in a separate Terminal window).cd path/to/macbook-pro-battery-test
). Run ./battery-test.sh
, and then walk away for a few hours.After your Mac forces a sleep (when the battery has run out), plug it back in, then check the most recent file in results/
in the project directory.
Results are written to a date-and-timestamped file inside the results
folder. This file is in CSV format, so you can open it in Excel, Numbers, Google Sheets, or any other CSV-compatible program and graph the results as needed.
The results file has the following structure (as an example):
Counter | Time | Battery Percentage |
---|---|---|
0 | 2017-01-07 15:58:40 | 100% |
0 | 2017-01-07 16:10:48 | 98% |
0 | 2017-01-07 16:17:22 | 94% |
... | ... | ... |
Results of this script's test runs have been posted to the author's blog and a public Google Sheet:
This script was created by Jeff Geerling to run some more formal battery tests on the 2016 Retina MacBook Proboth with and without Touch Barand to see if battery life and performance between the two models (under heavier load) was much different.