summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2017-03-27 18:04:37 +0800
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2017-03-27 13:37:40 +0000
commit0f6d45e70b627c233d780166baa2c3ef1793f879 (patch)
tree7af42bae15c9b66430e7f6996922fae162a87c7e
parent5789b1758f4052c9114464109acabf7494959928 (diff)
downloadtest-definitions-pipe-0f6d45e70b627c233d780166baa2c3ef1793f879.tar.gz
automated: android: add tjbench test
Change-Id: I2cf263408730e9ab59ff8e1d2cf9b1e497636b81 Signed-off-by: Chase Qi <chase.qi@linaro.org>
-rwxr-xr-xautomated/android/tjbench/tjbench.sh101
-rw-r--r--automated/android/tjbench/tjbench.yaml34
2 files changed, 135 insertions, 0 deletions
diff --git a/automated/android/tjbench/tjbench.sh b/automated/android/tjbench/tjbench.sh
new file mode 100755
index 0000000..b94f42e
--- /dev/null
+++ b/automated/android/tjbench/tjbench.sh
@@ -0,0 +1,101 @@
+#!/bin/sh -e
+# shellcheck disable=SC2039
+# shellcheck disable=SC1091
+
+ANDROID_SERIAL=""
+BOOT_TIMEOUT="300"
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+IMGS="nightshot_iso_100.ppm"
+LOOPS="1"
+SKIP_INSTALL="false"
+
+. ../../lib/sh-test-lib
+. ../../lib/android-test-lib
+
+usage() {
+ echo "Usage: $0 [-s <android_serial>] [-t <boot_timeout>] [-l <loops>] [-S <true|false>]" 1>&2
+ exit 1
+}
+
+while getopts ":s:t:l:S:" o; do
+ case "$o" in
+ s) ANDROID_SERIAL="${OPTARG}" ;;
+ t) BOOT_TIMEOUT="${OPTARG}" ;;
+ l) LOOPS="${OPTARG}" ;;
+ S) SKIP_INSTALL="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+initialize_adb
+wait_boot_completed "${BOOT_TIMEOUT}"
+create_out_dir "${OUTPUT}"
+install_deps "wget" "${SKIP_INSTALL}"
+
+parse_log() {
+ local logfile="$1"
+ local prefix="$2_subsamp"
+
+ grep "^RGB" "${logfile}" \
+ | awk -v prefix="$prefix" \
+ '{
+ gsub(":", "", $3);
+ printf("%s_%s_comp_perf pass %s Mpixels/sec\n", prefix, $3, $7);
+ printf("%s_%s_comp_ratio pass %s %\n", prefix, $3, $8);
+ printf("%s_%s_decomp_perf pass %s Mpixels/sec\n", prefix, $3, $9);
+ }' \
+ | tee -a "${RESULT_FILE}"
+}
+
+for test in tjbench32 tjbench64; do
+ if ! adb_shell_which "${test}"; then
+ report_fail "check_${test}_existence"
+ exit 0
+ fi
+done
+
+for img in ${IMGS}; do
+ [ ! -f "./${img}" ] && \
+ wget -S --progress=dot:mega "http://testdata.validation.linaro.org/tjbench/${img}"
+ adb_push "./${img}" "/data/local/tmp/tjbench/"
+ img_path="/data/local/tmp/tjbench/${img}"
+
+ for test in tjbench32 tjbench64; do
+ img_name="$(echo "${img}" | sed 's/[.]/_/g')"
+ case "${test}" in
+ tjbench32) prefix="32bit_${img_name}" ;;
+ tjbench64) prefix="64bit_${img_name}" ;;
+ esac
+
+ info_msg "device-${ANDROID_SERIAL}: About to run ${test}..."
+ for i in $(seq "${LOOPS}"); do
+ info_msg "Running iteration [${i}/${LOOPS}]..."
+ adb shell "${test} ${img_path} 95 -rgb -quiet scale 1/2" | tee -a "${OUTPUT}/${test}-w1-h2.log"
+ adb shell "${test} ${img_path} 95 -rgb -quiet" | tee -a "${OUTPUT}/${test}.log"
+ done
+ parse_log "${OUTPUT}/${test}-w1-h2.log" "${prefix}_scale_w1_h2"
+ parse_log "${OUTPUT}/${test}.log" "${prefix}"
+ done
+done
+
+# Calculate min, mean and max.
+if [ "${LOOPS}" -gt 2 ]; then
+ tc_list=$(awk '{print $1}' "${RESULT_FILE}" | sort -u)
+ for tc in ${tc_list}; do
+ grep "$tc" "${RESULT_FILE}" \
+ | awk -v tc="${tc}" \
+ '{
+ if(min=="") {min=max=$3};
+ if($3>max) {max=$3};
+ if($3< min) {min=$3};
+ total+=$3; count+=1;
+ }
+ END {
+ printf("%s-min pass %s %s\n", tc, min, $4);
+ printf("%s-mean pass %s %s\n", tc, total/count, $4);
+ printf("%s-max pass %s %s\n", tc, max, $4)
+ }' \
+ | tee -a "${RESULT_FILE}"
+ done
+fi
diff --git a/automated/android/tjbench/tjbench.yaml b/automated/android/tjbench/tjbench.yaml
new file mode 100644
index 0000000..9b175a1
--- /dev/null
+++ b/automated/android/tjbench/tjbench.yaml
@@ -0,0 +1,34 @@
+metadata:
+ format: "Lava-Test Test Definition 1.0"
+ name: tjbench
+ description: "Tjbench is used to benchmark the performance of libjpeg-turbo
+ and libjpeg62 for android. For each test image, the tjbench
+ program is used to measure the compression and decompression
+ performance and the compression ratio obtained when
+ compressing the test image as a JPEG image and then
+ decompressing the JPEG image back to its original
+ uncompressed form."
+ maintainer:
+ - yongqin.liu@linaro.org
+ - chase.qi@linaro.org
+ os:
+ - android
+ scope:
+ - performance
+ devices:
+ - juno
+ - hi6220-hikey
+
+params:
+ # Specify device serial no. when more than one device connected.
+ ANDROID_SERIAL: ""
+ # Specify timeout in seconds for wait_boot_completed.
+ BOOT_TIMEOUT: "300"
+ LOOPS: "1"
+ SKIP_INSTALL: "false"
+
+run:
+ steps:
+ - cd ./automated/android/tjbench
+ - ./tjbench.sh -s "${ANDROID_SERIAL}" -t "${BOOT_TIMEOUT}" -l "${LOOPS}" -S "${SKIP_INSTALL}"
+ - ../../utils/send-to-lava.sh ./output/result.txt