runtest_linux.sh 5.2 KB
Newer Older
H
hhj 已提交
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
#!/bin/bash

# Copyright (c) 2023 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

LOCAL="unknown_dir"
OUTDIR=out/rk3568
CMD=hdc_std
ARCH=arm

function usage {
    echo "usage: $0 -r {source root} -p {product name in out(eg rk3568)}"
    exit 1
}

while getopts ":r:p:" opt
do
    case $opt in
        r)
            LOCAL=$OPTARG
            ;;
        p)
            OUTDIR=out/$OPTARG
            ;;
        ?)
            echo "unknown options $opt"
            usage
            exit 1
            ;;
    esac
done

TESTDIR=${LOCAL}/${OUTDIR}/musl/libc-test
DYNLIB=${LOCAL}/${OUTDIR}/musl/libc-test-lib
SHDIR=${LOCAL}/third_party/musl/scripts
REMOTE=/data/tests/libc-test
REMOTESYSTEM=/system/lib

echo checking HDC device....
for device in $($CMD list targets); do 
    device=$(echo $device | tr -d '\n\r')
    if [ $device == "[Empty]" ]; then
        echo Device not found, please check your device.
        exit 1
    fi
done

ABILIST=$(${CMD} shell param get const.product.cpu.abilist)
echo $ABILIST

if [ $ABILIST == "arm64-v8a" ]; then
    ARCH=aarch64
fi
echo detect arch = ${ARCH}


echo checking TESTDIR
if [ ! -d ${TESTDIR} ]; then
    echo Error: path "${TESTDIR}" was not found.
    exit 1
fi


echo now mkdir
${CMD} shell rm -rf ${REMOTE}
${CMD} shell mkdir /data/tests
${CMD} shell mkdir ${REMOTE}

#mk temp directory
${CMD} shell mkdir /tmp
${CMD} shell mkdir /dev/shm
echo Mkdir done.


${CMD} file send ${TESTDIR} ${REMOTE}/src
for lib in ${DYNLIB}/*; do
    echo $lib
    ${CMD} file send $lib ${REMOTE}/src
done

${CMD} shell chmod +x ${REMOTE}/src/*
${CMD} shell mount -o rw,remount /
${CMD} shell chmod 777 /etc
${CMD} shell cp /etc/ld-musl-namespace-${ARCH}.ini /etc/ld-musl-namespace-${ARCH}.ini.bak
${CMD} file send ${LOCAL}/third_party/musl/porting/linux/user/config/ld-musl-namespace-${ARCH}-test.ini /etc/ld-musl-namespace-${ARCH}.ini
${CMD} shell mkdir ${REMOTE}/src/A
${CMD} shell mkdir ${REMOTE}/src/B
${CMD} shell mkdir ${REMOTE}/src/C
${CMD} shell mkdir ${REMOTE}/src/D
${CMD} shell mv ${REMOTE}/src/libdlns_dlsym_dep_a.so ${REMOTE}/src/A
${CMD} shell mv ${REMOTE}/src/libdlns_dlsym_dep_b.so ${REMOTE}/src/B
${CMD} shell mv ${REMOTE}/src/libdlns_dlsym_dep_c.so ${REMOTE}/src/C
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/B/libB.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/C/libC.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/D/libD.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/sharedlibtest.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/set_lib_path_0200.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/inherit_0300.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/inherit_0700.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/inherit_0800.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/inherit_1100.so
${CMD} shell cp ${REMOTE}/src/libdlopen_ns_dso.so /system/lib
Y
yinchuang 已提交
113 114 115 116 117 118
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/lib_for_no_delete.so
${CMD} shell cp ${REMOTE}/src/libdlopen_dso.so ${REMOTE}/src/lib_for_dlopen.so
${CMD} shell cp ${REMOTE}/src/libdlopen_ns_dso.so /system/lib64/libdlopen_ns_dso_sys.so
${CMD} shell cp ${REMOTE}/src/libdlopen_ns_dso.so /system/lib64/ndk/libdlopen_ns_dso_ndk.so
${CMD} shell cp ${REMOTE}/src/libdlopen_ns_dso.so /system/lib/libdlopen_ns_dso_sys.so
${CMD} shell cp ${REMOTE}/src/libdlopen_ns_dso.so /system/lib/ndk/libdlopen_ns_dso_ndk.so
H
hhj 已提交
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163

${CMD} shell mv ${REMOTE}/src/zh_CN /tmp/zh_CN

${CMD} file send ${SHDIR}/runtest.sh ${REMOTE}/runtest.sh
${CMD} shell chmod +x ${REMOTE}/runtest.sh
${CMD} shell ${REMOTE}/runtest.sh


echo hdc file recv ${REMOTE}/REPORT ${SHDIR}/REPORT
${CMD} file recv ${REMOTE}/REPORT ${SHDIR}/REPORT

if [ -f FileList.txt ]; then
	rm FileList.txt
fi
if [ -f Summary.txt ]; then
	rm Summary.txt
fi
${CMD} file recv ${REMOTE}/FileList.txt ${SHDIR}/FileList.txt
${CMD} file recv ${REMOTE}/SkipList.txt ${SHDIR}/SkipList.txt
#
#for /f "delims=:" %%a in ('dir /b "${TESTDIR}" ^| findstr /n .*') do set all=%%a
all=$(ls -l ${TESTDIR} | grep "^-" | wc -l)
#for /f %%b in (' find /c /v "" ^<"FileList.txt" ') do set /a run=%%b
run=$(cat -t ${SHDIR}/FileList.txt | grep -v ^\s*$ | wc -l)
#for /f %%c in (' find /c "FAIL" ^<"REPORT" ') do set fail=%%c
fail=$(cat -t ${SHDIR}/REPORT | grep '^FAIL ' | wc -l)
#
#
echo ===================================
pass=$[$run - $fail]
skip=$[$all - $run]
#
echo "SUMMARY
echo All: ${all} | Run: ${run} | Skip: ${skip}
echo Pass: [${pass}/${run}]
echo Fail: [${fail}/${run}]
" | tee Summary.txt

#
echo "[Failed List]: 
$(cat -t ${SHDIR}/REPORT | grep '^FAIL ')
" | tee -a Summary.txt
echo "[Skip List]:  " | tee -a Summary.txt

cat ${SHDIR}/SkipList.txt | tee -a Summary.txt