Make it easy to use tcpdump. (#2862)

This commit is contained in:
Peter Hedenskog 2020-02-06 08:24:18 +01:00 committed by GitHub
parent d22c1de5a8
commit e07ba6b8a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 0 deletions

View File

@ -403,6 +403,13 @@ module.exports.parseCommandLine = function parseCommandLine() {
'Run axe tests. Axe will run after all other metrics is collected and will add some extra time to each test.',
group: 'Browser'
})
.option('browsertime.tcpdump', {
alias: 'tcpdump',
type: 'boolean',
default: false,
describe:
'Collect a tcpdump for each tested URL. The user that runs sitespeed.io should have sudo rights for tcpdump to work.'
})
.option('browsertime.firefox.includeResponseBodies', {
alias: 'firefox.includeResponseBodies',
describe: 'Include response bodies in HAR',

View File

@ -133,6 +133,7 @@ block content
img.screenshot(src=screenshotName, width=width, alt='Screenshot')
.downloads
include ./downloads.pug
include ./tcpdump.pug
if d.browsertime && d.browsertime.run && d.browsertime.run.har
section#waterfall-panel
include ../waterfall/index.pug

View File

@ -0,0 +1,6 @@
if options.browsertime.tcpdump
- const tcpDumpPath = 'data/' + (runNumber? runNumber : 1) + '.pcap'
a.button.button-download(href=tcpDumpPath, download) Download tcpdump
if process.env.SSLKEYLOGFILE
- const sslKeyLogFile = process.env.SSLKEYLOGFILE
a.button.button-download(href=sslKeyLogFile, download) Download SSLKEYLOGFILE

View File

@ -133,6 +133,7 @@ block content
.downloads
include ./downloads.pug
include ./tcpdump.pug
if d.browsertime && d.browsertime.har
section#waterfall-panel

View File

@ -0,0 +1,6 @@
if options.browsertime.tcpdump
- const tcpDumpPath = 'data/' + (runNumber? runNumber : 1) + '.pcap'
a.button.button-download(href=tcpDumpPath, download) Download tcpdump
if process.env.SSLKEYLOGFILE
- const sslKeyLogFile = process.env.SSLKEYLOGFILE
a.button.button-download(href=sslKeyLogFile, download) Download SSLKEYLOGFILE

View File

@ -6,6 +6,7 @@ const log = require('intel').getLogger('sitespeedio');
const intel = require('intel');
const os = require('os');
const process = require('process');
const path = require('path');
const logging = require('./core/logging');
const toArray = require('./support/util').toArray;
const pullAll = require('lodash.pullall');
@ -57,6 +58,17 @@ module.exports = {
// Setup logging
const logDir = await storageManager.createDirectory('logs');
if (
options.browsertime &&
options.browsertime.tcpdump &&
!process.env.SSLKEYLOGFILE
) {
process.env.SSLKEYLOGFILE = path.join(
storageManager.getBaseDir(),
'SSLKEYLOGFILE.txt'
);
}
logging.configure(options, logDir);
// Tell the world what we are using