提交 d63451b4 编写于 作者: M maweiye

Change ohos_unittest to ohos_executable

Signed-off-by: Nmaweiye <maweiye@huawei.com>
上级 d8169193
import("//build/test.gni") import("//build/test.gni")
ohos_unittest("main") { ohos_executable("main") {
module_out_path = "libc-test/src/api" subsystem_name = "musl"
part_name = "libc-test"
sources = [ "main.c" ] sources = [ "main.c" ]
......
...@@ -40,14 +40,13 @@ ohos_static_library("libtest") { ...@@ -40,14 +40,13 @@ ohos_static_library("libtest") {
output_name = "libtest" output_name = "libtest"
} }
ohos_unittest("runtest") { ohos_executable("runtest") {
module_out_path = "libc-test/src/common"
sources = [ "runtest.c" ] sources = [ "runtest.c" ]
configs = [ ":config_runtest" ] configs = [ ":config_runtest" ]
deps = [ ":libtest" ] deps = [ ":libtest" ]
subsystem_name = "musl"
part_name = "libc-test"
} }
config("config_runtest") { config("config_runtest") {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("../../../test_template.gni") import("../../../test_template.gni")
...@@ -26,8 +26,9 @@ group("dlns_test") { ...@@ -26,8 +26,9 @@ group("dlns_test") {
] ]
} }
ohos_unittest("dlns_dlopen_test") { ohos_executable("dlns_dlopen_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
...@@ -38,8 +39,9 @@ ohos_unittest("dlns_dlopen_test") { ...@@ -38,8 +39,9 @@ ohos_unittest("dlns_dlopen_test") {
configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
} }
ohos_unittest("dlns_set_fun_test") { ohos_executable("dlns_set_fun_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
...@@ -50,8 +52,9 @@ ohos_unittest("dlns_set_fun_test") { ...@@ -50,8 +52,9 @@ ohos_unittest("dlns_set_fun_test") {
configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
} }
ohos_unittest("dlns_inherit_test") { ohos_executable("dlns_inherit_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
...@@ -62,8 +65,9 @@ ohos_unittest("dlns_inherit_test") { ...@@ -62,8 +65,9 @@ ohos_unittest("dlns_inherit_test") {
configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
} }
ohos_unittest("dlns_separated_test") { ohos_executable("dlns_separated_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
...@@ -74,8 +78,9 @@ ohos_unittest("dlns_separated_test") { ...@@ -74,8 +78,9 @@ ohos_unittest("dlns_separated_test") {
configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
} }
ohos_unittest("dlns_special_scene_test") { ohos_executable("dlns_special_scene_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
...@@ -86,8 +91,9 @@ ohos_unittest("dlns_special_scene_test") { ...@@ -86,8 +91,9 @@ ohos_unittest("dlns_special_scene_test") {
configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
} }
ohos_unittest("dlns_dlsym_test") { ohos_executable("dlns_dlsym_test") {
module_out_path = "libc-test/src/functionalext/dlns" subsystem_name = "musl"
part_name = "libc-test"
include_dirs = [ include_dirs = [
"../common", "../common",
"//third_party/musl/porting/linux/user/include", "//third_party/musl/porting/linux/user/include",
......
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
# limitations under the License. # limitations under the License.
functionalext_fortify_list = [ functionalext_fortify_list = [
"fcntl", "fcntl_ext",
"poll", "poll",
"socket", "socket_ext",
"stat", "stat_ext",
"unistd", "unistd",
"stdio", "stdio",
"string", "string_ext",
] ]
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
# limitations under the License. # limitations under the License.
functionalext_supplement_locale_test = [ functionalext_supplement_locale_test = [
"duplocale", "duplocale_sup",
"langinfo", "langinfo_sup",
"localeconv", "localeconv_sup",
"newlocale", "newlocale_sup",
"setlocale", "setlocale_sup",
"uselocale", "uselocale_sup",
"strxfrm", "strxfrm",
"wcscoll", "wcscoll",
"wcsxfrm", "wcsxfrm",
......
...@@ -17,7 +17,7 @@ functionalext_supplement_math_test = [ ...@@ -17,7 +17,7 @@ functionalext_supplement_math_test = [
"__signbitf", "__signbitf",
"finite", "finite",
"nanl", "nanl",
"rint", "rint_ext",
"__fpclassifyl", "__fpclassifyl",
"finitef", "finitef",
"significand", "significand",
......
...@@ -50,7 +50,7 @@ functionalext_supplement_network_test = [ ...@@ -50,7 +50,7 @@ functionalext_supplement_network_test = [
"recvmsg", "recvmsg",
"getpeername", "getpeername",
"freeifaddrs", "freeifaddrs",
"getsockopt", "getsockopt_network",
"gai_strerror", "gai_strerror",
"recv", "recv",
"freeaddrinfo", "freeaddrinfo",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# limitations under the License. # limitations under the License.
functionalext_supplement_select_test = [ functionalext_supplement_select_test = [
"poll", "poll_sup",
"pselect", "pselect",
"select", "select",
] ]
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
# limitations under the License. # limitations under the License.
functionalext_supplement_stat_test = [ functionalext_supplement_stat_test = [
"statvfs", "statvfs_sup",
"stat", "stat_sup",
"statfs", "statfs",
"mkfifo", "mkfifo",
"mkfifoat", "mkfifoat",
......
...@@ -20,136 +20,153 @@ default_include_dirs = ...@@ -20,136 +20,153 @@ default_include_dirs =
default_configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ] default_configs = [ "//third_party/musl/libc-test/src/common:config_runtest" ]
default_module_out_path = "libc-test/src/functionalext/supplement/thread" ohos_executable("pthread_attr_getstack_test") {
subsystem_name = "musl"
ohos_unittest("pthread_attr_getstack_test") { part_name = "libc-test"
module_out_path = default_module_out_path
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_attr_getstack.c" ] sources = [ "pthread_attr_getstack.c" ]
} }
ohos_unittest("pthread_attr_setdetachstate_test") { ohos_executable("pthread_attr_setdetachstate_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_attr_setdetachstate.c" ] sources = [ "pthread_attr_setdetachstate.c" ]
} }
ohos_unittest("pthread_attr_setstacksize_test") { ohos_executable("pthread_attr_setstacksize_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_attr_setstacksize.c" ] sources = [ "pthread_attr_setstacksize.c" ]
} }
ohos_unittest("pthread_condattr_destroy_test") { ohos_executable("pthread_condattr_destroy_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_condattr_destroy.c" ] sources = [ "pthread_condattr_destroy.c" ]
} }
ohos_unittest("pthread_condattr_init_test") { ohos_executable("pthread_condattr_init_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_condattr_init.c" ] sources = [ "pthread_condattr_init.c" ]
} }
ohos_unittest("pthread_create_test") { ohos_executable("pthread_create_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_create.c" ] sources = [ "pthread_create.c" ]
} }
ohos_unittest("pthread_exit_test") { ohos_executable("pthread_exit_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_exit.c" ] sources = [ "pthread_exit.c" ]
} }
ohos_unittest("pthread_getattr_np_test") { ohos_executable("pthread_getattr_np_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_getattr_np.c" ] sources = [ "pthread_getattr_np.c" ]
} }
ohos_unittest("pthread_getschedparam_test") { ohos_executable("pthread_getschedparam_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_getschedparam.c" ] sources = [ "pthread_getschedparam.c" ]
} }
ohos_unittest("pthread_getspecific_test") { ohos_executable("pthread_getspecific_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_getspecific.c" ] sources = [ "pthread_getspecific.c" ]
} }
ohos_unittest("pthread_key_create_test") { ohos_executable("pthread_key_create_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_key_create.c" ] sources = [ "pthread_key_create.c" ]
} }
ohos_unittest("pthread_mutex_init_test") { ohos_executable("pthread_mutex_init_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_mutex_init.c" ] sources = [ "pthread_mutex_init.c" ]
} }
ohos_unittest("pthread_mutex_lock_test") { ohos_executable("pthread_mutex_lock_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_mutex_lock.c" ] sources = [ "pthread_mutex_lock.c" ]
} }
ohos_unittest("pthread_mutex_unlock_test") { ohos_executable("pthread_mutex_unlock_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_mutex_unlock.c" ] sources = [ "pthread_mutex_unlock.c" ]
} }
ohos_unittest("pthread_once_test") { ohos_executable("pthread_once_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_once.c" ] sources = [ "pthread_once.c" ]
} }
ohos_unittest("pthread_rwlock_destroy_test") { ohos_executable("pthread_rwlock_destroy_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_rwlock_destroy.c" ] sources = [ "pthread_rwlock_destroy.c" ]
} }
ohos_unittest("pthread_setschedparam_test") { ohos_executable("pthread_setschedparam_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_setschedparam.c" ] sources = [ "pthread_setschedparam.c" ]
} }
ohos_unittest("pthread_setspecific_test") { ohos_executable("pthread_setspecific_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_setspecific.c" ] sources = [ "pthread_setspecific.c" ]
} }
ohos_unittest("pthread_sigmask_test") { ohos_executable("pthread_sigmask_test") {
module_out_path = default_module_out_path subsystem_name = "musl"
part_name = "libc-test"
include_dirs = default_include_dirs include_dirs = default_include_dirs
configs = default_configs configs = default_configs
sources = [ "pthread_sigmask.c" ] sources = [ "pthread_sigmask.c" ]
......
...@@ -32,7 +32,7 @@ functionalext_supplement_thread_test = [ ...@@ -32,7 +32,7 @@ functionalext_supplement_thread_test = [
"pthread_cond_init", "pthread_cond_init",
"pthread_cond_signal", "pthread_cond_signal",
"pthread_cond_wait", "pthread_cond_wait",
"pthread_cond_timedwait", "pthread_cond_timedwait_sup",
"pthread_condattr_setpshared", "pthread_condattr_setpshared",
"pthread_mutexattr_settype", "pthread_mutexattr_settype",
"pthread_getcpuclockid", "pthread_getcpuclockid",
...@@ -65,7 +65,7 @@ functionalext_supplement_thread_test = [ ...@@ -65,7 +65,7 @@ functionalext_supplement_thread_test = [
"pthread_attr_setschedparam", "pthread_attr_setschedparam",
"pthread_attr_setschedpolicy", "pthread_attr_setschedpolicy",
"pthread_attr_setscope", "pthread_attr_setscope",
"pthread_condattr_setclock", "pthread_condattr_setclock_sup",
"pthread_mutexattr_setpshared", "pthread_mutexattr_setpshared",
"pthread_detach", "pthread_detach",
"pthread_rwlock_tryrdlock", "pthread_rwlock_tryrdlock",
...@@ -77,5 +77,5 @@ functionalext_supplement_thread_test = [ ...@@ -77,5 +77,5 @@ functionalext_supplement_thread_test = [
"pthread_spin_unlock", "pthread_spin_unlock",
"pthread_key_delete", "pthread_key_delete",
"pthread_equal", "pthread_equal",
"pthread_rwlock_rdlock", "pthread_rwlock_rdlock_sup",
] ]
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
# limitations under the License. # limitations under the License.
functionalext_supplement_time_test = [ functionalext_supplement_time_test = [
"difftime", "difftime_sup",
"gmtime_r", "gmtime_r_sup",
"gmtime", "gmtime_sup",
"mktime", "mktime_sup",
"time", "time_sup",
"timer_create", "timer_create",
"timer_delete", "timer_delete",
"timer_settime", "timer_settime",
...@@ -24,7 +24,7 @@ functionalext_supplement_time_test = [ ...@@ -24,7 +24,7 @@ functionalext_supplement_time_test = [
"timer_getoverrun", "timer_getoverrun",
"times", "times",
"timespec_get", "timespec_get",
"utime", "utime_sup",
"wcsftime", "wcsftime",
"wcsftime_l", "wcsftime_l",
"nanosleep", "nanosleep",
......
...@@ -10,4 +10,4 @@ ...@@ -10,4 +10,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
functionalext_tgkill_list = [ "tgkill" ] functionalext_tgkill_list = [ "tgkill_ext" ]
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
# limitations under the License. # limitations under the License.
functionalext_thread_list = [ functionalext_thread_list = [
"pthread_cond_timedwait", "pthread_cond_timedwait",
"pthread_mutex", "pthread_mutex_ext",
"pthread_rwlock_rdlock", "pthread_rwlock_rdlock",
"pthread_rwlock_wrlock", "pthread_rwlock_wrlock",
"pthread_guard_size", "pthread_guard_size",
......
...@@ -23,8 +23,8 @@ functionalext_time_test = [ ...@@ -23,8 +23,8 @@ functionalext_time_test = [
"localtime", "localtime",
"mktime", "mktime",
"strftime_l", "strftime_l",
"strftime", "strftime_ext",
"strptime", "strptime_ext",
"time", "time_ext",
"timegm", "timegm",
] ]
import("//build/test.gni") import("//build/test.gni")
ohos_unittest("nativehook_test") { ohos_executable("nativehook_test") {
module_out_path = "libc-test/src/nativehook" subsystem_name = "musl"
part_name = "libc-test"
sources = [ sources = [
"print.c", "print.c",
......
...@@ -27,8 +27,9 @@ template("test_unittest") { ...@@ -27,8 +27,9 @@ template("test_unittest") {
target_name = invoker.target_name target_name = invoker.target_name
target_dir = invoker.target_dir target_dir = invoker.target_dir
target("ohos_unittest", "${target_name}") { target("ohos_executable", "${target_name}") {
module_out_path = "libc-test/src/${target_dir}" subsystem_name = "musl"
part_name = "libc-test"
if (target_cpu == "arm64") { if (target_cpu == "arm64") {
defines = [ "_ARM64_" ] defines = [ "_ARM64_" ]
......
cd /data/tests/libc-test cd /data/tests/libc-test/src
rm src/REPORT rm /data/tests/libc-test/REPORT
touch src/REPORT touch /data/tests/libc-test/REPORT
function FileSuffix() { function FileSuffix() {
local filename="$1" local filename="$1"
...@@ -12,7 +12,8 @@ function FileSuffix() { ...@@ -12,7 +12,8 @@ function FileSuffix() {
#Test cases that need to be shielded #Test cases that need to be shielded
ShieldedList=("trace_stresstest" "fatal_message" "tgkill" "exittest01" "exittest02" ShieldedList=("trace_stresstest" "fatal_message" "tgkill" "exittest01" "exittest02"
"syslog" "vsyslog" "ldso_randomization_manual" "ldso_randomization_test" "dlopen_ext_relro_test") "syslog" "vsyslog" "ldso_randomization_manual" "ldso_randomization_test" "dlopen_ext_relro_test"
"runtest")
function ShieldedCases() { function ShieldedCases() {
for filename in ${ShieldedList[*]} for filename in ${ShieldedList[*]}
...@@ -24,62 +25,18 @@ function ShieldedCases() { ...@@ -24,62 +25,18 @@ function ShieldedCases() {
done done
} }
for dir in src/* for file in `ls *`
do do
if [ -d $dir ]; then if [ "$(FileSuffix ${file})" = "so" ] \
if [ "$dir" = "src/functionalext" ] || [ "$(ShieldedCases ${file})" = "ShieldedCases" ] \
then || [ -d $file ]
# continue then
for subdir in $dir/* continue
do elif [ "$file" = "tgkill" ]
if [ "$subdir" = "src/functionalext/supplement" ] then
then ./runtest -w '' $file 12345 34567 >> /data/tests/libc-test/REPORT
for supplementsubdir in $subdir/* else
do echo $subdir/$file >> FileList
for subfile in `ls $supplementsubdir` ./runtest -w '' $file >> /data/tests/libc-test/REPORT
do
if [ "$(FileSuffix ${subfile})" = "so" ] \
|| [ "$(ShieldedCases ${subfile})" = "ShieldedCases" ] \
|| [ -d ./$supplementsubdir/$subfile ]
then
continue
else
src/common/runtest -w '' ./$supplementsubdir/$subfile >> src/REPORT
fi
done
done
else
for file in `ls $subdir`
do
if [ "$(FileSuffix ${file})" = "so" ] \
|| [ "$(ShieldedCases ${file})" = "ShieldedCases" ] \
|| [ -d ./$subdir/$file ]
then
continue
else
# echo file=$subdir/$file
src/common/runtest -w '' ./$subdir/$file >> src/REPORT
fi
done
fi
done
else
# continue
for file in `ls $dir`
do
if [ "$file" = "runtest" ] \
|| [ "$(FileSuffix ${file})" = "so" ] \
|| [ -d $file ]
then
continue
elif [ "$file" = "tgkill" ]
then
src/common/runtest -w '' $dir/$file 12345 34567 >> src/REPORT
else
# echo file=$dir/$file
src/common/runtest -w '' $dir/$file >> src/REPORT
fi
done
fi
fi fi
done done
\ No newline at end of file
...@@ -6,12 +6,11 @@ set LOCAL=\\wsl$\ubuntu-20.04\home\code\OHOS ...@@ -6,12 +6,11 @@ set LOCAL=\\wsl$\ubuntu-20.04\home\code\OHOS
set OUTDIR=out\rk3568 set OUTDIR=out\rk3568
@REM 本地用例生成目录 @REM 本地用例生成目录
set TESTDIR=%LOCAL%\%OUTDIR%\tests\unittest\libc-test\src set TESTDIR=%LOCAL%\%OUTDIR%\musl\libc-test
set TESTDIRFEXT=%LOCAL%\%OUTDIR%\tests\unittest\libc-test\src\functionalext
@REM 动态链接库生成目录 @REM 动态链接库生成目录
set DYNLIB=%LOCAL%\%OUTDIR%\musl\libc-test-lib set DYNLIB=%LOCAL%\%OUTDIR%\musl\libc-test-lib
@REM 远程传输目标目录 @REM 远程传输目标目录
set REMOTE=/data/tests/libc-test/src set REMOTE=/data/tests/libc-test
set REMOTEFEXT=/data/tests/libc-test/src/functionalext set REMOTEFEXT=/data/tests/libc-test/src/functionalext
set REMOTESYSTEM=/system/lib set REMOTESYSTEM=/system/lib
@REM runtest脚本所在目录 @REM runtest脚本所在目录
...@@ -22,19 +21,29 @@ set /a startS=%time:~6,2% ...@@ -22,19 +21,29 @@ set /a startS=%time:~6,2%
set /a startM=%time:~3,2% set /a startM=%time:~3,2%
@REM 检查设备是否连接 @REM 检查设备是否连接
echo HDC device checking... echo checking HDC device
for /F "usebackq delims==" %%c in (`hdc list targets`) DO ( for /F "usebackq delims==" %%c in (`hdc list targets`) DO (
echo Device list: echo Device list:
echo %%c | findstr "[Empty]" && goto noDevice || echo %%c && goto hdcStart echo %%c | findstr "[Empty]" && goto noDevice || echo %%c && goto CheckDirectory
) )
:CheckDirectory
echo checking TESTDIR
if exist %TESTDIR% (
echo TESTDIR: %TESTDIR%
) else (
echo Error: path "%TESTDIR%" was not found.
goto end
)
@REM 在单板创建目录, 需要预先创建好才能传输到相应位置。 @REM 在单板创建目录, 需要预先创建好才能传输到相应位置。
:hdcStart :hdcStart
echo. echo.
echo now mkdir... echo now mkdir...
hdc shell mkdir /data/tests hdc shell mkdir /data/tests
hdc shell mkdir /data/tests/libc-test
hdc shell mkdir %REMOTE% hdc shell mkdir %REMOTE%
hdc shell mkdir %REMOTE%/src
@REM 创建临时文件夹,用于存放用例生成的临时文件 @REM 创建临时文件夹,用于存放用例生成的临时文件
hdc shell mkdir /tmp hdc shell mkdir /tmp
...@@ -44,149 +53,26 @@ goto hdcSend ...@@ -44,149 +53,26 @@ goto hdcSend
@REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录 @REM 传输文件,单板上执行runtest.sh,将结果REPORT返回到.bat所在目录
:hdcSend :hdcSend
for /D %%i in (%TESTDIR%\*) do ( for %%i in (%TESTDIR%\*) do (
echo [MKdir] %REMOTE%/%%~ni echo %%i
hdc shell mkdir %REMOTE%/%%~ni hdc file send %%i %REMOTE%/src
@REM Check local subdirectory
for /D %%j in (%%i\*) do (
echo [MKdir] %REMOTE%/%%~ni/%%~nj
hdc shell mkdir %REMOTE%/%%~ni/%%~nj
@REM Check local subdirectory
for /D %%m in (%%j\*) do (
echo [MKdir] %REMOTE%/%%~ni/%%~nj/%%~nm
hdc shell mkdir %REMOTE%/%%~ni/%%~nj/%%~nm
@REM Check local subdirectory
for /D %%p in (%%m\*) do (
echo [MKdir] %REMOTE%/%%~ni/%%~nj/%%~nm/%%~np
hdc shell mkdir %REMOTE%/%%~ni/%%~nj/%%~nm/%%~np
@REM Send test cases to remote subdirectory
for %%q in (%%~p\*) do (
echo Sending %%q %REMOTE%/%%~ni/%%~nj/%%~nm/%%~np
hdc file send %%q %REMOTE%/%%~ni/%%~nj/%%~nm/%%~np
)
)
@REM Send test cases to remote subdirectory
for %%o in (%%~m\*) do (
echo Sending %%o %REMOTE%/%%~ni/%%~nj/%%~nm
hdc file send %%o %REMOTE%/%%~ni/%%~nj/%%~nm
)
hdc shell chmod +x %REMOTE%/%%~ni/%%~nj/%%~nm/*
)
@REM Send test cases to remote subdirectory
for %%k in (%%~j\*) do (
echo Sending %%k %REMOTE%/%%~ni/%%~nj
hdc file send %%k %REMOTE%/%%~ni/%%~nj
)
hdc shell chmod +x %REMOTE%/%%~ni/%%~nj/*
)
@REM Send test cases to remote directory
for %%l in (%%~i\*) do (
echo hdc file send %%l %REMOTE%/%%~ni
hdc file send %%l %REMOTE%/%%~ni
)
hdc shell chmod +x %REMOTE%/%%~ni/*
) )
for %%j in (%DYNLIB%\*) do (
echo %%j
hdc file send %%j %REMOTE%/src
)
hdc shell chmod +x %REMOTE%/src/*
@REM 动态库传输
hdc shell mount -o rw,remount / hdc shell mount -o rw,remount /
hdc shell chmod 777 /etc hdc shell chmod 777 /etc
hdc file send %LOCAL%\third_party\musl\porting\linux\user\ldso\ld-musl-namespace.ini /etc/ld-musl-namespace.ini
hdc file send %DYNLIB%\libdlopen_dso.so %REMOTE%/functional/libdlopen_dso.so
hdc file send %DYNLIB%\libdlopen_ns_dso.so %REMOTE%/functional/libdlopen_ns_dso.so
hdc file send %DYNLIB%\libdlclose_reset_dso.so %REMOTE%/functional/libdlclose_reset_dso.so
hdc file send %DYNLIB%\libtls_align_dso.so %REMOTE%/functional/libtls_align_dso.so
hdc file send %DYNLIB%\libtls_init_dso.so %REMOTE%/functional/libtls_init_dso.so
hdc file send %DYNLIB%\libtls_get_new-dtv_dso.so %REMOTE%/regression/libtls_get_new-dtv_dso.so
hdc file send %DYNLIB%\libdlopen_ns_dso.so %REMOTEFEXT%/dlns/libdlopen_ns_dso.so
hdc file send %DYNLIB%\libdlopen_ns_dso.so %REMOTESYSTEM%/libdlopen_ns_dso.so
hdc file send %DYNLIB%\libdso_easy_symver.so %REMOTESYSTEM%/libdso_easy_symver.so
hdc file send %DYNLIB%\libdso_hard_symver.so %REMOTESYSTEM%/libdso_hard_symver.so
hdc file send %DYNLIB%\libdso_no_symver.so %REMOTESYSTEM%/libdso_no_symver.so
hdc file send %DYNLIB%\libdso_symver.so %REMOTESYSTEM%/libdso_symver.so
hdc file send %DYNLIB%\libldso_randomization_dep.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep.so
hdc file send %DYNLIB%\libldso_randomization_dep_a.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep_a.so
hdc file send %DYNLIB%\libldso_randomization_dep_b.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep_b.so
hdc file send %DYNLIB%\libldso_randomization_dep_c.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep_c.so
hdc file send %DYNLIB%\libldso_randomization_dep_d.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep_d.so
hdc file send %DYNLIB%\libldso_randomization_dep_e.so %REMOTEFEXT%/ldso_randomization/libldso_randomization_dep_e.so
hdc file send %DYNLIB%\libdlopen_ext_relro_dso.so %REMOTEFEXT%/relro/libdlopen_ext_relro_dso.so
@REM 构造测试所需环境
hdc shell mkdir %REMOTE%/functionalext/dlns/A
hdc shell mkdir %REMOTE%/functionalext/dlns/B
hdc shell mkdir %REMOTE%/functionalext/dlns/C
hdc shell mkdir %REMOTE%/functionalext/dlns/D
hdc file send %DYNLIB%\libdlns_dlsym_dep_a.so %REMOTEFEXT%/dlns/A/libdlns_dlsym_dep_a.so
hdc file send %DYNLIB%\libdlns_dlsym_dep_b.so %REMOTEFEXT%/dlns/B/libdlns_dlsym_dep_b.so
hdc file send %DYNLIB%\libdlns_dlsym_dep_c.so %REMOTEFEXT%/dlns/C/libdlns_dlsym_dep_c.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/sharedlibtest.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/B/libB.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/C/libC.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/D/libD.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/separated_0900.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/set_lib_path_0200.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_0300.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_0700.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_0800.so
hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_1100.so
hdc shell cp /etc/ld-musl-namespace-arm.ini /etc/ld-musl-namespace-arm-temp.ini
hdc shell mv /etc/ld-musl-namespace-arm-test.ini /etc/ld-musl-namespace-arm.ini
@REM 修改动态库权限
hdc shell chmod a+x %REMOTE%/functional/libdlopen_dso.so
hdc shell chmod a+x %REMOTE%/functional/libdlopen_ns_dso.so
hdc shell chmod a+x %REMOTE%/functional/libdlclose_reset_dso.so
hdc shell chmod a+x %REMOTE%/functional/libtls_align_dso.so
hdc shell chmod a+x %REMOTE%/functional/libtls_init_dso.so
hdc shell chmod a+x %REMOTE%/regression/libtls_get_new-dtv_dso.so
echo Test cases sending finished.
echo.
goto sendSH
@REM 发送脚本并执行用例
:sendSH
echo Sending runtest.sh
hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh hdc file send %SHDIR%\runtest.sh %REMOTE%/runtest.sh
hdc shell chmod a+x %REMOTE%/runtest.sh hdc shell chmod +x %REMOTE%/runtest.sh
echo runtest.sh has been transported. hdc shell %REMOTE%/runtest.sh
echo.
echo hdc shell .%REMOTE%/runtest.sh
hdc shell .%REMOTE%/runtest.sh
echo.
echo ================================
echo The test cases have been executed.
@REM 恢复现场
echo Start restore the scene
echo hdc shell mv /etc/ld-musl-namespace-arm.ini /etc/ld-musl-namespace-arm-test.ini
echo ...
hdc shell cp /etc/ld-musl-namespace-arm.ini /etc/ld-musl-namespace-arm-test.ini
hdc shell mv /etc/ld-musl-namespace-arm-temp.ini /etc/ld-musl-namespace-arm.ini
hdc shell rm %REMOTEFEXT%/dlns/sharedlibtest.so -rf
hdc shell rm %REMOTEFEXT%/dlns/B/libB.so -rf
hdc shell rm %REMOTEFEXT%/dlns/C/libC.so -rf
hdc shell rm %REMOTEFEXT%/dlns/D/libD.so -rf
hdc shell rm %REMOTEFEXT%/dlns/separated_0900.so -rf
hdc shell rm %REMOTEFEXT%/dlns/set_lib_path_0200.so -rf
hdc shell rm %REMOTEFEXT%/dlns/inherit_0300.so -rf
hdc shell rm %REMOTEFEXT%/dlns/inherit_0700.so -rf
hdc shell rm %REMOTEFEXT%/dlns/inherit_0800.so -rf
hdc shell rm %REMOTEFEXT%/dlns/inherit_1100.so -rf
hdc shell rm /dev/shm -rf
echo.
echo hdc file recv %REMOTE%/REPORT %~dp0REPORT echo hdc file recv %REMOTE%/REPORT %~dp0REPORT
hdc file recv %REMOTE%/REPORT %~dp0REPORT hdc file recv %REMOTE%/REPORT %~dp0REPORT
goto end
@REM 提示检查设备连接。
:noDevice
echo Device not found,please check your device.
goto end
@REM 完成所用时间
:end :end
echo. echo.
set /a endS=%time:~6,2% set /a endS=%time:~6,2%
...@@ -194,17 +80,5 @@ set /a endM=%time:~3,2% ...@@ -194,17 +80,5 @@ set /a endM=%time:~3,2%
set /a diffS_=%endS%-%startS% set /a diffS_=%endS%-%startS%
set /a diffM_=%endM%-%startM% set /a diffM_=%endM%-%startM%
@REM REPORT文件比较
start python %LOCAL%\third_party\musl\scripts\compare.py
if exist "%LOCAL%\third_party\musl\scripts\\result.html" (
echo Test failed,please checking result.html!
) else (
echo Test successful!
)
echo file compareing finished
echo All items finished.
echo Time cost:%diffM_%m%diffS_%s .
echo.
pause pause
exit exit
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册