blob: 196fd5f983277a9345a91f04a873ccc92806ce2b [file] [log] [blame]
Lalit Maganti4f25ac72019-02-07 16:35:37 +00001#!/bin/bash
Primiano Tucci94c47f02019-12-05 03:13:11 +00002# 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 Maganti4f25ac72019-02-07 16:35:37 +000016set -e
17
18read -p "Name of SQL file to create (in test/trace_processor): " sqlfile
19read -p "Name to trace file (in test/): " tracefile
20
21ROOTDIR=$(dirname $(dirname $(readlink -f $0)))
22TEST_PATH=$ROOTDIR/test
23TRACE_PROC_PATH=$TEST_PATH/trace_processor
24
25SQL_FILE_NAME=${sqlfile%.*}
26
27echo "Creating $TRACE_PROC_PATH/$sqlfile"
28touch $TRACE_PROC_PATH/$sqlfile
29
30TRACE_PATH=$TEST_PATH/$tracefile
31TRACE_BASE=$(basename $tracefile)
32TRACE_FILE_NAME=${TRACE_BASE%.*}
33OUT_FILE="$SQL_FILE_NAME""_$TRACE_FILE_NAME.out"
34
35echo "Creating $TRACE_PROC_PATH/$OUT_FILE"
36touch $TRACE_PROC_PATH/$OUT_FILE
37
38RELTRACE=$(realpath -s $TRACE_PATH --relative-to=$TRACE_PROC_PATH --relative-base=$ROOTDIR)
39echo "Adding index line to $TRACE_PROC_PATH/index"
40echo >> $TRACE_PROC_PATH/index
41echo "$RELTRACE $sqlfile $OUT_FILE" >> $TRACE_PROC_PATH/index