blob: a2076b0dde650b7659948d9110b81b51dff5dd32 (
plain)
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
|
#!/bin/bash -eu
# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This script returns BAD_STATUS if '2' is in the top line of 'func_a's profile
# and good otherwise
GOOD_STATUS=0
BAD_STATUS=1
SKIP_STATUS=125
PROBLEM_STATUS=127
tmp_dir=$(pwd)/afdo_test_tmp
count_file=${tmp_dir}/.count
# keep count for purpose of filenames
if [ -f "${count_file}" ]; then
num_call=$(cat "${count_file}")
else
num_call=0
fi
echo -n $(( ${num_call}+1 )) > "${count_file}"
tmp_file=$(mktemp)
trap "rm -f '${tmp_file}'" EXIT
grep -v '^ ' "$1" > "${tmp_file}"
# copy prof to specific file for later test
if [[ $# -eq 2 ]]; then
cp "$1" "${tmp_dir}/.second_run_${num_call}"
else
cp "$1" "${tmp_dir}/.first_run_${num_call}"
fi
if grep -q 'func_a.*2' "${tmp_file}"; then
exit "${BAD_STATUS}"
fi
exit "${GOOD_STATUS}"
|