aboutsummaryrefslogtreecommitdiffstats
path: root/linker
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2019-02-16 01:11:56 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-02-16 01:11:56 +0000
commitd102cf62d1f0e2f4eb166a5fface656641f461a5 (patch)
tree43dc7587964515bc4e8fdc7fee78918917e7423c /linker
parentf84d0a95bd237e56c6aa7cbdce786ef611c53254 (diff)
parent15a2b7b17ba94a267a2285da0b72cd0064ca81c3 (diff)
downloadandroid_bionic-d102cf62d1f0e2f4eb166a5fface656641f461a5.tar.gz
android_bionic-d102cf62d1f0e2f4eb166a5fface656641f461a5.tar.bz2
android_bionic-d102cf62d1f0e2f4eb166a5fface656641f461a5.zip
Merge "Switch linker tests to Android.bp."
Diffstat (limited to 'linker')
-rw-r--r--linker/Android.bp36
-rw-r--r--linker/Android.mk3
-rw-r--r--linker/linked_list_test.cpp (renamed from linker/tests/linked_list_test.cpp)2
-rw-r--r--linker/linker_block_allocator_test.cpp (renamed from linker/tests/linker_block_allocator_test.cpp)3
-rw-r--r--linker/linker_config_test.cpp (renamed from linker/tests/linker_config_test.cpp)4
-rw-r--r--linker/linker_sleb128_test.cpp (renamed from linker/tests/linker_sleb128_test.cpp)2
-rw-r--r--linker/linker_test_globals.cpp (renamed from linker/tests/linker_globals.cpp)0
-rw-r--r--linker/linker_utils_test.cpp (renamed from linker/tests/linker_utils_test.cpp)2
-rw-r--r--linker/tests/Android.mk54
9 files changed, 42 insertions, 64 deletions
diff --git a/linker/Android.bp b/linker/Android.bp
index 06a942dfc..613be3d57 100644
--- a/linker/Android.bp
+++ b/linker/Android.bp
@@ -375,3 +375,39 @@ cc_library {
never: true,
},
}
+
+cc_test {
+ name: "linker-unit-tests",
+
+ cflags: [
+ "-g",
+ "-Wall",
+ "-Wextra",
+ "-Wunused",
+ "-Werror",
+ ],
+
+ // We need to access Bionic private headers in the linker.
+ include_dirs: ["bionic/libc"],
+
+ srcs: [
+ // Tests.
+ "linker_block_allocator_test.cpp",
+ "linker_config_test.cpp",
+ "linked_list_test.cpp",
+ "linker_sleb128_test.cpp",
+ "linker_utils_test.cpp",
+
+ // Parts of the linker that we're testing.
+ "linker_block_allocator.cpp",
+ "linker_config.cpp",
+ "linker_test_globals.cpp",
+ "linker_utils.cpp",
+ ],
+
+ static_libs: [
+ "libasync_safe",
+ "libbase",
+ "liblog",
+ ],
+}
diff --git a/linker/Android.mk b/linker/Android.mk
deleted file mode 100644
index ea7451c0f..000000000
--- a/linker/Android.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/linker/tests/linked_list_test.cpp b/linker/linked_list_test.cpp
index 2b88ed036..71a7d095c 100644
--- a/linker/tests/linked_list_test.cpp
+++ b/linker/linked_list_test.cpp
@@ -32,7 +32,7 @@
#include <gtest/gtest.h>
-#include "../linked_list.h"
+#include "linked_list.h"
namespace {
diff --git a/linker/tests/linker_block_allocator_test.cpp b/linker/linker_block_allocator_test.cpp
index d5eb97c26..359eefbab 100644
--- a/linker/tests/linker_block_allocator_test.cpp
+++ b/linker/linker_block_allocator_test.cpp
@@ -32,7 +32,7 @@
#include <gtest/gtest.h>
-#include "../linker_block_allocator.h"
+#include "linker_block_allocator.h"
#include <unistd.h>
@@ -145,4 +145,3 @@ TEST(linker_allocator, test_protect) {
testing::FLAGS_gtest_death_test_style = "threadsafe";
ASSERT_EXIT(protect_all(), testing::KilledBySignal(SIGSEGV), "trying to access protected page");
}
-
diff --git a/linker/tests/linker_config_test.cpp b/linker/linker_config_test.cpp
index 14fd132bc..6a55bb2b3 100644
--- a/linker/tests/linker_config_test.cpp
+++ b/linker/linker_config_test.cpp
@@ -32,8 +32,8 @@
#include <gtest/gtest.h>
-#include "../linker_config.h"
-#include "../linker_utils.h"
+#include "linker_config.h"
+#include "linker_utils.h"
#include <unistd.h>
diff --git a/linker/tests/linker_sleb128_test.cpp b/linker/linker_sleb128_test.cpp
index 551faf28b..9e819c61e 100644
--- a/linker/tests/linker_sleb128_test.cpp
+++ b/linker/linker_sleb128_test.cpp
@@ -32,7 +32,7 @@
#include <gtest/gtest.h>
-#include "../linker_sleb128.h"
+#include "linker_sleb128.h"
TEST(linker_sleb128, smoke) {
std::vector<uint8_t> encoding;
diff --git a/linker/tests/linker_globals.cpp b/linker/linker_test_globals.cpp
index 33a78b074..33a78b074 100644
--- a/linker/tests/linker_globals.cpp
+++ b/linker/linker_test_globals.cpp
diff --git a/linker/tests/linker_utils_test.cpp b/linker/linker_utils_test.cpp
index e406af5f6..44907dabf 100644
--- a/linker/tests/linker_utils_test.cpp
+++ b/linker/linker_utils_test.cpp
@@ -32,7 +32,7 @@
#include <gtest/gtest.h>
-#include "../linker_utils.h"
+#include "linker_utils.h"
TEST(linker_utils, format_string) {
std::vector<std::pair<std::string, std::string>> params = {{ "LIB", "lib32"}, { "SDKVER", "42"}};
diff --git a/linker/tests/Android.mk b/linker/tests/Android.mk
deleted file mode 100644
index 63e05557a..000000000
--- a/linker/tests/Android.mk
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
-# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := linker-unit-tests
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-
-LOCAL_CFLAGS += -g -Wall -Wextra -Wunused -Werror
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../libc/
-
-LOCAL_SRC_FILES := \
- linker_block_allocator_test.cpp \
- linker_config_test.cpp \
- linker_globals.cpp \
- linked_list_test.cpp \
- linker_sleb128_test.cpp \
- linker_utils_test.cpp \
- ../linker_block_allocator.cpp \
- ../linker_config.cpp \
- ../linker_utils.cpp \
-
-LOCAL_STATIC_LIBRARIES += libasync_safe libbase liblog
-
-include $(BUILD_NATIVE_TEST)