Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fcf52c6f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "libandroidfw_tests: package test data correctly"

parents c3c2b28c 873ef0e2
Loading
Loading
Loading
Loading
+93 −9
Original line number Diff line number Diff line
@@ -14,15 +14,27 @@

// libandroidfw is partially built for the host (used by obbtool, aapt, and others)

cc_library {
    name: "libandroidfw",
    host_supported: true,
cc_defaults {
    name: "libandroidfw_defaults",
    cflags: [
        "-Wall",
        "-Werror",
        "-Wunused",
        "-Wunreachable-code",
    ],
    target: {
        windows: {
            // The Windows compiler warns incorrectly for value initialization with {}.
            cppflags: ["-Wno-missing-field-initializers"],
        },
        host: {
            cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
        },
    },
}

cc_library {
    name: "libandroidfw",
    defaults: ["libandroidfw_defaults"],
    host_supported: true,
    srcs: [
        "ApkAssets.cpp",
        "Asset.cpp",
@@ -67,7 +79,6 @@ cc_library {
            },
        },
        host: {
            cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"],
            shared: {
                enabled: false,
            },
@@ -84,9 +95,82 @@ cc_library {
        },
        windows: {
            enabled: true,
            cppflags: ["-Wno-missing-field-initializers"],  // The Windows compiler warns
                                                            // incorrectly for value
                                                            // initialization with {}.
        },
    },
}

common_test_libs = [
    "libandroidfw",
    "libbase",
    "libcutils",
    "libutils",
    "libziparchive",
]

cc_test {
    name: "libandroidfw_tests",
    host_supported: true,
    defaults: ["libandroidfw_defaults"],
    cppflags: [
        // This is to suppress warnings/errors from gtest
        "-Wno-unnamed-type-template-args",
    ],
    srcs: [
        // Helpers/infra for testing.
        "tests/CommonHelpers.cpp",
        "tests/TestHelpers.cpp",
        "tests/TestMain.cpp",

        // Actual tests.
        "tests/ApkAssets_test.cpp",
        "tests/AppAsLib_test.cpp",
        "tests/Asset_test.cpp",
        "tests/AssetManager2_test.cpp",
        "tests/AttributeFinder_test.cpp",
        "tests/AttributeResolution_test.cpp",
        "tests/ByteBucketArray_test.cpp",
        "tests/Config_test.cpp",
        "tests/ConfigLocale_test.cpp",
        "tests/Idmap_test.cpp",
        "tests/LoadedArsc_test.cpp",
        "tests/ResourceUtils_test.cpp",
        "tests/ResTable_test.cpp",
        "tests/Split_test.cpp",
        "tests/StringPiece_test.cpp",
        "tests/Theme_test.cpp",
        "tests/TypeWrappers_test.cpp",
        "tests/ZipUtils_test.cpp",
    ],
    target: {
        android: {
            srcs: [
                "tests/BackupData_test.cpp",
                "tests/ObbFile_test.cpp",
            ],
            shared_libs: common_test_libs + ["libui"],
        },
        host: {
            static_libs: common_test_libs + ["liblog", "libz"],
        },
    },
    data: ["tests/data/**/*.apk"],
}

cc_benchmark {
    name: "libandroidfw_benchmarks",
    defaults: ["libandroidfw_defaults"],
    srcs: [
        // Helpers/infra for benchmarking.
        "tests/BenchMain.cpp",
        "tests/BenchmarkHelpers.cpp",
        "tests/CommonHelpers.cpp",

        // Actual benchmarks.
        "tests/AssetManager2_bench.cpp",
        "tests/SparseEntry_bench.cpp",
        "tests/Theme_bench.cpp",
    ],
    shared_libs: common_test_libs,
    data: ["tests/data/**/*.apk"],
}

libs/androidfw/Android.mk

deleted100644 → 0
+0 −24
Original line number Diff line number Diff line
# 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 subdirectory makefiles
# ============================================================

# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework
# team really wants is to build the stuff defined by this makefile.
ifeq (,$(ONE_SHOT_MAKEFILE))
include $(call first-makefiles-under,$(LOCAL_PATH))
endif

libs/androidfw/tests/Android.mk

deleted100644 → 0
+0 −126
Original line number Diff line number Diff line
#
# 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.
#

# ==========================================================
# Setup some common variables for the different build
# targets here.
# ==========================================================
LOCAL_PATH:= $(call my-dir)

testFiles := \
    ApkAssets_test.cpp \
    AppAsLib_test.cpp \
    Asset_test.cpp \
    AssetManager2_test.cpp \
    AttributeFinder_test.cpp \
    AttributeResolution_test.cpp \
    ByteBucketArray_test.cpp \
    Config_test.cpp \
    ConfigLocale_test.cpp \
    Idmap_test.cpp \
    LoadedArsc_test.cpp \
    ResourceUtils_test.cpp \
    ResTable_test.cpp \
    Split_test.cpp \
    StringPiece_test.cpp \
    TestHelpers.cpp \
    TestMain.cpp \
    Theme_test.cpp \
    TypeWrappers_test.cpp \
    ZipUtils_test.cpp

benchmarkFiles := \
    AssetManager2_bench.cpp \
    BenchMain.cpp \
    BenchmarkHelpers.cpp \
    SparseEntry_bench.cpp \
    TestHelpers.cpp \
    Theme_bench.cpp

androidfw_test_cflags := \
    -Wall \
    -Werror \
    -Wunused \
    -Wunreachable-code \
    -Wno-missing-field-initializers

# gtest is broken.
androidfw_test_cflags += -Wno-unnamed-type-template-args

# ==========================================================
# Build the host tests: libandroidfw_tests
# ==========================================================
include $(CLEAR_VARS)

LOCAL_MODULE := libandroidfw_tests
LOCAL_CFLAGS := $(androidfw_test_cflags)
LOCAL_SRC_FILES := $(testFiles)
LOCAL_STATIC_LIBRARIES := \
    libandroidfw \
    libbase \
    libutils \
    libcutils \
    liblog \
    libz \
    libziparchive
LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data

include $(BUILD_HOST_NATIVE_TEST)

# ==========================================================
# Build the device tests: libandroidfw_tests
# ==========================================================
ifneq ($(SDK_ONLY),true)
include $(CLEAR_VARS)

LOCAL_MODULE := libandroidfw_tests
LOCAL_CFLAGS := $(androidfw_test_cflags)
LOCAL_SRC_FILES := $(testFiles) \
    BackupData_test.cpp \
    ObbFile_test.cpp \

LOCAL_SHARED_LIBRARIES := \
    libandroidfw \
    libbase \
    libcutils \
    libutils \
    libui \
    libziparchive 
LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data

include $(BUILD_NATIVE_TEST)

# ==========================================================
# Build the device benchmarks: libandroidfw_benchmarks
# ==========================================================
include $(CLEAR_VARS)

LOCAL_MODULE := libandroidfw_benchmarks
LOCAL_CFLAGS := $(androidfw_test_cflags)
LOCAL_SRC_FILES := $(benchmarkFiles)
LOCAL_STATIC_LIBRARIES := \
    libgoogle-benchmark
LOCAL_SHARED_LIBRARIES := \
    libandroidfw \
    libbase \
    libcutils \
    libutils \
    libziparchive
LOCAL_PICKUP_FILES := $(LOCAL_PATH)/data

include $(BUILD_NATIVE_TEST)
endif # Not SDK_ONLY
+0 −1
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
#include "androidfw/ResourceTypes.h"

#include "BenchmarkHelpers.h"
#include "TestHelpers.h"
#include "data/basic/R.h"
#include "data/libclient/R.h"
#include "data/styles/R.h"
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

#include "benchmark/benchmark.h"

#include "TestHelpers.h"
#include "BenchmarkHelpers.h"

int main(int argc, char** argv) {
  ::benchmark::Initialize(&argc, argv);
Loading