diff options
Diffstat (limited to 'android/scripts/bionic-benchmarks.sh')
-rwxr-xr-x | android/scripts/bionic-benchmarks.sh | 59 |
1 files changed, 19 insertions, 40 deletions
diff --git a/android/scripts/bionic-benchmarks.sh b/android/scripts/bionic-benchmarks.sh index 9839179..b3d27fb 100755 --- a/android/scripts/bionic-benchmarks.sh +++ b/android/scripts/bionic-benchmarks.sh @@ -1,75 +1,54 @@ #!/system/bin/sh -loop_times=$1 -if [ -z "${loop_times}" ]; then - loop_times=12 -fi -raw_data="/data/local/tmp/bionic-benchmarks-raw.csv" -rm -fr ${raw_data} - -add_lava_result_entry(){ - local cmd="lava-test-case" - if [ -n "$(which $cmd)" ];then - $cmd "$@" - else - echo "$cmd $@" - fi -} +local_file_path="$0" +local_file_parent=$(cd $(dirname ${local_file_path}); pwd) +. ${local_file_parent}/common.sh test_bionic_benchmark(){ - local arch=$1 && shift + local arch=$1 if [ "X$arch" != "X32" ] && [ "X$arch" != "X64" ]; then echo "The specified $arch is not specified!" return fi - local excluded_test=$1 && shift + local excluded_test=$2 local cmd="bionic-benchmarks${arch}" if [ -n "$(which ${cmd})" ]; then for line in $(${cmd} --help 2>&1|grep BM_); do if [ -n "$excluded_test" ]; then if echo "${excluded_test}"|grep -q ${line}; then - echo "${arch}_${line} skip" - add_lava_result_entry "${arch}_${line}" "--result" "skip" + output_test_result "${arch}_${line}" "skip" continue fi fi - echo "--------------start $line--------" local hasResult=false - for res_line in $(${cmd} ${line}|grep "BM_"|tr -s ' '|tr ' ' ','); do - echo "${arch}_$line pass" - add_lava_result_entry "${arch}_${line}" "--result" "pass" + for res_line in $(${cmd} "^${line}$"|grep "BM_"|tr -s ' '|tr ' ' ','); do + output_test_result "${arch}_${line}" "pass" local key=$(echo $res_line|cut -d, -f1|tr '/' '_') local iterations=$(echo $res_line|cut -d, -f2) local ns_time=$(echo $res_line|cut -d, -f3) local throughput=$(echo $res_line|cut -d, -f4) local throughput_units=$(echo $res_line|cut -d, -f5) - echo "${arch}_${key}_time pass $ns_time ns/op" - add_lava_result_entry "${arch}_${key}_time" "--result" "pass" '--measurement' "${ns_time}" '--units' "ns/op" - echo "${arch}_${key}_time,${ns_time}">>${raw_data} + output_test_result "${arch}_${key}_time" "pass" "${ns_time}" "ns/op" if [ -n "${throughput_units}" ];then - echo "${arch}_${key}_throught pass ${throughput} ${throughput_units}" - add_lava_result_entry "${arch}_${key}_throught" "--result" "pass" '--measurement' "${throughput}" '--units' "${throughput_units}" - echo "${arch}_${key}_throught,${throughput}">>${raw_data} + output_test_result "${arch}_${key}_throught" "pass" "${throughput}" "${throughput_units}" fi hasResult=true done if ! $hasResult; then - echo "${arch}_$line fail" - add_lava_result_entry "${arch}_${line}" "--result" "fail" + output_test_result "${arch}_${line}" "fail" fi - echo "--------------finished $line--------" done fi } -loop_index=0 -while [ ${loop_index} -lt ${loop_times} ]; do +test_func(){ test_bionic_benchmark "64" "BM_property_serial" test_bionic_benchmark "32" "BM_property_serial BM_property_read" - loop_index=$((loop_index + 1)) -done +} + +main(){ + var_test_func="test_func" + run_test "$@" +} -attach_cmd="lava-test-run-attach" -if [ -n "$(which ${attach_cmd})" ] && [ -f "${raw_data}" ]; then - ${attach_cmd} ${raw_data} text/plain -fi +main "$@" |