|
3 | 3 | # Copyright 2013 The Flutter Authors. All rights reserved.
|
4 | 4 | # Use of this source code is governed by a BSD-style license that can be
|
5 | 5 | # found in the LICENSE file.
|
6 |
| -# |
7 |
| -# This script is expected to run from $ENGINE_PATH/src/flutter/testing/benchmark |
8 |
| -# it is currently used only by automation to collect and upload metrics. |
| 6 | + |
| 7 | +# This script is currently used only by automation to collect and upload |
| 8 | +# metrics. |
9 | 9 |
|
10 | 10 | set -ex
|
11 | 11 |
|
12 |
| -pub get |
13 |
| -dart bin/parse_and_send.dart ../../../out/host_release/txt_benchmarks.json |
14 |
| -dart bin/parse_and_send.dart ../../../out/host_release/fml_benchmarks.json |
15 |
| -dart bin/parse_and_send.dart ../../../out/host_release/shell_benchmarks.json |
16 |
| -dart bin/parse_and_send.dart ../../../out/host_release/ui_benchmarks.json |
| 12 | +# Needed because if it is set, cd may print the path it changed to. |
| 13 | +unset CDPATH |
| 14 | + |
| 15 | +# On Mac OS, readlink -f doesn't work, so follow_links traverses the path one |
| 16 | +# link at a time, and then cds into the link destination and find out where it |
| 17 | +# ends up. |
| 18 | +# |
| 19 | +# The function is enclosed in a subshell to avoid changing the working directory |
| 20 | +# of the caller. |
| 21 | +function follow_links() ( |
| 22 | + cd -P "$(dirname -- "$1")" |
| 23 | + file="$PWD/$(basename -- "$1")" |
| 24 | + while [[ -h "$file" ]]; do |
| 25 | + cd -P "$(dirname -- "$file")" |
| 26 | + file="$(readlink -- "$file")" |
| 27 | + cd -P "$(dirname -- "$file")" |
| 28 | + file="$PWD/$(basename -- "$file")" |
| 29 | + done |
| 30 | + echo "$file" |
| 31 | +) |
| 32 | + |
| 33 | +SCRIPT_DIR=$(follow_links "$(dirname -- "${BASH_SOURCE[0]}")") |
| 34 | +SRC_DIR="$(cd "$SCRIPT_DIR/../../.."; pwd -P)" |
| 35 | +DART_SDK_DIR="${SRC_DIR}/third_party/dart/tools/sdks/dart-sdk" |
| 36 | +DART="${DART_SDK_DIR}/bin/dart" |
| 37 | +PUB="${DART_SDK_DIR}/bin/pub" |
| 38 | + |
| 39 | +cd "$SCRIPT_DIR" |
| 40 | +"$DART" --disable-dart-dev bin/parse_and_send.dart \ |
| 41 | + ../../../out/host_release/txt_benchmarks.json |
| 42 | +"$DART" --disable-dart-dev bin/parse_and_send.dart \ |
| 43 | + ../../../out/host_release/fml_benchmarks.json |
| 44 | +"$DART" --disable-dart-dev bin/parse_and_send.dart \ |
| 45 | + ../../../out/host_release/shell_benchmarks.json |
| 46 | +"$DART" --disable-dart-dev bin/parse_and_send.dart \ |
| 47 | + ../../../out/host_release/ui_benchmarks.json |
0 commit comments