Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
762a356a
Commit
762a356a
authored
10 years ago
by
Yohei Yukawa
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Add native unittest support on target devices for LatinIME"
parents
593fe9b0
7f4cca0c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
native/jni/Android.mk
+3
-0
3 additions, 0 deletions
native/jni/Android.mk
native/jni/TargetUnitTests.mk
+55
-0
55 additions, 0 deletions
native/jni/TargetUnitTests.mk
native/jni/run-tests.sh
+46
-7
46 additions, 7 deletions
native/jni/run-tests.sh
with
104 additions
and
7 deletions
native/jni/Android.mk
+
3
−
0
View file @
762a356a
...
...
@@ -92,3 +92,6 @@ include $(LOCAL_PATH)/CleanupNativeFileList.mk
#################### Unit test on host environment
include
$(LOCAL_PATH)/HostUnitTests.mk
#################### Unit test on target environment
include
$(LOCAL_PATH)/TargetUnitTests.mk
This diff is collapsed.
Click to expand it.
native/jni/TargetUnitTests.mk
0 → 100644
+
55
−
0
View file @
762a356a
# Copyright (C) 2014 The Android Open Source Project
#
# 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_PATH
:=
$(
call my-dir
)
######################################
include
$(CLEAR_VARS)
include
$(LOCAL_PATH)/NativeFileList.mk
#################### Target library for unit test
LATIN_IME_SRC_DIR
:=
src
LOCAL_CFLAGS
+=
-std
=
c++11
-Wno-unused-parameter
-Wno-unused-function
LOCAL_CLANG
:=
true
LOCAL_C_INCLUDES
+=
$(
LOCAL_PATH
)
/
$(
LATIN_IME_SRC_DIR
)
LOCAL_MODULE
:=
liblatinime_target_static_for_unittests
LOCAL_MODULE_TAGS
:=
optional
LOCAL_SRC_FILES
:=
$(
addprefix
$(
LATIN_IME_SRC_DIR
)
/,
$(
LATIN_IME_CORE_SRC_FILES
))
# Here intentionally use libc++_shared rather than libc++_static because
# $(BUILD_NATIVE_TEST) has not yet supported libc++_static.
LOCAL_SDK_VERSION
:=
14
LOCAL_NDK_STL_VARIANT
:=
c++_shared
include
$(BUILD_STATIC_LIBRARY)
#################### Target native tests
include
$(CLEAR_VARS)
LATIN_IME_TEST_SRC_DIR
:=
tests
LOCAL_CFLAGS
+=
-std
=
c++11
-Wno-unused-parameter
-Wno-unused-function
LOCAL_CLANG
:=
true
LOCAL_C_INCLUDES
+=
$(
LOCAL_PATH
)
/
$(
LATIN_IME_SRC_DIR
)
LOCAL_MODULE
:=
liblatinime_target_unittests
LOCAL_MODULE_TAGS
:=
tests
LOCAL_SRC_FILES
:=
\
$(
addprefix
$(
LATIN_IME_TEST_SRC_DIR
)
/,
$(
LATIN_IME_CORE_TEST_FILES
))
LOCAL_STATIC_LIBRARIES
+=
liblatinime_target_static_for_unittests
# Here intentionally include external/libcxx/libcxx.mk rather because
# $(BUILD_NATIVE_TEST) fails when LOCAL_NDK_STL_VARIANT is specified.
include
external/libcxx/libcxx.mk
include
$(BUILD_NATIVE_TEST)
#################### Clean up the tmp vars
LATIN_IME_SRC_DIR
:=
LATIN_IME_TEST_SRC_DIR
:=
include
$(LOCAL_PATH)/CleanupNativeFileList.mk
This diff is collapsed.
Click to expand it.
native/jni/run-tests.sh
+
46
−
7
View file @
762a356a
...
...
@@ -13,17 +13,56 @@
# See the License for the specific language governing permissions and
# limitations under the License.
function
usage
()
{
echo
"usage: source run-tests.sh [--host] [--target] [-h] [--help]"
1>&2
echo
" --host: run test on the host environment"
1>&2
echo
" --no-host: skip host test"
1>&2
echo
" --target: run test on the target environment"
1>&2
echo
" --no-target: skip target device test"
1>&2
}
# check script arguments
if
[[
$(
type
-t
mmm
)
!=
function
]]
;
then
echo
"Usage:"
1>&2
echo
" source
$0
"
1>&2
echo
" or"
1>&2
echo
" .
$0
"
1>&2
usage
if
[[
${
BASH_SOURCE
[0]
}
!=
$0
]]
;
then return
;
else
exit
1
;
fi
fi
show_usage
=
no
enable_host_test
=
yes
enable_target_device_test
=
no
while
[
"
$1
"
!=
""
]
do
case
"
$1
"
in
"-h"
)
show_usage
=
yes
;;
"--help"
)
show_usage
=
yes
;;
"--target"
)
enable_target_device_test
=
yes
;;
"--no-target"
)
enable_target_device_test
=
no
;;
"--host"
)
enable_host_test
=
yes
;;
"--no-host"
)
enable_host_test
=
no
;;
esac
shift
done
if
[[
$show_usage
==
yes
]]
;
then
usage
if
[[
${
BASH_SOURCE
[0]
}
!=
$0
]]
;
then return
;
else
exit
1
;
fi
fi
target_test_name
=
liblatinime_target_unittests
host_test_name
=
liblatinime_host_unittests
pushd
$PWD
>
/dev/null
cd
$(
gettop
)
mmm
-j16
packages/inputmethods/LatinIME/native/jni
||
\
make
-j16
liblatinime_host_unittests
${
ANDROID_HOST_OUT
}
/bin/liblatinime_host_unittests
popd
>
/dev/null
\ No newline at end of file
make
-j16
adb
$target_test_name
$host_test_name
if
[[
$enable_host_test
==
yes
]]
;
then
$ANDROID_HOST_OUT
/bin/
$host_test_name
fi
if
[[
$enable_target_device_test
==
yes
]]
;
then
target_test_local
=
$ANDROID_PRODUCT_OUT
/data/nativetest/
$target_test_name
/
$target_test_name
target_test_device
=
/data/nativetest/
$target_test_name
/
$target_test_name
adb push
$target_test_local
$target_test_device
adb shell
$target_test_device
adb shell
rm
-rf
$target_test_device
fi
popd
>
/dev/null
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment