diff options
-rw-r--r-- | cppreopts/cppreopts.sh | 2 | ||||
-rw-r--r-- | preopt2cachename/preopt2cachename.cpp | 12 | ||||
-rw-r--r-- | tests/Android.bp | 3 | ||||
-rw-r--r-- | tests/lib/Android.bp | 1 | ||||
-rw-r--r-- | tests/lib/Android.mk | 18 | ||||
-rw-r--r-- | tests/lib/testUtil/Android.bp | 25 | ||||
-rw-r--r-- | tests/lib/testUtil/Android.mk | 27 | ||||
-rw-r--r-- | tests/lib/testUtil/include/testUtil.h (renamed from tests/include/testUtil.h) | 0 |
8 files changed, 40 insertions, 48 deletions
diff --git a/cppreopts/cppreopts.sh b/cppreopts/cppreopts.sh index 9f21ac78..76f25d1b 100644 --- a/cppreopts/cppreopts.sh +++ b/cppreopts/cppreopts.sh @@ -50,7 +50,7 @@ if [ $# -eq 1 ]; then # For each odex and vdex file do the copy task # NOTE: this implementation will break in any path with spaces to favor # background copy tasks - for file in $(find ${mountpoint} -type f -name "*.odex" -o -type f -name "*.vdex"); do + for file in $(find ${mountpoint} -type f -name "*.odex" -o -type f -name "*.vdex" -o -type f -name "*.art"); do real_name=${file/${mountpoint}/\/system} dest_name=$(preopt2cachename ${real_name}) if ! test $? -eq 0 ; then diff --git a/preopt2cachename/preopt2cachename.cpp b/preopt2cachename/preopt2cachename.cpp index f9a12ff4..3fb887be 100644 --- a/preopt2cachename/preopt2cachename.cpp +++ b/preopt2cachename/preopt2cachename.cpp @@ -26,6 +26,7 @@ static const char* kDalvikCacheDir = "/data/dalvik-cache/"; static const char* kOdexCacheSuffix = "@classes.dex"; static const char* kVdexCacheSuffix = "@classes.vdex"; +static const char* kArtCacheSuffix = "@classes.art"; // Returns the ISA extracted from the file_location. // file_location is formatted like /system/app/<app_name>/oat/<isa>/<app_name>.{odex,vdex} @@ -88,10 +89,17 @@ static bool SystemBFilenameToCacheFile(const std::string& file_location, LOG(ERROR) << "Unable to determine apk name from file name '" << file_location << "'"; return false; } + std::string::size_type pos = file_location.find_last_of("."); + if (pos == std::string::npos) { + LOG(ERROR) << "Invalid file location '" << file_location << "'"; + return false; + } cache_file += apk_name; - if (file_location.size() >= 5 && - file_location.substr(file_location.size() - 5) == std::string(".vdex")) { + std::string extension(file_location.substr(pos)); + if (extension == ".vdex") { cache_file += kVdexCacheSuffix; + } else if (extension == ".art") { + cache_file += kArtCacheSuffix; } else { cache_file += kOdexCacheSuffix; } diff --git a/tests/Android.bp b/tests/Android.bp new file mode 100644 index 00000000..1e0d8c8f --- /dev/null +++ b/tests/Android.bp @@ -0,0 +1,3 @@ +subdirs = [ + "lib", +] diff --git a/tests/lib/Android.bp b/tests/lib/Android.bp new file mode 100644 index 00000000..7a8ee5d0 --- /dev/null +++ b/tests/lib/Android.bp @@ -0,0 +1 @@ +subdirs = [ "*" ] diff --git a/tests/lib/Android.mk b/tests/lib/Android.mk deleted file mode 100644 index db16ed27..00000000 --- a/tests/lib/Android.mk +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright (C) 2010 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 $(call all-subdir-makefiles) diff --git a/tests/lib/testUtil/Android.bp b/tests/lib/testUtil/Android.bp new file mode 100644 index 00000000..35678d4f --- /dev/null +++ b/tests/lib/testUtil/Android.bp @@ -0,0 +1,25 @@ +// +// Copyright (C) 2010 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: "libtestUtil", + srcs: ["testUtil.c"], + export_include_dirs: ["include"], + shared_libs: [ + "libcutils", + "libutils", + ], +} diff --git a/tests/lib/testUtil/Android.mk b/tests/lib/testUtil/Android.mk deleted file mode 100644 index c5ae26d3..00000000 --- a/tests/lib/testUtil/Android.mk +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright (C) 2010 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) -LOCAL_MODULE_TAGS := tests -LOCAL_MODULE:= libtestUtil -LOCAL_SRC_FILES:= testUtil.c -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include -LOCAL_SHARED_LIBRARIES += libcutils libutils - - -include $(BUILD_STATIC_LIBRARY) diff --git a/tests/include/testUtil.h b/tests/lib/testUtil/include/testUtil.h index 3b75914d..3b75914d 100644 --- a/tests/include/testUtil.h +++ b/tests/lib/testUtil/include/testUtil.h |