1cb93a386Sopenharmony_ci#!/bin/bash 2cb93a386Sopenharmony_ci# Copyright 2018 Google LLC 3cb93a386Sopenharmony_ci# 4cb93a386Sopenharmony_ci# Use of this source code is governed by a BSD-style license that can be 5cb93a386Sopenharmony_ci# found in the LICENSE file. 6cb93a386Sopenharmony_ci 7cb93a386Sopenharmony_ci# This assumes it is being run inside a docker container of gold-karma-chrome-tests 8cb93a386Sopenharmony_ci# and a Skia checkout has been mounted at /SRC and the output directory 9cb93a386Sopenharmony_ci# is mounted at /OUT 10cb93a386Sopenharmony_ci 11cb93a386Sopenharmony_ciset -ex 12cb93a386Sopenharmony_ci 13cb93a386Sopenharmony_ci#BASE_DIR is the dir this script is in ($SKIA_ROOT/infra/canvaskit) 14cb93a386Sopenharmony_ciBASE_DIR=`cd $(dirname ${BASH_SOURCE[0]}) && pwd` 15cb93a386Sopenharmony_ciCANVASKIT_DIR=$BASE_DIR/../../modules/canvaskit 16cb93a386Sopenharmony_ci 17cb93a386Sopenharmony_ci# We avoid a lot of file permission errors by copying the tests and binary into the Docker 18cb93a386Sopenharmony_ci# container and running npm ci there. 19cb93a386Sopenharmony_cicp -R $CANVASKIT_DIR /tmp/work 20cb93a386Sopenharmony_cicd /tmp/work 21cb93a386Sopenharmony_cinpm ci --cache /tmp/npmcache 22cb93a386Sopenharmony_ci 23cb93a386Sopenharmony_ci# Start the aggregator in the background 24cb93a386Sopenharmony_ci/opt/gold-aggregator $@ & 25cb93a386Sopenharmony_ci# Run the tests 26cb93a386Sopenharmony_cinpx karma start /tmp/work/karma.conf.js --single-run 27cb93a386Sopenharmony_ci# Tell the aggregator to dump the json 28cb93a386Sopenharmony_ci# This curl command gets the HTTP code and stores it into $CODE 29cb93a386Sopenharmony_ciCODE=`curl -s -o /dev/null -I -w "%{http_code}" -X POST localhost:8081/dump_json` 30cb93a386Sopenharmony_ciif [ $CODE -ne 200 ]; then 31cb93a386Sopenharmony_ci # If we don't get 200 back, something is wrong with writing to disk, so exit with error 32cb93a386Sopenharmony_ci exit 1 33cb93a386Sopenharmony_cifi 34