• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2cd /data/tests/libc-test/src
3rm /data/tests/libc-test/REPORT
4rm /data/tests/libc-test/FileList.txt
5rm /data/tests/libc-test/SkipList.txt
6touch /data/tests/libc-test/REPORT
7touch /data/tests/libc-test/FileList.txt
8touch /data/tests/libc-test/SkipList.txt
9echo 'root:This.is.a.test:18997:0:99999:7:::'>/etc/shadow
10param set debug.hitrace.tags.enableflags 1
11
12ARCH=arm
13ABILIST=$(param get const.product.cpu.abilist)
14if [ $ABILIST == "arm64-v8a" ]; then
15    ARCH=aarch64
16fi
17
18function FileSuffix() {
19    local filename="$1"
20    if [ -n "$filename" ]; then
21        echo "${filename##*.}"
22    fi
23}
24
25#Test cases that need to be shielded
26ShieldedList=("trace_stresstest" "syslog" "vsyslog" "runtest"
27#Failed when running by shell, need to be run manually
28"tgkill_ext" "exittest02" "stat" "isatty" "ttyname" "a_stack_chk_fail"
29"ldso_randomization_manual" "ldso_randomization_test"
30"tcgetattr" "tcgetpgrp" "tcgetsid" "tcsendbreak" "tcsetattr" "tcsetpgrp"
31#These need run with special condiction
32"pthread_atfork-errno-clobber" "flockfile-list"
33#Symbol hidden
34"dlns_set_fun_test" "dlns_inherit_test" "dlns_separated_test"
35"unittest_ldso_ns_config" "unittest_ldso_dynlink"
36#Some math test cases need to skip.
37"acoshl" "asinhl" "erfcl" "fenv" "fma" "fmaf" "fmal" "lgammal" "nearbyint" "nearbyintf"
38"nearbyintl" "rint" "rintf" "rintl" "sqrt" "sqrtf" "sqrtl" "tgammal"
39#TODO-arm32
40"malloc-brk-fail" "pthread_cancel" "res_send"
41)
42
43#TODO-aarch64
44if [ $ARCH == "aarch64" ]; then
45  ShieldedList+=("faccessat" "signal" "unittest_hilog_vsnprint" "yn")
46fi
47
48for skiped in ${ShieldedList[*]};do
49    echo $skiped >> /data/tests/libc-test/SkipList.txt
50done
51
52function ShieldedCases() {
53	for filename in ${ShieldedList[*]}
54	do
55		if [ "$1" = "$filename" ];
56		then
57			echo "ShieldedCases"
58		fi
59	done
60}
61
62gwpasanTestList=(
63    "gwp_asan_buffer_overflow_test"
64    "gwp_asan_buffer_underflow_test"
65    "gwp_asan_double_free_test"
66    "gwp_asan_invalid_free_left_test"
67    "gwp_asan_invalid_free_right_test"
68    "gwp_asan_use_after_free_test"
69    "gwp_asan_unwind_test"
70    "gwp_asan_smoke_test"
71    "gwp_asan_random_sample_test"
72)
73
74function IsGwpasanTest() {
75	for filename in ${gwpasanTestList[*]}
76	do
77		if [ "$1" = "$filename" ];
78		then
79			echo "yes"
80		fi
81	done
82}
83
84for file in `ls *`
85do
86	if [ "$(FileSuffix ${file})" = "so" ] \
87	|| [ "$(ShieldedCases ${file})" = "ShieldedCases" ] \
88	|| [ "$(IsGwpasanTest ${file})" = "yes" ] \
89	|| [ -d $file ]
90	then
91		continue
92	elif [ -x $file ] && [ -s $file ]
93	then
94		echo $file >> /data/tests/libc-test/FileList.txt
95		if [ "$file" = "tgkill" ]
96		then
97			./runtest -w '' $file 12345 34567 >> /data/tests/libc-test/REPORT
98		else
99			./runtest -w '' -t 30 $file >> /data/tests/libc-test/REPORT
100		fi
101	fi
102done
103
104echo "--- gwp_asan test running --- " >> /data/tests/libc-test/REPORT
105# gwp_asan test need to be executed at last.
106for file in `ls *`
107do
108	if [ "$(IsGwpasanTest ${file})" = "yes" ]
109	then
110		echo $file >> /data/tests/libc-test/FileList.txt
111
112		param set gwp_asan.log.path file
113		param set gwp_asan.enable.app.${file} true
114		if [ "${file}" != "gwp_asan_random_sample_test" ]
115		then
116			param set gwp_asan.sample.all true
117		fi
118
119		echo "*** ${file} running ***" >> /data/tests/libc-test/REPORT
120		./${file} >> /data/tests/libc-test/REPORT
121		echo "*** ${file} done *** " >> /data/tests/libc-test/REPORT
122		param set gwp_asan.log.path default
123		param set gwp_asan.enable.app.${file} false
124		if [ "${file}" != "gwp_asan_random_sample_test" ]
125		then
126			param set gwp_asan.sample.all false
127		fi
128	fi
129done
130echo "--- gwp_asan test done ---" >> /data/tests/libc-test/REPORT