diff options
author | jgu21 <jinghui.gu@intel.com> | 2014-09-10 06:58:32 -0400 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2014-09-26 13:04:36 -0700 |
commit | b3facbfdecf46eb7c063b99529ab8c18a08a6b42 (patch) | |
tree | 5b02a2e8455391fe4f38b8e7442e16d71606f7ab /libnativebridge/tests/NeedsNativeBridge_test.cpp | |
parent | 8dd3ea58fdd99912f631156c37bcb2555ce8aec3 (diff) | |
download | system_core-b3facbfdecf46eb7c063b99529ab8c18a08a6b42.zip system_core-b3facbfdecf46eb7c063b99529ab8c18a08a6b42.tar.gz system_core-b3facbfdecf46eb7c063b99529ab8c18a08a6b42.tar.bz2 |
LibNativeBridge: Add early init & env setup
Add a method to set up /proc/cpuinfo with enough privileges. Set
up the environment for an app in InitializeNativeBridge().
Turn on -Wall for libnativebridge.
(cherry picked from commit 962eb40abb68eb60077da158755b6a09c306aa41)
(cherry picked from commit ab0da5a9a6860046619629b8e6b83692d35dff86)
(cherry picked from commit 2f71cb24fa16c0388591918f1354d1f8608cc6e5)
(cherry picked from commit 04054e28e24866d76034236843490829b80df40c)
(cherry picked from commit 4390a632366ecf89af5f6c0fed39baf9aab2d0f1)
Bug: 17671501
Change-Id: Id4f4127d82737b5e56a77175e1068ff5cea60f9d
Diffstat (limited to 'libnativebridge/tests/NeedsNativeBridge_test.cpp')
-rw-r--r-- | libnativebridge/tests/NeedsNativeBridge_test.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libnativebridge/tests/NeedsNativeBridge_test.cpp b/libnativebridge/tests/NeedsNativeBridge_test.cpp new file mode 100644 index 0000000..e1c0876 --- /dev/null +++ b/libnativebridge/tests/NeedsNativeBridge_test.cpp @@ -0,0 +1,48 @@ +/* + * 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. + */ + +#include "NativeBridgeTest.h" + +namespace android { + +static const char* kISAs[] = { "arm", "arm64", "mips", "x86", "x86_64", "random", "64arm", "64_x86", + "64_x86_64", "", "reallylongstringabcd", nullptr }; + +#if defined(__arm__) +static const char* kRuntimeISA = "arm"; +#elif defined(__aarch64__) +static const char* kRuntimeISA = "arm64"; +#elif defined(__mips__) +static const char* kRuntimeISA = "mips"; +#elif defined(__i386__) +static const char* kRuntimeISA = "x86"; +#elif defined(__x86_64__) +static const char* kRuntimeISA = "x86_64"; +#else +static const char* kRuntimeISA = "unknown"; +#endif + +TEST_F(NativeBridgeTest, NeedsNativeBridge) { + EXPECT_EQ(false, NeedsNativeBridge(kRuntimeISA)); + + const size_t kISACount = sizeof(kISAs)/sizeof(kISAs[0]); + for (size_t i = 0; i < kISACount; i++) { + EXPECT_EQ(kISAs[i] == nullptr ? false : strcmp(kISAs[i], kRuntimeISA) != 0, + NeedsNativeBridge(kISAs[i])); + } +} + +} // namespace android |