Lalit Maganti | 4f25ac7 | 2019-02-07 16:35:37 +0000 | [diff] [blame] | 1 | #!/bin/bash |
Primiano Tucci | 94c47f0 | 2019-12-05 03:13:11 +0000 | [diff] [blame] | 2 | # Copyright (C) 2019 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Lalit Maganti | 4f25ac7 | 2019-02-07 16:35:37 +0000 | [diff] [blame] | 16 | set -e |
| 17 | |
| 18 | read -p "Name of SQL file to create (in test/trace_processor): " sqlfile |
| 19 | read -p "Name to trace file (in test/): " tracefile |
| 20 | |
| 21 | ROOTDIR=$(dirname $(dirname $(readlink -f $0))) |
| 22 | TEST_PATH=$ROOTDIR/test |
| 23 | TRACE_PROC_PATH=$TEST_PATH/trace_processor |
| 24 | |
| 25 | SQL_FILE_NAME=${sqlfile%.*} |
| 26 | |
| 27 | echo "Creating $TRACE_PROC_PATH/$sqlfile" |
| 28 | touch $TRACE_PROC_PATH/$sqlfile |
| 29 | |
| 30 | TRACE_PATH=$TEST_PATH/$tracefile |
| 31 | TRACE_BASE=$(basename $tracefile) |
| 32 | TRACE_FILE_NAME=${TRACE_BASE%.*} |
| 33 | OUT_FILE="$SQL_FILE_NAME""_$TRACE_FILE_NAME.out" |
| 34 | |
| 35 | echo "Creating $TRACE_PROC_PATH/$OUT_FILE" |
| 36 | touch $TRACE_PROC_PATH/$OUT_FILE |
| 37 | |
| 38 | RELTRACE=$(realpath -s $TRACE_PATH --relative-to=$TRACE_PROC_PATH --relative-base=$ROOTDIR) |
| 39 | echo "Adding index line to $TRACE_PROC_PATH/index" |
| 40 | echo >> $TRACE_PROC_PATH/index |
| 41 | echo "$RELTRACE $sqlfile $OUT_FILE" >> $TRACE_PROC_PATH/index |