-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview
executable file
·61 lines (51 loc) · 1.17 KB
/
view
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
EASYPAPDIR=${EASYPAPDIR:-.}
error()
{
echo "$@" >&2
exit 1
}
COMPARE=no
ARGS=()
for ((i = 1; i <= $#; i++ )); do
case ${!i} in
-c|--compare)
COMPARE=yes
continue
;;
-d|--dir)
if (( i < $# )); then
n=$((i + 1))
TRACEDIR=${!n}
fi
;;
-p|--params)
# use params file if available
use_params=yes
continue
;;
*)
;;
esac
ARGS+=("${!i}")
done
if [[ ${use_params} = yes ]]; then
if [[ -f ${TRACEDIR}/params.txt ]]; then
ARGS+=($(cat ${TRACEDIR}/params.txt))
exec $0 ${ARGS[@]}
else
echo "Warning: Params not found"
fi
fi
# source common vars
. ${EASYPAPDIR}/script/easypap-common.bash
# build easyview if needed
if [[ ! -f ${VIEW} ]]; then
echo "Building ${VIEW}"
make -C ${EASYPAPDIR}/traces
fi
if [[ ${COMPARE} == "yes" ]]; then
[[ -f ${TRACEFILE} && -f ${OLDTRACEFILE} ]] || error "Comparing trace files requires two files under ${TRACEDIR}"
ARGS+=("${TRACEFILE}" "${OLDTRACEFILE}")
fi
exec ${VIEW} ${ARGS[@]}