Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 874b0dc

Browse files
committed
Clean up upload_metrics.sh
1 parent 38bb7c5 commit 874b0dc

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

testing/benchmark/upload_metrics.sh

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,45 @@
33
# Copyright 2013 The Flutter Authors. All rights reserved.
44
# Use of this source code is governed by a BSD-style license that can be
55
# 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.
99

1010
set -ex
1111

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

Comments
 (0)