Lalit Maganti | b36a690 | 2018-11-27 17:55:31 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -e |
| 3 | |
| 4 | echo "" |
| 5 | echo "Downloading latest copy of test data" |
| 6 | echo "" |
| 7 | LATEST_ZIP="$(gsutil ls gs://perfetto | sort | grep test-data | tail -n 1)" |
| 8 | gsutil cp $LATEST_ZIP /tmp/latest-test-data.zip |
| 9 | |
| 10 | echo "" |
| 11 | echo "Extracting test data to temp folder" |
| 12 | echo "" |
| 13 | unzip /tmp/latest-test-data.zip -d /tmp/latest-test-data |
| 14 | |
| 15 | echo "" |
| 16 | echo "Copying trace to temp folder" |
| 17 | echo "" |
| 18 | cp $1 /tmp/latest-test-data |
| 19 | |
| 20 | echo "" |
| 21 | echo "Zipping file back up" |
| 22 | echo "" |
| 23 | NEW_TEST_DATA="test-data-$(date +%Y%m%d).zip" |
Lalit Maganti | a3c3e26 | 2018-11-29 18:37:04 +0000 | [diff] [blame] | 24 | CWD="$(pwd)" |
| 25 | cd /tmp/latest-test-data |
| 26 | zip -r /tmp/$NEW_TEST_DATA * |
| 27 | cd $CWD |
Lalit Maganti | b36a690 | 2018-11-27 17:55:31 +0000 | [diff] [blame] | 28 | |
| 29 | echo "" |
| 30 | echo "Uploading file to Google Cloud" |
| 31 | echo "" |
| 32 | gsutil cp /tmp/$NEW_TEST_DATA gs://perfetto/$NEW_TEST_DATA |
| 33 | |
| 34 | echo "" |
| 35 | echo "Setting file to world readable" |
| 36 | echo "" |
| 37 | gsutil acl ch -u AllUsers:R gs://perfetto/$NEW_TEST_DATA |
| 38 | |
| 39 | echo "" |
| 40 | echo "sha1sum of file $NEW_TEST_DATA is" |
| 41 | echo $(sha1sum /tmp/$NEW_TEST_DATA) |
| 42 | |
| 43 | echo "" |
| 44 | echo "Cleaning up leftover files" |
| 45 | echo "" |
| 46 | rm -r /tmp/latest-test-data |
| 47 | rm /tmp/latest-test-data.zip |
| 48 | rm /tmp/$NEW_TEST_DATA |
| 49 | |
| 50 | echo "" |
| 51 | echo "All done! Please update tools/install-build-deps" |
| 52 | echo "with the new file name and sha1sum" |
| 53 | echo "" |