aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/fiddle/parse-fiddle-output
blob: f44ff6445e4c4fb1383054981ea7912057033491 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
# Copyright 2015 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Parse the output of fiddle_main, for use in testing
while IFS= read -r line; do
    type=$(echo $line | sed -n 's/[^"]*"\([^"]*\)":.*/\1/p')
    if [ "$type" ]; then
        case "$type" in
            Raster|Gpu)  ext='.png';;
            Pdf)         ext='.pdf';;
            Skp)         ext='.skp';;
            Text|GLInfo) ext='.txt';;
        esac
        dst="${TMPDIR:-/tmp}/fiddle_${type}${ext}"
        echo $line | sed 's/[^"]*"[^"]*": "//; s/"\(,\|\)$//' \
            | base64 -d > "$dst"
        echo $dst
    fi
done