TestEngineering/Performance/Raptor: Difference between revisions

Change all ./mach raptor-test calls to ./mach raptor and add a message about running locally at the top that also mentions the possibility of raptor-test being deprecated in the future.
(Change all ./mach raptor-test calls to ./mach raptor and add a message about running locally at the top that also mentions the possibility of raptor-test being deprecated in the future.)
Line 7: Line 7:
* Good first bugs: https://codetribute.mozilla.org/projects/automation?project%3DRaptor
* Good first bugs: https://codetribute.mozilla.org/projects/automation?project%3DRaptor


Raptor currently supports three test types: 1) page-load performance tests, 2) standard benchmark-performance tests, and 3) "scenario"-based tests, such as power, CPU, and memory-usage measurements on Android (and desktop?)
Raptor currently supports three test types: 1) page-load performance tests, 2) standard benchmark-performance tests, and 3) "scenario"-based tests, such as power, CPU, and memory-usage measurements on Android (and desktop?).
 
Locally, raptor can be invoked with either of the following commands - raptor-test may be deprecated in the future:
    ./mach raptor
    ./mach raptor-test


=== Page-Load Tests ===
=== Page-Load Tests ===
Line 120: Line 124:
===== Fennec =====
===== Fennec =====


   ./mach raptor-test --test raptor-scn-power-idle-fennec --app fennec --binary org.mozilla.firefox --power-test --host 10.252.27.96
   ./mach raptor --test raptor-scn-power-idle-fennec --app fennec --binary org.mozilla.firefox --power-test --host 10.252.27.96


===== Fenix =====
===== Fenix =====


   ./mach raptor-test --test raptor-scn-power-idle-fenix --app fenix --binary org.mozilla.fenix.performancetest --power-test --host 10.252.27.96
   ./mach raptor --test raptor-scn-power-idle-fenix --app fenix --binary org.mozilla.fenix.performancetest --power-test --host 10.252.27.96


===== GeckoView =====
===== GeckoView =====


   ./mach raptor-test --test raptor-scn-power-idle-geckoview --app geckoview --binary org.mozilla.geckoview_example --power-test --host 10.252.27.96
   ./mach raptor --test raptor-scn-power-idle-geckoview --app geckoview --binary org.mozilla.geckoview_example --power-test --host 10.252.27.96


===== Reference Browser =====
===== Reference Browser =====


   ./mach raptor-test --test raptor-scn-power-idle-refbrow --app refbrow --binary org.mozilla.reference.browser.raptor --power-test --host 10.252.27.96
   ./mach raptor --test raptor-scn-power-idle-refbrow --app refbrow --binary org.mozilla.reference.browser.raptor --power-test --host 10.252.27.96


'''NOTE:'''
'''NOTE:'''
Line 166: Line 170:
To see which Raptor performance tests are currently available on all platforms, use the 'print-tests' option, e.g.:
To see which Raptor performance tests are currently available on all platforms, use the 'print-tests' option, e.g.:


     $ ./mach raptor-test --print-tests
     $ ./mach raptor --print-tests


That will output all available tests on each supported app, as well as each subtest available in each suite (i.e. all the pages in a specific page-load tp6* suite).
That will output all available tests on each supported app, as well as each subtest available in each suite (i.e. all the pages in a specific page-load tp6* suite).
Line 174: Line 178:
To run Raptor locally, just build Firefox and then run:
To run Raptor locally, just build Firefox and then run:


     $ ./mach raptor-test --test <raptor-test-name>
     $ ./mach raptor --test <raptor-test-name>


For example, to run the raptor-tp6 pageload test locally, just use:
For example, to run the raptor-tp6 pageload test locally, just use:


     $ ./mach raptor-test --test raptor-tp6-1
     $ ./mach raptor --test raptor-tp6-1


You can run individual subtests too (i.e. a single page in one of the tp6* suites). For example, to run the amazon page-load test on Firefox:
You can run individual subtests too (i.e. a single page in one of the tp6* suites). For example, to run the amazon page-load test on Firefox:


     $ ./mach raptor-test --test raptor-tp6-amazon-firefox
     $ ./mach raptor --test raptor-tp6-amazon-firefox


Raptor test results will be found locally in <your-repo>/testing/mozharness/build/raptor.json.
Raptor test results will be found locally in <your-repo>/testing/mozharness/build/raptor.json.
Line 222: Line 226:
Once your Android device is ready, and attached to local USB, from within your local mozilla repo use the following command line to run speedometer:
Once your Android device is ready, and attached to local USB, from within your local mozilla repo use the following command line to run speedometer:


     $ ./mach raptor-test --test raptor-speedometer --app=geckoview --binary="org.mozilla.geckoview_example"
     $ ./mach raptor --test raptor-speedometer --app=geckoview --binary="org.mozilla.geckoview_example"


Note: Speedometer on Android GeckoView is currently running on two devices in production - the Google Pixel 2 and the Moto G5 - therefore it is not guaranteed that it will run successfully on all/other untested android devices. There is an intermittent failure on the Moto G5 where speedometer just stalls ([https://bugzilla.mozilla.org/show_bug.cgi?id=1492222 Bug 1492222]).
Note: Speedometer on Android GeckoView is currently running on two devices in production - the Google Pixel 2 and the Moto G5 - therefore it is not guaranteed that it will run successfully on all/other untested android devices. There is an intermittent failure on the Moto G5 where speedometer just stalls ([https://bugzilla.mozilla.org/show_bug.cgi?id=1492222 Bug 1492222]).
Line 228: Line 232:
To run a Raptor page-load test (i.e. tp6m-1) on the GeckoView Example app, use this command line:
To run a Raptor page-load test (i.e. tp6m-1) on the GeckoView Example app, use this command line:


     $ ./mach raptor-test --test raptor-tp6m-1 --app=geckoview --binary="org.mozilla.geckoview_example"
     $ ./mach raptor --test raptor-tp6m-1 --app=geckoview --binary="org.mozilla.geckoview_example"


A couple notes about debugging:
A couple notes about debugging:
Line 244: Line 248:
To run Raptor locally on Google Chrome, make sure you already have a local version of Google Chrome installed, and then from within your mozilla-repo run:
To run Raptor locally on Google Chrome, make sure you already have a local version of Google Chrome installed, and then from within your mozilla-repo run:


     $ ./mach raptor-test --test <raptor-test-name> --app=chrome --binary="<path to google chrome binary>"
     $ ./mach raptor --test <raptor-test-name> --app=chrome --binary="<path to google chrome binary>"


For example, to run the raptor-speedometer benchmark on Google Chrome use:
For example, to run the raptor-speedometer benchmark on Google Chrome use:


     $ ./mach raptor-test --test raptor-speedometer --app=chrome --binary="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome
     $ ./mach raptor --test raptor-speedometer --app=chrome --binary="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome


Raptor test results will be found locally in <your-repo>/testing/mozharness/build/raptor.json.
Raptor test results will be found locally in <your-repo>/testing/mozharness/build/raptor.json.
Line 258: Line 262:
You can override the default page-timeout by using the --page-timeout command-line arg. In this example, each test page in tp6-1 will be given two minutes to load during each page-cycle:
You can override the default page-timeout by using the --page-timeout command-line arg. In this example, each test page in tp6-1 will be given two minutes to load during each page-cycle:


   ./mach raptor-test --test raptor-tp6-1 --page-timeout 120000
   ./mach raptor --test raptor-tp6-1 --page-timeout 120000


If an iteration of a benchmark test is not finishing within the allocated time, increase it by:
If an iteration of a benchmark test is not finishing within the allocated time, increase it by:


   ./mach raptor-test --test raptor-speedometer --page-timeout 600000
   ./mach raptor --test raptor-speedometer --page-timeout 600000


==== Page-Cycles ====
==== Page-Cycles ====
Line 270: Line 274:
You can override the default page-cycles by using the --page-cycles command-line arg. In this example, the test page will only be loaded twice:
You can override the default page-cycles by using the --page-cycles command-line arg. In this example, the test page will only be loaded twice:


   ./mach raptor-test --test raptor-tp6-google-firefox --page-cycles 2
   ./mach raptor --test raptor-tp6-google-firefox --page-cycles 2


==== Running Page-Load Tests on Live Sites ====
==== Running Page-Load Tests on Live Sites ====
Line 320: Line 324:
To tell Raptor to create Gecko profiles during a performance test, just add the '--gecko-profile' flag to the command line, i.e.:
To tell Raptor to create Gecko profiles during a performance test, just add the '--gecko-profile' flag to the command line, i.e.:


     $ ./mach raptor-test --test raptor-sunspider --gecko-profile
     $ ./mach raptor --test raptor-sunspider --gecko-profile


When the Raptor test is finished, you will be able to find the resulting gecko profiles (ZIP) located locally in:
When the Raptor test is finished, you will be able to find the resulting gecko profiles (ZIP) located locally in:
Line 326: Line 330:
     mozilla-central/testing/mozharness/build/blobber_upload_dir/
     mozilla-central/testing/mozharness/build/blobber_upload_dir/


Note: While profiling is turned on, Raptor will automatically reduce the number of pagecycles to 3. If you wish to override this, add the --page-cycles argument to the raptor-test command line.  
Note: While profiling is turned on, Raptor will automatically reduce the number of pagecycles to 3. If you wish to override this, add the --page-cycles argument to the raptor command line.  


Raptor will automatically launch Firefox and load the latest Gecko profile in [https://perf-html.io perfhtml.io]. To turn this feature off, just set the DISABLE_PROFILE_LAUNCH=1 env var.
Raptor will automatically launch Firefox and load the latest Gecko profile in [https://perf-html.io perfhtml.io]. To turn this feature off, just set the DISABLE_PROFILE_LAUNCH=1 env var.
Line 408: Line 412:
All the pages in a test suite an be run by calling the top-level test name, i.e.:
All the pages in a test suite an be run by calling the top-level test name, i.e.:


   ./mach raptor-test --test raptor-tp6-1
   ./mach raptor --test raptor-tp6-1


Individual test pages can be ran by calling the subtest, i.e.:
Individual test pages can be ran by calling the subtest, i.e.:


   ./mach raptor-test --test raptor-tp6-google-firefox
   ./mach raptor --test raptor-tp6-google-firefox


Some of the page recordings contain [[https://wiki.mozilla.org/Performance_sheriffing/Raptor/Mitmproxy#Adding_Hero_Elements hero elements]]. When hero elements are measured, the value is the time until the hero element appears on the page (in MS).
Some of the page recordings contain [[https://wiki.mozilla.org/Performance_sheriffing/Raptor/Mitmproxy#Adding_Hero_Elements hero elements]]. When hero elements are measured, the value is the time until the hero element appears on the page (in MS).
Line 754: Line 758:
The easiest way to debug the Raptor web extension is to run the Raptor test locally and invoke debug mode, i.e. for Firefox:
The easiest way to debug the Raptor web extension is to run the Raptor test locally and invoke debug mode, i.e. for Firefox:


   ./mach raptor-test --test raptor-tp6-amazon-firefox --debug-mode
   ./mach raptor --test raptor-tp6-amazon-firefox --debug-mode


Or on Chrome, for example:
Or on Chrome, for example:


   ./mach raptor-test --test raptor-tp6-amazon-chrome --app=chrome --binary="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --debug-mode
   ./mach raptor --test raptor-tp6-amazon-chrome --app=chrome --binary="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --debug-mode


Running Raptor with debug mode will:
Running Raptor with debug mode will:
Line 774: Line 778:
In order to retrieve the console.log() output from the Raptor runner, do the following:
In order to retrieve the console.log() output from the Raptor runner, do the following:


# Invoke Raptor locally via ./mach raptor-test
# Invoke Raptor locally via ./mach raptor
# During the 30 second Raptor pause which happens right after Firefox has started up, in the ALREADY OPEN current tab, type "about:debugging" for the URL.
# During the 30 second Raptor pause which happens right after Firefox has started up, in the ALREADY OPEN current tab, type "about:debugging" for the URL.
# On the debugging page that appears, make sure "Add-ons" is selected on the left (default).
# On the debugging page that appears, make sure "Add-ons" is selected on the left (default).
Line 819: Line 823:
When running Raptor tests on Firefox on Android (i.e. geckoview), to see the console.log() output from the Raptor web extension, do the following:
When running Raptor tests on Firefox on Android (i.e. geckoview), to see the console.log() output from the Raptor web extension, do the following:


# With your android device (i.e. Google Pixel 2) all set up and connected to USB, invoke the Raptor test normally via ./mach raptor-test
# With your android device (i.e. Google Pixel 2) all set up and connected to USB, invoke the Raptor test normally via ./mach raptor
# Start up a local copy of the Firefox Nightly Desktop browser
# Start up a local copy of the Firefox Nightly Desktop browser
# In Firefox Desktop choose "Tools => Web Developer => WebIDE"
# In Firefox Desktop choose "Tools => Web Developer => WebIDE"
96

edits