summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2017-04-21 15:23:33 +0800
committerNaresh Kamboju <naresh.kamboju@linaro.org>2017-04-25 10:47:46 +0000
commit8a3eb925abe3382ffb4a53bcac18becb87dee8c7 (patch)
tree07185bcdcc5d3daa8d5f86c3039f07bbec5daa6b
parent2345e58bcb5bf29e9b6c15090523621ea8788325 (diff)
android bootchart: add support for bootchart_parse
also changed to use lava command for test result collection in script Change-Id: I0fdb8c71bd6de69e06de1bbbaae8ac5924842aee Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
-rw-r--r--android/bootchart.yaml3
-rwxr-xr-xandroid/scripts/bootchart.sh76
2 files changed, 60 insertions, 19 deletions
diff --git a/android/bootchart.yaml b/android/bootchart.yaml
index 79b3150..ac4f7db 100644
--- a/android/bootchart.yaml
+++ b/android/bootchart.yaml
@@ -18,6 +18,3 @@ params:
run:
steps:
- ./android/scripts/bootchart.sh $OPERATION $BOOTCHART_TIME
-
-parse:
- pattern: "(?P<test_case_id>\\w+):\\s+(?P<result>(pass|fail))"
diff --git a/android/scripts/bootchart.sh b/android/scripts/bootchart.sh
index 5a4fa11..fbf40b8 100755
--- a/android/scripts/bootchart.sh
+++ b/android/scripts/bootchart.sh
@@ -23,6 +23,12 @@
#
###############################################################################
+local_file_path="$0"
+local_file_parent=$(dirname "${local_file_path}")
+local_file_parent=$(cd "${local_file_parent}"||exit; pwd)
+# shellcheck source=android/scripts/common.sh
+. "${local_file_parent}/common.sh"
+
LOGROOT="/data/bootchart"
start_f="${LOGROOT}/start"
enabled_f="${LOGROOT}/enabled"
@@ -33,62 +39,99 @@ TARBALL="${DATA_TMP}/bootchart.tgz"
start_bootchart(){
echo "${BOOTCHART_TIME}" > ${start_f}
if [ $? -ne 0 ]; then
- echo "start_bootchart: fail"
+ output_test_result "start_bootchart" "fail"
else
- echo "start_bootchart: pass"
+ output_test_result "start_bootchart" "pass"
fi
}
enabled_bootchart(){
touch ${enabled_f}
if [ $? -ne 0 ]; then
- echo "enabled_bootchart: fail"
+ output_test_result "enabled_bootchart" "fail"
else
- echo "enabled_bootchart: pass"
+ output_test_result "enabled_bootchart" "pass"
fi
}
stop_bootchart(){
echo 1 > ${stop_f}
if [ $? -ne 0 ]; then
- echo "stop_bootchart: fail"
+ output_test_result "stop_bootchart" "fail"
else
- echo "stop_bootchart: pass"
+ output_test_result "stop_bootchart" "pass"
fi
rm -fr ${start_f} ${enabled_f}
if [ $? -ne 0 ]; then
- echo "rm_start_file: fail"
+ output_test_result "rm_start_file" "fail"
else
- echo "rm_start_file: pass"
+ output_test_result "rm_start_file" "pass"
fi
}
collect_data(){
- FILES="header proc_stat.log proc_ps.log proc_diskstats.log"
+ FILES="header proc_stat.log proc_ps.log proc_diskstats.log kernel_pacct"
if [ ! -d "${LOGROOT}" ]; then
echo "There is no ${LOGROOT} directory!"
return
fi
cd ${LOGROOT} || exit 1
+ exist_files=""
+ for f in ${FILES}; do
+ if [ -f "${f}" ]; then
+ exist_files="${exist_files} ${f}"
+ fi
+ done
+ if [ -z "${exist_files}" ]; then
+ output_test_result "bootchart_collect_data" "fail"
+ exit 1
+ fi
# shellcheck disable=SC2086
- tar -czvf ${TARBALL} ${FILES}
+ tar -czvf ${TARBALL} ${exist_files}
if [ $? -ne 0 ]; then
- echo "bootchart_collect_data: fail"
+ output_test_result "bootchart_collect_data" "fail"
+ exit 1
else
- echo "bootchart_collect_data: pass"
+ output_test_result "bootchart_collect_data" "pass"
+ fi
+
+ bootchart_parse_cmd="/system/bin/bootchart_parse"
+ bootchart_paser_res="${DATA_TMP}/bootchart_parse.result"
+ if [ -x "${bootchart_parse_cmd}" ]; then
+ ${bootchart_parse_cmd} > "${bootchart_paser_res}"
+ if [ $? -ne 0 ]; then
+ output_test_result "bootchart_parse" "fail"
+ cd ${DATA_TMP} || exit 1
+ [ -f "bootchart_parse.result" ] && lava-test-run-attach bootchart_parse.result text/plain
+ exit 1
+ else
+ output_test_result "bootchart_parse" "pass"
+ while read -r line; do
+ test_case_cmd=$(echo "${line}" |cut -d, -f1)
+ start_time=$(echo "${line}" |cut -d, -f2)
+ end_time=$(echo "${line}" |cut -d, -f3)
+ output_test_result "${test_case_cmd}_starttime" "pass" "${start_time}" "ms"
+ output_test_result "${test_case_cmd}_endtime" "pass" "${end_time}" "ms"
+ done < "${bootchart_paser_res}"
+ fi
+ rm -fr "${bootchart_paser_res}"
fi
+
# shellcheck disable=SC2086
rm -fr ${FILES}
+
cd ${DATA_TMP} || exit 1
if [ -n "$(which lava-test-run-attach)" ]; then
- lava-test-run-attach bootchart.tgz application/x-gzip
+ [ -f "bootchart.tgz" ] && lava-test-run-attach bootchart.tgz application/x-gzip
+ [ -f "lava_test_shell_raw_data.csv" ] && lava-test-run-attach lava_test_shell_raw_data.csv text/plain
fi
}
main(){
OPERATION="${1}"
if [ "X${OPERATION}" = "X" ]; then
- OPERATION="stop"
+ echo "Please specify the operation of start or stop"
+ exit 1
fi
BOOTCHART_TIME="${2}"
if [ "X${BOOTCHART_TIME}" = "X" ]; then
@@ -103,12 +146,13 @@ main(){
;;
"Xstop")
stop_bootchart
- #wait the file to be sync disk completely
+ #wait the file to be synced to disk completely
sleep 5
collect_data
;;
*)
- echo "bootchart: fail"
+ output_test_result "bootchart" "fail"
+ exit 1
;;
esac
}