am 862b088a: am 3d170a6d: Merge "Remove obsolete test_isolated wrapper function"

* commit '862b088ac30881221500122955fc9e13933cbafd':
  Remove obsolete test_isolated wrapper function
This commit is contained in:
Dmitriy Ivanov 2015-03-16 22:40:08 +00:00 committed by Android Git Automerger
commit c6cc6f6312
3 changed files with 50 additions and 100 deletions

View File

@ -22,7 +22,6 @@
#include <stdio.h>
#include <stdint.h>
#include "gtest_ex.h"
#include "private/ScopeGuard.h"
#include <string>
@ -376,7 +375,6 @@ TEST(dlfcn, check_unload_after_reloc) {
// Test dlopens parent1 which loads and relocates libtest_two_parents_child.so
// as a second step it dlopens parent2 and dlcloses parent1...
test_isolated([] {
void* handle = dlopen("libtest_two_parents_parent1.so", RTLD_NOW | RTLD_LOCAL);
ASSERT_TRUE(handle != nullptr) << dlerror();
@ -402,7 +400,6 @@ TEST(dlfcn, check_unload_after_reloc) {
handle = dlopen("libtest_two_parents_parent1.so", RTLD_NOW | RTLD_LOCAL | RTLD_NOLOAD);
ASSERT_TRUE(handle == nullptr);
});
}
extern "C" int check_order_reloc_root_get_answer_impl() {
@ -485,7 +482,6 @@ TEST(dlfcn, dlopen_check_rtld_global) {
// libtest_with_dependency_loop_b.so -> libtest_with_dependency_loop_c.so ->
// libtest_with_dependency_loop_a.so
TEST(dlfcn, dlopen_check_loop) {
test_isolated([] {
void* handle = dlopen("libtest_with_dependency_loop.so", RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
void* f = dlsym(handle, "dlopen_test_loopy_function");
@ -503,7 +499,6 @@ TEST(dlfcn, dlopen_check_loop) {
handle = dlopen("libtest_with_dependency_a.so", RTLD_NOW | RTLD_NOLOAD);
ASSERT_TRUE(handle == nullptr);
});
}
TEST(dlfcn, dlopen_nodelete) {
@ -830,7 +825,6 @@ TEST(dlfcn, dlsym_weak_func) {
}
TEST(dlfcn, dlopen_undefined_weak_func) {
test_isolated([] {
void* handle = dlopen("libtest_dlopen_weak_undefined_func.so", RTLD_NOW);
ASSERT_TRUE(handle != nullptr) << dlerror();
int (*weak_func)();
@ -838,7 +832,6 @@ TEST(dlfcn, dlopen_undefined_weak_func) {
ASSERT_TRUE(weak_func != nullptr) << dlerror();
EXPECT_EQ(6551, weak_func());
dlclose(handle);
});
}
TEST(dlfcn, dlopen_symlink) {

View File

@ -1,40 +0,0 @@
/*
* 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.
*/
#include <gtest/gtest.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
template<typename F>
void test_isolated(F test) {
int pid = fork();
ASSERT_NE(-1, pid) << strerror(errno);
if (pid == 0) {
test();
_exit(testing::Test::HasFailure() ? 1 : 0);
}
int status;
ASSERT_EQ(pid, waitpid(pid, &status, 0));
ASSERT_TRUE(WIFEXITED(status));
ASSERT_EQ(0, WEXITSTATUS(status)) << "Forked test has failed, see above..";
}

View File

@ -19,7 +19,6 @@
#include "private/ScopeGuard.h"
#include "BionicDeathTest.h"
#include "ScopedSignalHandler.h"
#include "gtest_ex.h"
#include <errno.h>
#include <inttypes.h>
@ -817,7 +816,6 @@ static void AtForkChild1() { g_atfork_child_calls = (g_atfork_child_calls << 4)
static void AtForkChild2() { g_atfork_child_calls = (g_atfork_child_calls << 4) | 2; }
TEST(pthread, pthread_atfork_smoke) {
test_isolated([] {
ASSERT_EQ(0, pthread_atfork(AtForkPrepare1, AtForkParent1, AtForkChild1));
ASSERT_EQ(0, pthread_atfork(AtForkPrepare2, AtForkParent2, AtForkChild2));
@ -833,7 +831,6 @@ TEST(pthread, pthread_atfork_smoke) {
// Prepare calls are made in the reverse order.
ASSERT_EQ(0x21, g_atfork_prepare_calls);
});
}
TEST(pthread, pthread_attr_getscope) {