Build ICU4C's cintltst and intltest
am: b7de1899a0

Change-Id: I805cb149346b2838fe8025913aeb5249bb03057a
diff --git a/icu4c/source/Android.bp b/icu4c/source/Android.bp
index 33fa3e8..e358c26 100644
--- a/icu4c/source/Android.bp
+++ b/icu4c/source/Android.bp
@@ -15,8 +15,18 @@
 subdirs = [
     "common",
     "i18n",
+    "test",
+    "tools/ctestfw",
+    "tools/toolutil",
 ]
 
+filegroup {
+    name: "icu4c_test_data",
+    srcs: [
+        "test/testdata/**/*",
+    ],
+}
+
 cc_library {
     name: "libicuuc_stubdata",
     host_supported: true,
diff --git a/icu4c/source/test/Android.bp b/icu4c/source/test/Android.bp
new file mode 100644
index 0000000..16c913b
--- /dev/null
+++ b/icu4c/source/test/Android.bp
@@ -0,0 +1,49 @@
+// Copyright (C) 2018 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.
+
+subdirs = [
+    "cintltst",
+    "intltest",
+]
+
+cc_defaults {
+    name: "icu_test_defaults",
+    gtest: false,
+    data: [":icu4c_test_data"],
+    rtti: true,
+    cflags: [
+        "-Wno-deprecated-declarations",
+        "-Wno-missing-field-initializers",
+        "-Wno-unused-function",
+        "-Wno-unused-parameter",
+        "-Wno-unused-variable",
+    ],
+    c_std: "c11",
+    cpp_std: "c++11",
+    shared_libs: [
+        "libicuuc",
+        "libicui18n",
+        "libbase",
+        "liblog",
+    ],
+
+    static_libs: [
+        "libicuctest",
+        "libicutoolutil",
+        "libandroidicuinit",
+    ],
+    host_required: [
+        "ICU4CTestRunner",
+    ],
+}
diff --git a/icu4c/source/test/cintltst/Android.bp b/icu4c/source/test/cintltst/Android.bp
new file mode 100644
index 0000000..d410c3f
--- /dev/null
+++ b/icu4c/source/test/cintltst/Android.bp
@@ -0,0 +1,40 @@
+// Copyright (C) 2018 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.
+
+cc_test {
+    name: "cintltst",
+    defaults: ["icu_test_defaults"],
+    multilib: {
+        lib64: {
+            suffix: "64",
+        },
+        lib32: {
+            suffix: "32",
+        },
+    },
+    srcs: [
+        "**/*.c",
+        "**/*.cpp",
+    ],
+    cflags: [
+        "-DANDROID_LINK_SHARED_ICU4C",
+        "-DANDROID_USE_ICU_REG",
+        // Disable some file IO tests to workaround test crashing due to missing data files.
+        "-DUCONFIG_NO_FILE_IO",
+    ],
+    exclude_srcs: [
+        // Not built directly, but #included from other sources.
+        "usrchdat.c",
+    ],
+}
diff --git a/icu4c/source/test/cintltst/AndroidTest.xml b/icu4c/source/test/cintltst/AndroidTest.xml
new file mode 100644
index 0000000..47fc1f2
--- /dev/null
+++ b/icu4c/source/test/cintltst/AndroidTest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<configuration description="Config for CTS ICU4C test cases">
+    <option name="config-descriptor:metadata" key="component" value="icu4c" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="cintltst->/data/local/tmp/cintltst" />
+        <option name="append-bitness" value="true" />
+    </target_preparer>
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="test->/data/local/tmp/test" />
+    </target_preparer>
+
+    <test class="com.android.tradefed.testtype.HostTest" >
+        <option name="jar" value="ICU4CTestRunner.jar" />
+        <option name="set-option" value="module-name:cintltst" />
+        <option name="set-option" value="runtime-hint:20s" />
+        <option name="set-option" value="no-fail-data-errors:true" />
+        <option name="set-option" value="native-test-timeout:300000" />
+    </test>
+</configuration>
diff --git a/icu4c/source/test/intltest/Android.bp b/icu4c/source/test/intltest/Android.bp
new file mode 100644
index 0000000..bc283e3
--- /dev/null
+++ b/icu4c/source/test/intltest/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2018 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.
+
+cc_test {
+    name: "intltest",
+    defaults: ["icu_test_defaults"],
+    multilib: {
+        lib64: {
+            suffix: "64",
+        },
+        lib32: {
+            suffix: "32",
+        },
+    },
+
+    cflags: [
+        "-DANDROID_LINK_SHARED_ICU4C",
+        // Force the test to use the data file on
+        "-DANDROID_USE_ICU_REG",
+        // Needed for char* shift calculation in the test.
+        "-Wno-string-plus-int",
+    ],
+    srcs: [
+        "**/*.c",
+        "**/*.cpp",
+    ],
+    exclude_srcs: [
+        "numberformat2test.cpp",
+    ],
+}
diff --git a/icu4c/source/test/intltest/AndroidTest.xml b/icu4c/source/test/intltest/AndroidTest.xml
new file mode 100644
index 0000000..28dd667
--- /dev/null
+++ b/icu4c/source/test/intltest/AndroidTest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<configuration description="Config for ICU4C intltest">
+    <option name="test-suite-tag" value="intltest" />
+    <option name="test-suite-tag" value="apct" />
+    <option name="config-descriptor:metadata" key="component" value="icu4c" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="intltest->/data/local/tmp/intltest" />
+        <option name="append-bitness" value="true" />
+    </target_preparer>
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="test->/data/local/tmp/test" />
+    </target_preparer>
+
+    <test class="com.android.tradefed.testtype.HostTest" >
+        <option name="jar" value="ICU4CTestRunner.jar" />
+        <option name="set-option" value="module-name:intltest" />
+        <option name="set-option" value="runtime-hint:1m30s" />
+        <option name="set-option" value="no-fail-data-errors:true" />
+        <!-- test-timeout unit is ms, value = 10 minutes -->
+        <option name="set-option" value="native-test-timeout:600000" />
+    </test>
+
+</configuration>
diff --git a/icu4c/source/tools/ctestfw/Android.bp b/icu4c/source/tools/ctestfw/Android.bp
new file mode 100644
index 0000000..9766a05
--- /dev/null
+++ b/icu4c/source/tools/ctestfw/Android.bp
@@ -0,0 +1,34 @@
+// Copyright (C) 2018 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.
+
+cc_library_static {
+    name: "libicuctest",
+    export_include_dirs: ["."],
+    rtti: true,
+    cflags: [
+        "-Wno-unused-parameter",
+        "-DANDROID_LINK_SHARED_ICU4C",
+    ],
+    srcs: [
+        "*.c",
+        "*.cpp",
+    ],
+    shared_libs: [
+        "libicui18n",
+        "libicuuc",
+    ],
+    static_libs: [
+        "libicutoolutil",
+    ],
+}
diff --git a/icu4c/source/tools/toolutil/Android.bp b/icu4c/source/tools/toolutil/Android.bp
new file mode 100644
index 0000000..5fe83b3
--- /dev/null
+++ b/icu4c/source/tools/toolutil/Android.bp
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 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.
+
+cc_library_static {
+    name: "libicutoolutil",
+    export_include_dirs: ["."],
+    rtti: true,
+    cppflags: [
+        "-DU_TOOLUTIL_IMPLEMENTATION",
+        "-DANDROID_LINK_SHARED_ICU4C",
+    ],
+    srcs: [
+        "*.c",
+        "*.cpp",
+    ],
+    shared_libs: [
+        "libicuuc",
+        "libicui18n",
+    ],
+}