parse-fiddle-output 679 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. # Copyright 2015 Google Inc.
  3. #
  4. # Use of this source code is governed by a BSD-style license that can be
  5. # found in the LICENSE file.
  6. # Parse the output of fiddle_main, for use in testing
  7. while IFS= read -r line; do
  8. type=$(echo $line | sed -n 's/[^"]*"\([^"]*\)":.*/\1/p')
  9. if [ "$type" ]; then
  10. case "$type" in
  11. Raster|Gpu) ext='.png';;
  12. Pdf) ext='.pdf';;
  13. Skp) ext='.skp';;
  14. Text|GLInfo) ext='.txt';;
  15. esac
  16. dst="${TMPDIR:-/tmp}/fiddle_${type}${ext}"
  17. echo $line | sed 's/[^"]*"[^"]*": "//; s/"\(,\|\)$//' \
  18. | base64 -d > "$dst"
  19. echo $dst
  20. fi
  21. done