skia2/tools/skqp/upload_model
Hal Canary ac7f23c807 SkQP: refatctor C++ bits.
* C++ code moved into tools/skqp/src/.
  * State held with single SkQP class.
  * gmkb functions moved to skqp_model.{h,cpp}
  * model no longer knows about report format.
  * skqp_main and skqp_lib no longer have globals
  * jni code has fewer globals.
  * skqp_main no longer uses googletest.
  * AssetMng returns SkData, not a SkStream.
  * Add jitter tool.
  * dump GPU information into grdump.txt
  * JUnit puts report in directory with timestamp.
  * Document SkQP Render Test Algorithm.
  * GPU driver correctness workarounds always off
  * cut_release tool for assembling models
  * make_rendertests_list.py to help cut_release
  * make_gmkb.go emits a list of models

CQ_INCLUDE_TRYBOTS=skia.primary:Build-Debian9-Clang-x86-devrel-Android_SKQP

Change-Id: I7d4f0c24592b1f64be0088578a3f1a0bc366dd4d
Reviewed-on: https://skia-review.googlesource.com/c/110420
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-11-30 18:38:00 +00:00

63 lines
1.4 KiB
Bash
Executable File

#! /bin/sh
# Copyright 2018 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
BASE_DIR='platform_tools/android/apps/skqp/src/main/assets'
PATH_LIST='gmkb'
BUCKET=skia-skqp-assets
EXTANT="$(mktemp "${TMPDIR:-/tmp}/extant.XXXXXXXXXX")"
gsutil ls gs://$BUCKET/ | sed "s|^gs://$BUCKET/||" > "$EXTANT"
upload() {
MD5=$(md5sum < "$1" | head -c 32)
if ! grep -q "$MD5" "$EXTANT"; then
URL="gs://${BUCKET}/$MD5"
gsutil cp "$1" "$URL" > /dev/null 2>&1 &
fi
echo $MD5
}
size() { gsutil du -s gs://$BUCKET | awk '{print $1}'; }
cd "$(dirname "$0")/../../$BASE_DIR"
rm -f files.checksum
FILES="$(mktemp "${TMPDIR:-/tmp}/files.XXXXXXXXXX")"
: > "$FILES"
COUNT=$(find $PATH_LIST -type f | wc -l)
INDEX=1
SHARD_COUNT=32
SIZE=$(size)
find $PATH_LIST -type f | sort | while IFS= read -r FILENAME; do
printf '\r %d / %d ' "$INDEX" "$COUNT"
if ! [ -f "$FILENAME" ]; then
echo error [${FILENAME}] >&2;
exit 1;
fi
case "$FILENAME" in *\;*) echo bad filename: $FILENAME >&2; exit 1;; esac
MD5=$(upload "$FILENAME")
printf '%s;%s\n' "$MD5" "$FILENAME" >> "$FILES"
if [ $(($INDEX % $SHARD_COUNT)) = 0 ]; then
wait
fi
INDEX=$(( $INDEX + 1))
done
printf '\rdone \n'
upload "$FILES" > files.checksum
wait
D=$(( $(size) - $SIZE ))
printf 'Added %d bytes to %s, %d%%\n' $D $BUCKET $(( $D * 100 / $SIZE ))
rm "$EXTANT"