Merge "Move to isolated testing."

This commit is contained in:
Christopher Ferris 2019-07-18 19:00:46 +00:00 committed by Gerrit Code Review
commit 604ccb147c
3 changed files with 33 additions and 11 deletions

View file

@ -158,6 +158,7 @@ cc_test_library {
cc_test {
name: "libunwindstack_test",
defaults: ["libunwindstack_flags"],
isolated: true,
srcs: [
"tests/ArmExidxDecodeTest.cpp",
@ -180,6 +181,7 @@ cc_test {
"tests/ElfInterfaceTest.cpp",
"tests/ElfTest.cpp",
"tests/ElfTestUtils.cpp",
"tests/IsolatedSettings.cpp",
"tests/JitDebugTest.cpp",
"tests/LocalUnwinderTest.cpp",
"tests/LogFake.cpp",

View file

@ -0,0 +1,26 @@
/*
* Copyright (C) 2016 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 <stdint.h>
#include <stdio.h>
extern "C" bool GetInitialArgs(const char*** args, size_t* num_args) {
static const char* initial_args[2] = {"--slow_threshold_ms=90000",
"--deadline_threshold_ms=120000"};
*args = initial_args;
*num_args = 2;
return true;
}

View file

@ -58,7 +58,7 @@ class MapInfoCreateMemoryTest : public ::testing::Test {
ASSERT_TRUE(android::base::WriteFully(fd, buffer.data(), buffer.size()));
}
static void SetUpTestSuite() {
void SetUp() override {
std::vector<uint8_t> buffer(12288, 0);
memcpy(buffer.data(), ELFMAG, SELFMAG);
buffer[EI_CLASS] = ELFCLASS32;
@ -72,9 +72,7 @@ class MapInfoCreateMemoryTest : public ::testing::Test {
InitElf<Elf32_Ehdr, Elf32_Shdr>(elf32_at_map_.fd, 0x1000, 0x2000, ELFCLASS32);
InitElf<Elf64_Ehdr, Elf64_Shdr>(elf64_at_map_.fd, 0x2000, 0x3000, ELFCLASS64);
}
void SetUp() override {
memory_ = new MemoryFake;
process_memory_.reset(memory_);
}
@ -82,17 +80,13 @@ class MapInfoCreateMemoryTest : public ::testing::Test {
MemoryFake* memory_;
std::shared_ptr<Memory> process_memory_;
static TemporaryFile elf_;
TemporaryFile elf_;
static TemporaryFile elf_at_1000_;
TemporaryFile elf_at_1000_;
static TemporaryFile elf32_at_map_;
static TemporaryFile elf64_at_map_;
TemporaryFile elf32_at_map_;
TemporaryFile elf64_at_map_;
};
TemporaryFile MapInfoCreateMemoryTest::elf_;
TemporaryFile MapInfoCreateMemoryTest::elf_at_1000_;
TemporaryFile MapInfoCreateMemoryTest::elf32_at_map_;
TemporaryFile MapInfoCreateMemoryTest::elf64_at_map_;
TEST_F(MapInfoCreateMemoryTest, end_le_start) {
MapInfo info(nullptr, 0x100, 0x100, 0, 0, elf_.path);