| 1 |
#!/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 gold-karma-chrome-tests |
| 8 |
# and a Skia checkout has been mounted at /SRC and the output directory |
| 9 |
# is mounted at /OUT |
| 10 |
|
| 11 |
set -ex |
| 12 |
|
| 13 |
#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/canvaskit) |
| 14 |
BASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd` |
| 15 |
CANVASKIT_DIR=$BASE_DIR/../../modules/canvaskit |
| 16 |
|
| 17 |
# We avoid a lot of file permission errors by copying the tests and binary into the Docker |
| 18 |
# container and running npm ci there. |
| 19 |
cp -R $CANVASKIT_DIR /tmp/work |
| 20 |
cd /tmp/work |
| 21 |
npm ci --cache /tmp/npmcache |
| 22 |
|
| 23 |
# Start the aggregator in the background |
| 24 |
/opt/gold-aggregator $@ & |
| 25 |
# Run the tests |
| 26 |
npx karma start /tmp/work/karma.conf.js --single-run |
| 27 |
# Tell the aggregator to dump the json |
| 28 |
# This curl command gets the HTTP code and stores it into $CODE |
| 29 |
CODE=`curl -s -o /dev/null -I -w "%{http_code}" -X POST localhost:8081/dump_json` |
| 30 |
if [ $CODE -ne 200 ]; then |
| 31 |
# If we don't get 200 back, something is wrong with writing to disk, so exit with error |
| 32 |
exit 1 |
| 33 |
fi |