add component metadata tag to CTS kernel config test cases am: 4313a5d7e6
am: c4efad7a08 -s ours
Change-Id: I950b7289af632658088aeaec88484dd17b2d42ee
diff --git a/cppreopts/cppreopts.sh b/cppreopts/cppreopts.sh
index 9f21ac7..76f25d1 100644
--- a/cppreopts/cppreopts.sh
+++ b/cppreopts/cppreopts.sh
@@ -50,7 +50,7 @@
# 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/f2fs_utils/f2fs_dlutils.c b/f2fs_utils/f2fs_dlutils.c
index 2ba3f7c..4b5e13e 100644
--- a/f2fs_utils/f2fs_dlutils.c
+++ b/f2fs_utils/f2fs_dlutils.c
@@ -39,7 +39,6 @@
int (*f2fs_format_device_dl)(void);
void (*f2fs_init_configuration_dl)(void);
-struct f2fs_configuration *c_dl;
int f2fs_format_device(void) {
assert(f2fs_format_device_dl);
@@ -59,8 +58,7 @@
}
f2fs_format_device_dl = dlsym(f2fs_lib, "f2fs_format_device");
f2fs_init_configuration_dl = dlsym(f2fs_lib, "f2fs_init_configuration");
- c_dl = dlsym(f2fs_lib, "c");
- if (!f2fs_format_device_dl || !f2fs_init_configuration_dl || !c_dl) {
+ if (!f2fs_format_device_dl || !f2fs_init_configuration_dl) {
return -1;
}
return 0;
diff --git a/f2fs_utils/f2fs_ioutils.c b/f2fs_utils/f2fs_ioutils.c
index d3bc727..c9275ff 100644
--- a/f2fs_utils/f2fs_ioutils.c
+++ b/f2fs_utils/f2fs_ioutils.c
@@ -83,7 +83,7 @@
#endif
-extern struct f2fs_configuration *c_dl;
+struct f2fs_configuration c;
struct sparse_file *f2fs_sparse_file;
struct buf_item {
@@ -94,11 +94,29 @@
struct buf_item *buf_list;
+static int __get_device_fd(__u64 *offset)
+{
+ __u64 blk_addr = *offset >> F2FS_BLKSIZE_BITS;
+ int i;
+
+ for (i = 0; i < c.ndevs; i++) {
+ if (c.devices[i].start_blkaddr <= blk_addr &&
+ c.devices[i].end_blkaddr >= blk_addr) {
+ *offset -=
+ c.devices[i].start_blkaddr << F2FS_BLKSIZE_BITS;
+ return c.devices[i].fd;
+ }
+ }
+ return -1;
+}
+
static int dev_write_fd(void *buf, __u64 offset, size_t len)
{
- if (lseek64(c_dl->devices[0].fd, (off64_t)offset, SEEK_SET) < 0)
+ int fd = __get_device_fd(&offset);
+
+ if (lseek64(fd, (off64_t)offset, SEEK_SET) < 0)
return -1;
- ssize_t written = write(c_dl->devices[0].fd, buf, len);
+ ssize_t written = write(fd, buf, len);
if (written == -1)
return -1;
if ((size_t)written != len)
@@ -138,11 +156,11 @@
return 0;
}
-void f2fs_finalize_device()
+void f2fs_finalize_device(void)
{
}
-int f2fs_trim_device()
+int f2fs_trim_devices(void)
{
return 0;
}
@@ -160,24 +178,39 @@
return 0;
}
+int dev_readahead(__u64 offset, size_t len)
+{
+ return 0;
+}
+
int dev_write(void *buf, __u64 offset, size_t len)
{
- if (c_dl->devices[0].fd >= 0) {
+ int fd = __get_device_fd(&offset);
+
+ if (fd >= 0) {
return dev_write_fd(buf, offset, len);
} else {
return dev_write_sparse(buf, offset, len);
}
}
-int dev_write_block(void *buf, __u64 offset)
+int dev_write_block(void *buf, __u64 blk_addr)
{
- return dev_write(buf, offset << F2FS_BLKSIZE_BITS, F2FS_BLKSIZE);
+ assert(false); // Must not be invoked.
+ return 0;
+}
+
+int dev_write_dump(void *buf, __u64 offset, size_t len)
+{
+ assert(false); // Must not be invoked.
+ return 0;
}
int dev_fill(void *buf, __u64 offset, size_t len)
{
+ int fd = __get_device_fd(&offset);
int ret;
- if (c_dl->devices[0].fd >= 0) {
+ if (fd >= 0) {
return dev_write_fd(buf, offset, len);
}
// sparse file fills with zero by default.
@@ -185,6 +218,12 @@
return 0;
}
+int dev_fill_block(void *buf, __u64 blk_addr)
+{
+ assert(false); // Must not be invoked.
+ return 0;
+}
+
int dev_read_block(void *buf, __u64 blk_addr)
{
assert(false); // Must not be invoked.
@@ -197,3 +236,8 @@
return 0;
}
+int dev_reada_block(__u64 blk_addr)
+{
+ assert(false); // Must not be invoked.
+ return 0;
+}
diff --git a/f2fs_utils/f2fs_utils.c b/f2fs_utils/f2fs_utils.c
index 5223680..0aa2f7a 100644
--- a/f2fs_utils/f2fs_utils.c
+++ b/f2fs_utils/f2fs_utils.c
@@ -42,11 +42,12 @@
extern void flush_sparse_buffs();
-extern struct f2fs_configuration *c_dl;
+struct f2fs_configuration c;
struct sparse_file *f2fs_sparse_file;
extern int dlopenf2fs();
static void reset_f2fs_info() {
+ memset(&c, 0, sizeof(c));
if (f2fs_sparse_file) {
sparse_file_destroy(f2fs_sparse_file);
f2fs_sparse_file = NULL;
@@ -62,13 +63,9 @@
reset_f2fs_info();
f2fs_init_configuration();
len &= ~((__u64)(F2FS_BLKSIZE - 1));
- c_dl->ndevs = 1;
- c_dl->devices[0].total_sectors = len / c_dl->devices[0].sector_size;
- c_dl->sector_size = c_dl->devices[0].sector_size;
- c_dl->sectors_per_blk = F2FS_BLKSIZE / c_dl->sector_size;
- c_dl->total_sectors = c_dl->devices[0].total_sectors;
- c_dl->start_sector = 0;
- c_dl->trim = 0;
+ c.sector_size = DEFAULT_SECTOR_SIZE;
+ c.total_sectors = len / c.sector_size;
+ c.start_sector = 0;
f2fs_sparse_file = sparse_file_new(F2FS_BLKSIZE, len);
f2fs_format_device();
sparse_file_write(f2fs_sparse_file, fd, /*gzip*/0, /*sparse*/1, /*crc*/0);
diff --git a/preopt2cachename/preopt2cachename.cpp b/preopt2cachename/preopt2cachename.cpp
index f9a12ff..3fb887b 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 @@
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 0000000..1e0d8c8
--- /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 0000000..7a8ee5d
--- /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 db16ed2..0000000
--- 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 0000000..35678d4
--- /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 c5ae26d..0000000
--- 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
similarity index 100%
rename from tests/include/testUtil.h
rename to tests/lib/testUtil/include/testUtil.h