blob: 7b0da00ede11fee2e16e4c0225a9fc5a4991b264 [file] [log] [blame]
Kevin Lubick556350d2018-10-12 15:21:17 -04001#!/bin/bash
2# Copyright 2018 Google LLC
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# This assumes it is being run inside a docker container of perf-karma-chrome-tests
8# and a Skia checkout has been mounted at /SRC and the output directory
9# is mounted at /OUT
10
Kevin Lubick556350d2018-10-12 15:21:17 -040011set -ex
12
13#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/pathkit)
14BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd`
15PATHKIT_DIR=$BASE_DIR/../../modules/pathkit
16
Kevin Lubick371967f2020-12-14 09:43:13 -050017# We avoid a lot of file permission errors by copying the tests and binary into the Docker
18# container and running npm ci there.
19cp -R $PATHKIT_DIR /tmp/work
20cd /tmp/work
21npm ci --cache /tmp/npmcache
22
Kevin Lubick556350d2018-10-12 15:21:17 -040023# Start the aggregator in the background
24/opt/perf-aggregator $@ &
25# Run the tests 10 times to get a wide set of data
26for i in `seq 1 10`;
27do
Kevin Lubick371967f2020-12-14 09:43:13 -050028 npx karma start /tmp/work/karma.bench.conf.js --single-run
Kevin Lubick556350d2018-10-12 15:21:17 -040029done
30# Tell the aggregator to dump the json
31# This curl command gets the HTTP code and stores it into $CODE
32CODE=`curl -s -o /dev/null -I -w "%{http_code}" -X POST localhost:8081/dump_json`
33if [ $CODE -ne 200 ]; then
34 # If we don't get 200 back, something is wrong with writing to disk, so exit with error
35 exit 1
36fi