aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/fiddle/parse-fiddle-output
blob: f9a2fac6d6633e3c5f17807481307f55d91cec83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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';;
        esac
        dst="${TMPDIR:-/tmp}/fiddle_${type}${ext}"
        echo $line | sed 's/[^"]*"[^"]*": "//; s/"\(,\|\)$//' \
            | base64 -d > "$dst"
        echo $dst
    fi
done