OSDN Git Service

am 29131b97: Reinstate "Update boot image signature format to version 1"
authorPaul Lawrence <paullawrence@google.com>
Fri, 14 Nov 2014 00:03:52 +0000 (00:03 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Fri, 14 Nov 2014 00:03:52 +0000 (00:03 +0000)
* commit '29131b97ed091bb2b10917036a64f3403c507eb7':
  Reinstate "Update boot image signature format to version 1"

58 files changed:
memtrack/Android.mk
tests/binder/benchmarks/Android.mk
tests/bionic/libc/Android.mk
tests/bionic/libc/README.TXT
tests/bionic/libc/bionic/lib_relocs.c [deleted file]
tests/bionic/libc/bionic/lib_static_init.cpp [deleted file]
tests/bionic/libc/bionic/lib_static_init.h [deleted file]
tests/bionic/libc/bionic/libdlclosetest1.cpp [deleted file]
tests/bionic/libc/bionic/libdlclosetest2.c [deleted file]
tests/bionic/libc/bionic/test_dlclose_destruction.c [deleted file]
tests/bionic/libc/bionic/test_getgrouplist.c [deleted file]
tests/bionic/libc/bionic/test_mutex.c [deleted file]
tests/bionic/libc/bionic/test_netinet_icmp.c [deleted file]
tests/bionic/libc/bionic/test_pthread_cond.c
tests/bionic/libc/bionic/test_pthread_create.c [deleted file]
tests/bionic/libc/bionic/test_relocs.c [deleted file]
tests/bionic/libc/bionic/test_static_init.cpp [deleted file]
tests/bionic/libc/common/hello_world.cpp [deleted file]
tests/bionic/libc/common/test_clock.c [deleted file]
tests/bionic/libc/common/test_cpu_set.c [deleted file]
tests/bionic/libc/common/test_dlopen_null.c [deleted file]
tests/bionic/libc/common/test_executable_destructor.c [deleted file]
tests/bionic/libc/common/test_getaddrinfo.c [deleted file]
tests/bionic/libc/common/test_gethostbyname.c [deleted file]
tests/bionic/libc/common/test_gethostname.c [deleted file]
tests/bionic/libc/common/test_pthread_cleanup_push.c [deleted file]
tests/bionic/libc/common/test_pthread_join.c [deleted file]
tests/bionic/libc/common/test_pthread_once.c [deleted file]
tests/bionic/libc/common/test_sem_post.c [deleted file]
tests/bionic/libc/common/test_semaphore.c [deleted file]
tests/bionic/libc/common/test_seteuid.c [deleted file]
tests/bionic/libc/common/test_static_cpp_mutex.cpp [deleted file]
tests/bionic/libc/common/test_udp.c [deleted file]
tests/bionic/libc/glibc/assert/test-assert.c [deleted file]
tests/bionic/libc/other/test_sysconf.c [deleted file]
tests/bionic/libc/other/test_vfprintf_leak.c [deleted file]
tests/bionic/libstdc++/Android.mk [deleted file]
tests/bionic/libstdc++/README.TXT [deleted file]
tests/bionic/libstdc++/test_cassert.cpp [deleted file]
tests/bionic/libstdc++/test_cctype.cpp [deleted file]
tests/bionic/libstdc++/test_climits.cpp [deleted file]
tests/bionic/libstdc++/test_cmath.cpp [deleted file]
tests/bionic/libstdc++/test_csetjmp.cpp [deleted file]
tests/bionic/libstdc++/test_csignal.cpp [deleted file]
tests/bionic/libstdc++/test_cstddef.cpp [deleted file]
tests/bionic/libstdc++/test_cstdint.cpp [deleted file]
tests/bionic/libstdc++/test_cstdio.cpp [deleted file]
tests/bionic/libstdc++/test_cstdlib.cpp [deleted file]
tests/bionic/libstdc++/test_cstring.cpp [deleted file]
tests/bionic/libstdc++/test_ctime.cpp [deleted file]
tests/memtest/Android.mk
tests/pagingtest/Android.mk [new file with mode: 0644]
tests/pagingtest/mmap_test.c [new file with mode: 0644]
tests/pagingtest/pageinout_test.c [new file with mode: 0644]
tests/pagingtest/pagingtest.c [new file with mode: 0644]
tests/pagingtest/pagingtest.h [new file with mode: 0644]
tests/pagingtest/thrashing_test.c [new file with mode: 0644]
tests/wifi/stress/wifiLoadScanAssoc.c

index 66759bb..0054c70 100644 (file)
@@ -17,11 +17,8 @@ LOCAL_PATH:= $(call my-dir)
 src_files := \
        memtrack.cpp
 
-includes := \
-    bionic \
-    external/stlport/stlport \
-
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_SRC_FILES := $(src_files)
 
@@ -31,13 +28,13 @@ LOCAL_MODULE := memtrack_share
 
 LOCAL_C_INCLUDES += $(includes)
 LOCAL_SHARED_LIBRARIES := \
-       libc \
-       libstlport \
        liblog \
 
+LOCAL_CXX_STL := stlport
 include $(BUILD_EXECUTABLE)
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_SRC_FILES := $(src_files)
 LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
@@ -45,11 +42,10 @@ LOCAL_MODULE_TAGS := debug
 LOCAL_MODULE := memtrack
 
 LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_C_INCLUDES += $(includes)
 LOCAL_STATIC_LIBRARIES := \
        libc \
        libstdc++ \
-       libstlport_static \
        liblog \
 
+LOCAL_CXX_STL := stlport_static
 include $(BUILD_EXECUTABLE)
index 8680f4d..c0ddb47 100644 (file)
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
 LOCAL_MODULE_TAGS := eng tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativebenchmark
 
 LOCAL_STATIC_LIBRARIES += \
-    libgtest \
-    libgtest_main \
     libtestUtil
 
 LOCAL_SHARED_LIBRARIES += \
     libutils \
     liblog \
-    libstlport \
     libbinder
 
 LOCAL_C_INCLUDES += \
-    bionic \
-    bionic/libstdc++/include \
-    external/stlport/stlport \
-    external/gtest/include \
     system/extras/tests/include \
     frameworks/base/include
 
 LOCAL_MODULE := binderAddInts
 LOCAL_SRC_FILES := binderAddInts.cpp
+
+include external/stlport/libstlport.mk
 include $(BUILD_EXECUTABLE)
index 1e64591..e7cdf1e 100644 (file)
@@ -61,22 +61,8 @@ endef
 # First, the tests in 'common'
 
 sources := \
-    common/test_clock.c \
-    common/test_cpu_set.c \
-    common/test_executable_destructor.c \
-    common/test_getaddrinfo.c \
-    common/test_gethostbyname.c \
-    common/test_gethostname.c \
-    common/test_pthread_cleanup_push.c \
-    common/test_pthread_join.c \
     common/test_pthread_mutex.c \
     common/test_pthread_rwlock.c \
-    common/test_pthread_once.c \
-    common/test_semaphore.c \
-    common/test_sem_post.c \
-    common/test_seteuid.c \
-    common/test_static_cpp_mutex.cpp \
-    common/test_udp.c \
 
 # _XOPEN_SOURCE=600 is needed to get pthread_mutexattr_settype() on GLibc
 #
@@ -85,135 +71,13 @@ EXTRA_CFLAGS := -D_XOPEN_SOURCE=600 -DHOST
 $(call host-test, $(sources))
 $(call device-test, $(sources))
 
-# The 'test_static_executable_destructor is the same than
-# test_executable_destructor except that the generated program
-# is statically linked instead.
-include $(CLEAR_VARS)
-LOCAL_MODULE := test_static_executable_destructor
-LOCAL_SRC_FILES := common/test_executable_destructor.c
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_LIBRARIES := libc
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-include $(BUILD_EXECUTABLE)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := test_static_executable_destructor
-LOCAL_SRC_FILES := common/test_executable_destructor.c
-LOCAL_MODULE_TAGS := tests
-LOCAL_LDFLAGS := -static
-include $(BUILD_HOST_EXECUTABLE)
-
-# The 'test_dlopen_null' tests requires specific linker flags
-#
-# The -Wl,--export-dynamic ensures that dynamic symbols are
-# exported from the executable.
-#
-# -Wl,-u,foo is used to ensure that symbol "foo" is not
-# garbage-collected by the gold linker, since the function
-# appears to be unused.
-#
-sources := common/test_dlopen_null.c \
-
-EXTRA_LDLIBS := -ldl -Wl,--export-dynamic -Wl,-u,foo
-EXTRA_CFLAGS := -DHOST
-$(call host-test, $(sources))
-
-EXTRA_LDLIBS := -ldl -Wl,--export-dynamic -Wl,-u,foo
-$(call device-test, $(sources))
-
-
 # Second, the Bionic-specific tests
 
 sources :=  \
-    bionic/test_mutex.c \
     bionic/test_cond.c \
-    bionic/test_getgrouplist.c \
-    bionic/test_netinet_icmp.c \
     bionic/test_pthread_cond.c \
-    bionic/test_pthread_create.c \
     bionic/test_setjmp.c \
 
 $(call device-test, $(sources))
 
-# Third, the other tests
-
-sources := \
-    other/test_sysconf.c \
-    other/test_vfprintf_leak.c \
-
-$(call device-test, $(sources))
-
-# The relocations test is a bit special, since we need
-# to build one shared object and one executable that depends
-# on it.
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/lib_relocs.c
-LOCAL_MODULE    := libtest_relocs
-
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/test_relocs.c
-LOCAL_MODULE    := test_relocs
-LOCAL_SHARED_LIBRARIES := libtest_relocs
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
-
-# This test tries to see if the static constructors in a
-# shared library are only called once. We thus need to
-# build a shared library, then call it from another
-# program.
-#
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/lib_static_init.cpp
-LOCAL_MODULE    := libtest_static_init
-
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/test_static_init.cpp
-LOCAL_MODULE    := test_static_init
-LOCAL_SHARED_LIBRARIES := libtest_static_init
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
-
-# This test tries to see if static destructors are called
-# on dlclose(). We thus need to generate a C++ shared library
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/libdlclosetest1.cpp
-LOCAL_MODULE := libdlclosetest1
-
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_SHARED_LIBRARY)
-
-# And this one does the same with __attribute__((constructor))
-# and __attribute__((destructor))
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/libdlclosetest2.c
-LOCAL_MODULE := libdlclosetest2
-
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_SHARED_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := bionic/test_dlclose_destruction.c
-LOCAL_MODULE := test_dlclose_destruction
-LOCAL_LDFLAGS := -ldl
-#LOCAL_SHARED_LIBRARIES := libdlclosetest1 libdlclosetest2
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
-
-# TODO: Add a variety of GLibc test programs too...
-
-# Hello World to test libstdc++ support
-
-sources := \
-    common/hello_world.cpp \
-
-EXTRA_CFLAGS := -mandroid
-#$(call device-test, $(sources))
-
 endif  # BIONIC_TESTS
index 7618f2b..c43f93b 100644 (file)
@@ -1,9 +1,5 @@
 This directory contains a set of tests for Android's Bionic C library.
 
-These sources are not distributed with Bionic itself because some of
-these tests come from the GNU C Library, and are licensed under the
-GNU Lesser General Public License (LGPL)
-
 You must define the BIONIC_TESTS environment variable to build these
 test programs. For example, do:
 
@@ -19,10 +15,6 @@ The directory layout is simple:
     Contains tests that can be compiled either with Bionic or another
     C library.
 
-  glibc/
-    Contains tests that come from the GNU C Library. However, they can
-    be compiled with Bionic too.
-
   bionic/
     Contains tests that can *only* be compiled against Bionic
 
diff --git a/tests/bionic/libc/bionic/lib_relocs.c b/tests/bionic/libc/bionic/lib_relocs.c
deleted file mode 100644 (file)
index af4cf6f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* this is part of the test_relocs.c test, which is used to check that
- * the relocations generated in a shared object are properly handled
- * by the Bionic dynamic linker
- */
-
-struct foo { int first, second; };
-struct foo Foo = {1, 2};
-
-int* FooPtr[] = { &Foo.first, &Foo.second };
-
-int func1( void )
-{
-    return *FooPtr[0];
-}
-
-int  func2( void )
-{
-    return *FooPtr[1];
-}
diff --git a/tests/bionic/libc/bionic/lib_static_init.cpp b/tests/bionic/libc/bionic/lib_static_init.cpp
deleted file mode 100644 (file)
index d847110..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "lib_static_init.h"
-#include <stdio.h>
-
-Foo::Foo()
-{
-    /* increment the static variable */
-    value = ++Foo::counter;
-    fprintf(stderr, "Foo::Foo for this=%p called (counter = %d)\n", this, counter);
-}
-
-int Foo::getValue()
-{
-    return value;
-}
-
-int Foo::counter;
-
-Foo  theFoo;
diff --git a/tests/bionic/libc/bionic/lib_static_init.h b/tests/bionic/libc/bionic/lib_static_init.h
deleted file mode 100644 (file)
index 934eb8f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef _lib_static_init_h
-#define _lib_static_init_h
-
-class Foo {
-private:
-    int         value;
-    static int  counter;
-public:
-    virtual int getValue();
-    Foo();
-    virtual ~Foo();
-};
-
-Foo::~Foo()
-{
-}
-
-extern Foo  theFoo;
-
-#endif /* _lib_static_init_h */
diff --git a/tests/bionic/libc/bionic/libdlclosetest1.cpp b/tests/bionic/libc/bionic/libdlclosetest1.cpp
deleted file mode 100644 (file)
index d19b639..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <stdio.h>
-
-class Foo {
-public:
-    Foo();
-    virtual ~Foo();
-};
-
-
-/* This library is used to ensure that static C++ construction
- * and destruction operate normally on dlopen() and dlclose().
- *
- * We use a global variable inside the DLL called "x"
- * and initialize it to 1 in the static C++ constructor.
- *
- * The main program can access its address through dlsym()
- * then later check that it was properly initialized.
- */
-extern "C" int  x;
-int x = 0;
-
-Foo::Foo()
-{
-    x = 1;
-    fprintf(stderr, "%s: setting x to 1\n", __FUNCTION__);
-}
-
-/* Similarly, the main program can provide the address of
- * an integer, named "y", that will be set to 2 when the
- * static C++ destructor is called on dlclose().
- *
- * This address must be provided through the "set_y" function
- * that can also be resolved through dlsym() by the program.
- */
-static int *to_y = NULL;
-
-Foo::~Foo()
-{
-    if (to_y == NULL) {
-        fprintf(stderr, "%s: to_y uinitialized !!\n", __FUNCTION__);
-        *(int *)NULL = 0; // crash
-    }
-    *to_y = 2;
-    fprintf(stderr, "%s: setting y(%p) to 2 !\n", __FUNCTION__, to_y);
-}
-
-static Foo  f;
-
-extern "C"
-void set_y(int *y)
-{
-    to_y = y;
-    fprintf(stderr, "%s: setting to_y=%p\n", __FUNCTION__, y);
-}
diff --git a/tests/bionic/libc/bionic/libdlclosetest2.c b/tests/bionic/libc/bionic/libdlclosetest2.c
deleted file mode 100644 (file)
index bd37175..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-#include <stdio.h>
-
-/* This library is used to ensure that static C construction
- * and destruction operate normally on dlopen() and dlclose().
- *
- * We use a global variable inside the DLL called "x"
- * and initialize it to 1 in the static Foo_create constructor.
- *
- * The main program can access its address through dlsym()
- * then later check that it was properly initialized.
- */
-int x = 0;
-
-static void __attribute__((constructor))
-Foo_create(void)
-{
-    x = 1;
-    fprintf(stderr, "%s: setting x to 1\n", __FUNCTION__);
-}
-
-/* Similarly, the main program can provide the address of
- * an integer, named "y", that will be set to 2 when the
- * destructor is called on dlclose().
- *
- * This address must be provided through the "set_y" function
- * that can also be resolved through dlsym() by the program.
- */
-static int *to_y = NULL;
-
-static void __attribute__((destructor))
-Foo_destroy(void)
-{
-    if (to_y == NULL) {
-        fprintf(stderr, "%s: to_y uninitialized!!\n", __FUNCTION__);
-        *(int *)NULL = 0; // crash
-    }
-    *to_y = 2;
-    fprintf(stderr, "%s: setting y(%p) to 2!\n", __FUNCTION__, to_y);
-}
-
-void set_y(int *y)
-{
-    to_y = y;
-    fprintf(stderr, "%s: setting to_y=%p\n", __FUNCTION__, y);
-}
diff --git a/tests/bionic/libc/bionic/test_dlclose_destruction.c b/tests/bionic/libc/bionic/test_dlclose_destruction.c
deleted file mode 100644 (file)
index 348df17..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-
-/* this program is used to check that static C++ destructors are
- * properly called when dlclose() is called. We do this by using
- * a helper C++ shared library.
- *
- * See libdlclosetest1.cpp for details.
- */
-#include <dlfcn.h>
-#include <stdio.h>
-
-static int
-check_library(const char*  libname)
-{
-    void*  lib = dlopen(libname, RTLD_NOW);
-    int*   to_x;
-    void  (*set_y)(int *);
-    int    y = 0;
-
-    if (lib == NULL) {
-        fprintf(stderr, "Could not load shared library %s: %s\n", libname, dlerror());
-        return 1;
-    }
-
-    fprintf(stderr, "%s loaded.\n", libname);
-
-    to_x = dlsym(lib, "x");
-    if (to_x == NULL) {
-        fprintf(stderr, "Could not access global DLL variable (x) in %s: %s\n", libname, dlerror());
-        return 10;
-    }
-
-    if (*to_x != 1) {
-        fprintf(stderr, "Constructor was not run on dlopen(\"%s\") !\n", libname);
-        return 11;
-    }
-
-    set_y = dlsym(lib, "set_y");
-    if (set_y == NULL) {
-        fprintf(stderr, "Could not access global DLL function (set_y) in %s: %s\n", libname, dlerror());
-        return 12;
-    }
-
-    y = 0;
-    (*set_y)(&y);
-
-    if (dlclose(lib) < 0) {
-        fprintf(stderr, "Could not unload shared library %s: %s\n", libname, dlerror());
-        return 2;
-    }
-
-    fprintf(stderr, "%s unloaded.\n", libname);
-    if (y != 2) {
-        fprintf(stderr, "Static destructors was not called on dlclose()!\n");
-        return 2;
-    }
-    return 0;
-}
-
-int main(void)
-{
-    /* Testing static C++ construction/destruction */
-    if (check_library("libdlclosetest1.so"))
-        return 1;
-    if (check_library("libdlclosetest2.so"))
-        return 2;
-    return 0;
-}
diff --git a/tests/bionic/libc/bionic/test_getgrouplist.c b/tests/bionic/libc/bionic/test_getgrouplist.c
deleted file mode 100644 (file)
index e5b8ee2..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <stdio.h>
-#include <grp.h>
-
-#define  MAX_GROUPS  100
-#define  TEST_GROUP  1337
-#define  TEST_USER   "nobodyisreallyhere"
-
-int  main(void)
-{
-    int    count = MAX_GROUPS;
-    gid_t  groups[MAX_GROUPS];
-    int    ret;
-
-    /* this only tests the funky behaviour of our stubbed getgrouplist()
-     * implementation. which should only return TEST_GROUP, independent
-     * of the user
-     */
-    ret = getgrouplist( TEST_USER, TEST_GROUP, groups, &count );
-    if (ret != 1) {
-        fprintf(stderr, "getgrouplist() returned %d (expecting 1), ngroups=%d\n", 
-                ret, count);
-        return 1;
-    }
-    if (groups[0] != TEST_GROUP) {
-        fprintf(stderr, "getgrouplist() returned group %d (expecting %d)\n",
-                        groups[0], TEST_GROUP);
-        return 1;
-    }
-    printf ("ok\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/bionic/test_mutex.c b/tests/bionic/libc/bionic/test_mutex.c
deleted file mode 100644 (file)
index 02257ba..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#define __USE_UNIX98  1  /* necessary to define pthread_mutexattr_set/gettype in Linux GLIBC headers. doh ! */
-#include <pthread.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-
-static void  panic( const char*  format, ... )
-{
-    va_list  args;
-    va_start(args, format);
-    vfprintf(stderr, format, args);
-    va_end(args);
-    exit(1);
-}
-
-#define  assert(cond)   do { if ( !(cond) ) panic( "%s:%d: assertion failure: %s\n", __FILE__, __LINE__, #cond ); } while (0)
-
-#define  expect(call,result)                                         \
-    do {                                                             \
-        int  ret = (call);                                           \
-        if (ret != (result)) {                                       \
-            panic( "%s:%d: call returned %d instead of %d: %s\n",    \
-                   __FILE__, __LINE__, ret, (result), #call );       \
-        }                                                            \
-    } while (0)
-
-
-int  main( void )
-{
-    pthread_mutex_t       lock = PTHREAD_MUTEX_INITIALIZER;
-    pthread_mutexattr_t   attr;
-    int                   attr_type;
-
-    expect( pthread_mutexattr_init( &attr ), 0 );
-
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_NORMAL ), 0 );
-    expect( pthread_mutexattr_gettype( &attr, &attr_type ), 0 );
-    assert( attr_type == PTHREAD_MUTEX_NORMAL );
-
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK ), 0 );
-    expect( pthread_mutexattr_gettype( &attr, &attr_type ), 0 );
-    assert( attr_type == PTHREAD_MUTEX_ERRORCHECK );
-
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ), 0 );
-    expect( pthread_mutexattr_gettype( &attr, &attr_type ), 0 );
-    assert( attr_type == PTHREAD_MUTEX_RECURSIVE );
-
-    /* standard mutexes */
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_NORMAL ), 0 );
-    expect( pthread_mutex_init( &lock, &attr ), 0 );
-    expect( pthread_mutex_lock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_destroy( &lock ), 0 );
-
-    /* error-check mutex */
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK ), 0 );
-    expect( pthread_mutex_init( &lock, &attr ), 0 );
-    expect( pthread_mutex_lock( &lock ), 0 );
-    expect( pthread_mutex_lock( &lock ), EDEADLK );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_trylock( &lock ), 0 );
-    expect( pthread_mutex_trylock( &lock ), EDEADLK );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), EPERM );
-    expect( pthread_mutex_destroy( &lock ), 0 );
-
-    /* recursive mutex */
-    expect( pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ), 0 );
-    expect( pthread_mutex_init( &lock, &attr ), 0 );
-    expect( pthread_mutex_lock( &lock ), 0 );
-    expect( pthread_mutex_lock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_trylock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), 0 );
-    expect( pthread_mutex_unlock( &lock ), EPERM );
-    expect( pthread_mutex_destroy( &lock ), 0 );
-
-    printf( "ok\n" );
-    return 0;
-}
diff --git a/tests/bionic/libc/bionic/test_netinet_icmp.c b/tests/bionic/libc/bionic/test_netinet_icmp.c
deleted file mode 100644 (file)
index 308ccce..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/* this test simply checks that we can compile the <netinet/ip_icmp.h> header */
-#include <netinet/ip_icmp.h>
-
-int  main( void )
-{
-    return 0;
-}
-
index 26746fa..6b13d77 100644 (file)
@@ -12,7 +12,7 @@ static pthread_mutex_t test_lock = PTHREAD_MUTEX_INITIALIZER;
 static void *
 thread1_func(void* arg)
 {
-    printf("Thread 1 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
+    printf("Thread 1 (arg=%p tid=%d) entered.\n", arg, gettid());
     printf("1 waiting for cond1\n");
     pthread_mutex_lock(&test_lock);
     pthread_cond_wait(&cond1, &test_lock );
@@ -24,7 +24,7 @@ thread1_func(void* arg)
 static void *
 thread2_func(void* arg)
 {
-    printf("Thread 2 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
+    printf("Thread 2 (arg=%p tid=%d) entered.\n", arg, gettid());
     printf("2 waiting for cond2\n");
     pthread_mutex_lock(&test_lock);
     pthread_cond_wait(&cond2, &test_lock );
@@ -37,7 +37,7 @@ thread2_func(void* arg)
 static void *
 thread3_func(void* arg)
 {
-    printf("Thread 3 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
+    printf("Thread 3 (arg=%p tid=%d) entered.\n", arg, gettid());
     printf("3 waiting for cond1\n");
     pthread_mutex_lock(&test_lock);
     pthread_cond_wait(&cond1, &test_lock );
@@ -54,7 +54,7 @@ thread3_func(void* arg)
 static void *
 thread4_func(void* arg)
 {
-    printf("Thread 4 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
+    printf("Thread 4 (arg=%p tid=%d) entered.\n", arg, gettid());
     printf("4 Sleeping\n");
     sleep(5);
 
@@ -64,7 +64,7 @@ thread4_func(void* arg)
     return 0;
 }
 
-int main(int argc, const char *argv[])
+int main(int argc __unused, const char *argv[] __unused)
 {
     pthread_t t[4];
 
diff --git a/tests/bionic/libc/bionic/test_pthread_create.c b/tests/bionic/libc/bionic/test_pthread_create.c
deleted file mode 100644 (file)
index edac0ff..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-static void *
-thread1_func(void* arg)
-{
-    printf("Thread 1 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
-    return 0;
-}
-
-static void *
-thread2_func(void* arg)
-{
-    printf("thread 2 (arg=%d tid=%d) entered.\n", (unsigned)arg, gettid());
-    return 1;
-}
-
-
-int main( void )
-{
-    pthread_t t1, t2;
-
-    pthread_create( &t1, NULL, thread1_func, (void *)1 );
-
-    pthread_join(t1, NULL);
-
-    printf("OK\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/bionic/test_relocs.c b/tests/bionic/libc/bionic/test_relocs.c
deleted file mode 100644 (file)
index c42df11..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* this little test is written to check that the relocations generated
- * in a shared library are correct. it depends on the content of lib_relocs.c
- * being compiled as a shared object.
- */
-#include <stdio.h>
-
-extern int  func1(void);
-extern int  func2(void);
-
-int
-main( void )
-{
-    int   f1, f2, expect1 = 1, expect2 = 2;
-
-    f1 = func1();
-    f2 = func2();
-
-    printf( "func1() returns %d: %s\n", f1, (f1 == expect1) ? "OK" : "FAIL" );
-    printf( "func2() returns %d: %s\n", f2, (f2 == expect2) ? "OK" : "FAIL" );
-
-    if (f1 != expect1 || f2 != expect2)
-        return 1;
-
-    return 0;
-}
diff --git a/tests/bionic/libc/bionic/test_static_init.cpp b/tests/bionic/libc/bionic/test_static_init.cpp
deleted file mode 100644 (file)
index cbc4a59..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "lib_static_init.h"
-
-Foo  theFoo2;
-
-int  main(int  argc, char**  argv)
-{
-    int  c = theFoo.getValue();
-
-    /* check the counter on the library object
-     * it must have been called first, and only once
-     */
-    if (c != 1) {
-        printf("KO (counter(shared) == %d, expected 1)\n", c);
-        return 1;
-    }
-
-    /* check the counter on the executable object,
-     * it must have been called second, and only once
-     */
-    c = theFoo2.getValue();
-    if (c != 2) {
-        printf("KO (counter(executable) == %d, expected 2)\n", c);
-        return 1;
-    }
-
-    printf("OK\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/common/hello_world.cpp b/tests/bionic/libc/common/hello_world.cpp
deleted file mode 100644 (file)
index 0578d7d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <iostream>
-using namespace std;
-
-int  main()
-{
-    cout << "Hello World" << endl;
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_clock.c b/tests/bionic/libc/common/test_clock.c
deleted file mode 100644 (file)
index 6d3752e..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- */
-
-// Minimal test program for clock
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <unistd.h>
-
-// this thread soaks the CPU so that clock() function will advance
-void *cpu_hog(void *arg)
-{
-    for (;;) {
-        // the system call should not be optimized away by the compiler
-        (void) getpid();
-    }
-}
-
-int main(int argc, char **argv)
-{
-    pthread_t thread;
-    clock_t ticks10, ticks15;
-
-    // do not call clock() here so we can test initialization
-
-    // soak the CPU for 10 seconds, then read clock
-    pthread_create(&thread, NULL, cpu_hog, NULL);
-    sleep(10);
-    ticks10 = clock();
-
-    // soak the CPU for 5 more seconds, then read clock
-    sleep(5);
-    ticks15 = clock();
-
-    // print the results
-    printf("CLOCKS_PER_SEC = %ld ticks/sec\n", (clock_t) CLOCKS_PER_SEC);
-    printf("At 10 secs clock=%lu, at 15 secs clock=%lu\n", ticks10, ticks15);
-
-    // exit could wait for the other thread to complete
-    _exit(EXIT_SUCCESS);
-}
diff --git a/tests/bionic/libc/common/test_cpu_set.c b/tests/bionic/libc/common/test_cpu_set.c
deleted file mode 100644 (file)
index bb26492..0000000
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-#define _GNU_SOURCE 1
-#include <sched.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int failures = 0;
-
-#define TEST_INT_EQ(cond,exp) \
-    do {\
-        int  _cond = (cond); \
-        int  _exp  = (exp); \
-        if ((_cond) != (_exp)) {\
-            fprintf(stderr, "Assertion failure:%s:%d: '%s' returned %d (%d expected)\n", \
-                    __FUNCTION__, __LINE__, #cond, _cond, _exp);\
-        }\
-    }while(0)
-
-#define  T(cond)  \
-    do {\
-        if (!(cond)) {\
-            fprintf(stderr,"Assertion failure:%s:%d: %s is not TRUE\n",\
-                           __FUNCTION__, __LINE__, #cond);\
-            failures++;\
-        }\
-    } while(0)
-
-#define  F(cond) \
-    do {\
-        if (!!(cond)) {\
-            fprintf(stderr,"Assertion failure:%s:%d: %s is not FALSE\n",\
-                           __FUNCTION__, __LINE__, #cond);\
-            failures++;\
-        }\
-    } while (0)
-
-
-static void
-test_1(cpu_set_t* set)
-{
-    cpu_set_t  other[1];
-    int nn, nnMax = CPU_SETSIZE;
-
-    memset(other, 0, sizeof *other);
-    TEST_INT_EQ(CPU_COUNT(other),0);
-
-    /* First, cheeck against zero */
-    CPU_ZERO(set);
-    TEST_INT_EQ(CPU_COUNT(set),0);
-    T(CPU_EQUAL(set, other));
-    T(CPU_EQUAL(other, set));
-
-    for (nn = 0; nn < nnMax; nn++)
-        F(CPU_ISSET(nn, set));
-
-    /* Check individual bits */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_SET(nn, set);
-        TEST_INT_EQ(CPU_COUNT(set),1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET(mm, set) == (mm == nn));
-        }
-        CPU_CLR(nn, set);
-        T(CPU_EQUAL(set, other));
-    }
-
-    /* Check cumulative bits, incrementing */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_SET(nn, set);
-        TEST_INT_EQ(CPU_COUNT(set), nn+1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET(mm, set) == (mm <= nn));
-        }
-    }
-
-    /* Check individual clear bits */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_CLR(nn, set);
-        TEST_INT_EQ(CPU_COUNT(set), nnMax-1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET(mm, set) == (mm != nn));
-        }
-        CPU_SET(nn, set);
-    }
-
-    /* Check cumulative bits, decrementing */
-    for (nn = nnMax-1; nn >= 0; nn--) {
-        int mm;
-        CPU_CLR(nn, set);
-        TEST_INT_EQ(CPU_COUNT(set), nn);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET(mm, set) == (mm < nn));
-        }
-    }
-    T(CPU_EQUAL(set, other));
-}
-
-static void
-test_1_s(size_t setsize, cpu_set_t* set)
-{
-    int nn, nnMax;
-    cpu_set_t* other;
-
-    /* First, cheeck against zero */
-    other = calloc(1,setsize);
-    TEST_INT_EQ(CPU_COUNT(other),0);
-    CPU_ZERO_S(setsize, set);
-    T(CPU_EQUAL_S(setsize, set, other));
-    T(CPU_EQUAL_S(setsize, other, set));
-
-    nnMax = setsize*8;
-    for (nn = 0; nn < nnMax; nn++)
-        F(CPU_ISSET_S(nn, setsize, set));
-
-    /* Check individual bits */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_SET_S(nn, setsize, set);
-        TEST_INT_EQ(CPU_COUNT_S(setsize, set), 1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET_S(mm, setsize, set) == (mm == nn));
-        }
-        CPU_CLR_S(nn, setsize, set);
-        T(CPU_EQUAL_S(setsize, set, other));
-    }
-
-    /* Check cumulative bits, incrementing */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_SET_S(nn, setsize, set);
-        TEST_INT_EQ(CPU_COUNT_S(setsize, set), nn+1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET_S(mm, setsize, set) == (mm <= nn));
-        }
-    }
-
-    /* Check individual clear bits */
-    for (nn = 0; nn < nnMax; nn++) {
-        int mm;
-        CPU_CLR_S(nn, setsize, set);
-        TEST_INT_EQ(CPU_COUNT_S(setsize, set), nnMax-1);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET_S(mm, setsize, set) == (mm != nn));
-        }
-        CPU_SET_S(nn, setsize, set);
-    }
-
-    /* Check cumulative bits, decrementing */
-    for (nn = nnMax-1; nn >= 0; nn--) {
-        int mm;
-        CPU_CLR_S(nn, setsize, set);
-        TEST_INT_EQ(CPU_COUNT_S(setsize, set), nn);
-        for (mm = 0; mm < nnMax; mm++) {
-            T(CPU_ISSET_S(mm, setsize, set) == (mm < nn));
-        }
-    }
-    T(CPU_EQUAL_S(setsize, set, other));
-
-    free(other);
-}
-
-
-int main(void)
-{
-    cpu_set_t  set0;
-    int cpu;
-    test_1(&set0);
-    test_1_s(sizeof(set0), &set0);
-
-    size_t count;
-    for (count = 32; count <= 1024; count *= 2) {
-        cpu_set_t* set = CPU_ALLOC(count);
-        test_1_s(count/8, set);
-        CPU_FREE(set);
-    }
-
-    T((cpu = sched_getcpu()) >= 0);
-
-    int ret;
-    TEST_INT_EQ((ret = sched_getaffinity(getpid(), sizeof(cpu_set_t), &set0)), 0);
-
-    CPU_ZERO(&set0);
-    CPU_SET(cpu, &set0);
-
-    TEST_INT_EQ((ret = sched_setaffinity(getpid(), sizeof(cpu_set_t), &set0)), 0);
-
-    if (failures == 0) {
-        printf("OK\n");
-        return 0;
-    } else {
-        printf("KO: %d failures\n", failures);
-        return 1;
-    }
-}
diff --git a/tests/bionic/libc/common/test_dlopen_null.c b/tests/bionic/libc/common/test_dlopen_null.c
deleted file mode 100644 (file)
index 42b23dd..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <dlfcn.h>
-#include <stddef.h>
-#include <stdio.h>
-
-extern int foo(void)
-{
-    return 42;
-}
-
-int (*func_ptr)(void) = foo;
-
-int main(void)
-{
-    void*  lib = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL);
-    void*  symbol;
-
-#if 0
-    /* The Gold linker will garbage-collect unused global functions
-     * even if --Wl,--export-dynamic is used. So use a dummy global
-     * variable reference here to prevent this.
-     */
-    if (foo() != 42)
-        return 3;
-#endif
-
-    if (lib == NULL) {
-        fprintf(stderr, "Could not open self-executable with dlopen(NULL) !!: %s\n", dlerror());
-        return 1;
-    }
-    symbol = dlsym(lib, "foo");
-    if (symbol == NULL) {
-        fprintf(stderr, "Could not lookup symbol inside executable !!: %s\n", dlerror());
-        return 2;
-    }
-    dlclose(lib);
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_executable_destructor.c b/tests/bionic/libc/common/test_executable_destructor.c
deleted file mode 100644 (file)
index e0e1d45..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-#include <stdio.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-
-/* A very simple program used to test constructor and destructor functions
- * in executables (instead of shared libraries).
- */
-
-int x = 0;
-
-/* Initialize x to 1 when the program starts. This will be checked
- * later by the main() function.
- */
-static void __attribute__((constructor))
-on_load(void)
-{
-    x = 1;
-}
-
-/* Crash intentionally if 'x' is set to 1 */
-static void __attribute__((destructor))
-on_exit(void)
-{
-    if (x == 1)
-        *(int*)(void*)0 = 10;  /* force a crash */
-}
-
-int main(void)
-{
-    int status;
-    pid_t pid;
-
-    /* First, check that the constructor was properly called ! */
-    if (x != 1) {
-        fprintf(stderr, "Constructor function not called!!\n");
-        return 1;
-    }
-
-    /* prevent our crashing child process from generating a core file */
-    {
-        struct rlimit rlim;
-        rlim.rlim_cur = 0;
-        rlim.rlim_max = RLIM_INFINITY;
-        setrlimit(RLIMIT_CORE, &rlim);
-    }
-
-    /* Fork the current process, then wait for the child to exit
-     * and crash.
-     */
-    pid = fork();
-    if (pid < 0) {
-        fprintf(stderr, "Could not fork process: %s\n", strerror(errno));
-        return 2;
-    }
-    /* in the child, simply exit after 1 second. */
-    if (pid == 0) {
-        sleep(1);
-        return 0;
-    }
-    /* in the parent, wait for the child to terminate */
-    if (wait(&status) < 0) {
-        fprintf(stderr, "Could not wait for child: %s\n", strerror(errno));
-        return 3;
-    }
-    if (!WIFSIGNALED(status)) {
-        fprintf(stderr, "Destructor not called!!\n");
-        return 4;
-    }
-
-    /* Prevent crashing */
-    x = 2;
-    printf("ok\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_getaddrinfo.c b/tests/bionic/libc/common/test_getaddrinfo.c
deleted file mode 100644 (file)
index 444bef8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/* this program is used to test that getaddrinfo() works correctly
- * without a 'hints' argument
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
-#include <stdio.h>  /* for printf */
-#include <string.h> /* for memset */
-#include <netinet/in.h>  /* for IPPROTO_TCP */
-
-#define  SERVER_NAME  "www.android.com"
-#define  PORT_NUMBER  "9999"
-
-int main(void)
-{
-    struct addrinfo  hints;
-    struct addrinfo* res;
-    int              ret;
-
-    /* first, try without any hints */
-    ret = getaddrinfo( SERVER_NAME, PORT_NUMBER, NULL, &res);
-    if (ret != 0) {
-        printf("first getaddrinfo returned error: %s\n", gai_strerror(ret));
-        return 1;
-    }
-
-    freeaddrinfo(res);
-
-    /* now try with the hints */
-    memset(&hints, 0, sizeof(hints));
-    hints.ai_family   = AF_UNSPEC;
-    hints.ai_socktype = SOCK_STREAM;
-    hints.ai_protocol = IPPROTO_TCP;
-
-    ret = getaddrinfo( SERVER_NAME, PORT_NUMBER, &hints, &res );
-    if (ret != 0) {
-        printf("second getaddrinfo returned error: %s\n", gai_strerror(ret));
-        return 1;
-    }
-
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_gethostbyname.c b/tests/bionic/libc/common/test_gethostbyname.c
deleted file mode 100644 (file)
index 90b185d..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#define _GNU_SOURCE 1
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <netdb.h>
-
-int  main( int  argc, char**  argv )
-{
-    char*            hostname = "localhost";
-    struct hostent*  hent;
-    int    i, ret;
-
-    if (argc > 1)
-        hostname = argv[1];
-
-    hent = gethostbyname(hostname);
-    if (hent == NULL) {
-        printf("gethostbyname(%s) returned NULL !!\n", hostname);
-        return 1;
-    }
-    printf( "gethostbyname(%s) returned:\n", hostname);
-    printf( "  name: %s\n", hent->h_name );
-    printf( "  aliases:" );
-    for (i = 0; hent->h_aliases[i] != NULL; i++)
-        printf( " %s", hent->h_aliases[i] );
-    printf( "\n" );
-    printf( "  address type: " );
-    switch (hent->h_addrtype) {
-        case AF_INET:  printf( "AF_INET\n"); break;
-        case AF_INET6: printf( "AF_INET6\n"); break;
-        default: printf("UNKNOWN (%d)\n", hent->h_addrtype);
-    }
-    printf( "  address: " );
-    switch (hent->h_addrtype) {
-        case AF_INET:
-            {
-                const char*  dot = "";
-                for (i = 0; i < hent->h_length; i++) {
-                    printf("%s%d", dot, ((unsigned char*)hent->h_addr)[i]);
-                    dot = ".";
-                }
-            }
-            break;
-
-        default:
-            for (i = 0; i < hent->h_length; i++) {
-                printf( "%02x", ((unsigned char*)hent->h_addr)[i] );
-            }
-    }
-    printf("\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_gethostname.c b/tests/bionic/libc/common/test_gethostname.c
deleted file mode 100644 (file)
index 96ca4e3..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-int  main( void )
-{
-    char  hostname[512];
-    int   ret;
-
-    ret = gethostname(hostname, sizeof(hostname));
-    if (ret < 0) {
-        printf("gethostname() returned error %d: %s\n", errno, strerror(errno));
-        return 1;
-    }
-
-    printf("gethostname() returned '%s'\n", hostname);
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_pthread_cleanup_push.c b/tests/bionic/libc/common/test_pthread_cleanup_push.c
deleted file mode 100644 (file)
index 87634ad..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-#define MAGIC1 0xcafebabeU
-#define MAGIC2 0x8badf00dU
-#define MAGIC3 0x12345667U
-
-static int g_ok1 = 0;
-static int g_ok2 = 0;
-static int g_ok3 = 0;
-
-static void
-cleanup1( void* arg )
-{
-    if ((unsigned)arg != MAGIC1)
-        g_ok1 = -1;
-    else
-        g_ok1 = +1;
-}
-
-static void
-cleanup2( void* arg )
-{
-    if ((unsigned)arg != MAGIC2) {
-        g_ok2 = -1;
-    } else
-        g_ok2 = +1;
-}
-
-static void
-cleanup3( void* arg )
-{
-    if ((unsigned)arg != MAGIC3)
-        g_ok3 = -1;
-    else
-        g_ok3 = +1;
-}
-
-
-static void*
-thread1_func( void* arg )
-{
-    pthread_cleanup_push( cleanup1, (void*)MAGIC1 );
-    pthread_cleanup_push( cleanup2, (void*)MAGIC2 );
-    pthread_cleanup_push( cleanup3, (void*)MAGIC3 );
-
-    if (arg != NULL)
-        pthread_exit(0);
-
-    pthread_cleanup_pop(0);
-    pthread_cleanup_pop(1);
-    pthread_cleanup_pop(1);
-
-    return NULL;
-}
-
-static int test( int do_exit )
-{
-    pthread_t t;
-
-    pthread_create( &t, NULL, thread1_func, (void*)do_exit );
-    pthread_join( t, NULL );
-
-    if (g_ok1 != +1) {
-        if (g_ok1 == 0) {
-            fprintf(stderr, "cleanup1 not called !!\n");
-        } else {
-            fprintf(stderr, "cleanup1 called with wrong argument\n" );
-        }
-        exit(1);
-    }
-    else if (g_ok2 != +1) {
-        if (g_ok2 == 0)
-            fprintf(stderr, "cleanup2 not called !!\n");
-        else
-            fprintf(stderr, "cleanup2 called with wrong argument\n");
-        exit(2);
-    }
-    else if (do_exit && g_ok3 != +1) {
-        if (g_ok3 == 0) {
-            fprintf(stderr, "cleanup3 not called !!\n");
-        } else {
-            fprintf(stderr, "cleanup3 called with bad argument !!\n");
-        }
-        exit(3);
-    }
-    else if (!do_exit && g_ok3 != 0) {
-        if (g_ok3 == 1) {
-            fprintf(stderr, "cleanup3 wrongly called !!\n");
-        } else {
-            fprintf(stderr, "cleanup3 wrongly called with bad argument !!\n");
-        }
-        exit(3);
-    }
-
-    return 0;
-}
-
-int main( void )
-{
-    test(0);
-    test(1);
-    printf("OK\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_pthread_join.c b/tests/bionic/libc/common/test_pthread_join.c
deleted file mode 100644 (file)
index 4fe2561..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
-
-static void*
-thread1_func(void* arg)
-{
-    usleep( 2000*1000 );
-    printf("thread 1 exited\n");
-    return (void*) 0x8badf00d;
-}
-
-static void*
-thread2_func(void* arg)
-{
-    pthread_t t1 = (pthread_t)arg;
-    void* result;
-
-    pthread_join(t1, &result);
-    printf("thread2 received code %08x from thread1\n", (int)result);
-    return NULL;
-}
-
-
-static void*
-thread3_func(void* arg)
-{
-    pthread_t t1 = (pthread_t)arg;
-    void* result;
-
-    pthread_join(t1, &result);
-    printf("thread3 received code %08x from thread1\n", (int)result);
-    return NULL;
-}
-
-int main( void )
-{
-    pthread_t t1, t2, t3;
-
-    pthread_create( &t1, NULL, thread1_func, NULL );
-    pthread_create( &t2, NULL, thread2_func, (void*)t1 );
-    pthread_create( &t3, NULL, thread3_func, (void*)t1 );
-
-    pthread_join(t2, NULL);
-    pthread_join(t3, NULL);
-
-    printf("OK\n");
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_pthread_once.c b/tests/bionic/libc/common/test_pthread_once.c
deleted file mode 100644 (file)
index 3beda91..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#define  N_THREADS  100
-
-static pthread_once_t   once = PTHREAD_ONCE_INIT;
-
-static int      global_count = 0;
-
-static void
-once_function( void )
-{
-    struct timespec ts;
-
-    global_count += 1;
-
-    ts.tv_sec = 2;
-    ts.tv_nsec = 0;
-    nanosleep (&ts, NULL);
-}
-
-static void*
-thread_function(void*  arg)
-{
-    pthread_once( &once, once_function );
-
-    if (global_count != 1) {
-        printf ("thread %ld: global == %d\n", (long int) arg, global_count);
-        exit (1);
-    }
-    return NULL;
-}
-
-int  main( void )
-{
-    pthread_t   threads[N_THREADS];
-    int         nn;
-
-    for (nn = 0; nn < N_THREADS; nn++) {
-        if (pthread_create( &threads[nn], NULL, thread_function, (void*)(long int)nn) < 0) {
-            printf("creation of thread %d failed\n", nn);
-            return 1;
-        }
-    }
-
-    for (nn = 0; nn < N_THREADS; nn++) {
-        if (pthread_join(threads[nn], NULL)) {
-            printf("joining thread %d failed\n", nn);
-            return 1;
-        }
-    }
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_sem_post.c b/tests/bionic/libc/common/test_sem_post.c
deleted file mode 100644 (file)
index adc0f85..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-/* This program is used to test that sem_post() will wake up all
- * threads that are waiting on a single semaphore, and not all of
- * them.
- */
-
-#include <pthread.h>
-#include <semaphore.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-
-static sem_t  semaphore;
-
-/* Thread function, just wait for the semaphore */
-static void*
-thread_func(void* arg)
-{
-    sem_t *psem = (sem_t *)arg;
-    void *me = (void *)pthread_self();
-    printf("thread %p waiting\n", me);
-    sem_wait(psem);
-    printf("thread %p exiting\n", me);
-    return me;
-}
-
-#define MAX_THREADS  50
-
-int main(void)
-{
-    pthread_t   t[MAX_THREADS];
-    int         nn, value;
-
-    /* Initialize to 1, first thread will exit immediately.
-     * this is used to exercize more of the semaphore code path */
-    if ( sem_init( &semaphore, 0, 1 ) < 0 ) {
-        printf( "Could not initialize semaphore: %s\n", strerror(errno) );
-        return 1;
-    }
-
-    for ( nn = 0; nn < MAX_THREADS; nn++ ) {
-        if ( pthread_create( &t[nn], NULL, thread_func, &semaphore ) < 0 ) {
-            printf("Could not create thread %d: %s\n", nn+1, strerror(errno) );
-            return 2;
-        }
-    }
-    sleep( 1 );
-
-    for (nn = 0; nn < MAX_THREADS; nn++) {
-        sem_post(&semaphore);
-    }
-
-    for ( nn = 0; nn < MAX_THREADS; nn++) {
-        void* result;
-        pthread_join(t[nn], &result);
-        if (result != (void*)t[nn]) {
-            printf("Thread %p joined but returned %p\n", (void*)t[nn], result);
-        }
-    }
-
-    if (sem_getvalue(&semaphore, &value) < 0) {
-        printf("Could not get semaphore value: %s\n", strerror(errno));
-        return 3;
-    }
-    if (value != 1) {
-        printf("Error: Semaphore value = %d\n", value);
-        return 4;
-    }
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_semaphore.c b/tests/bionic/libc/common/test_semaphore.c
deleted file mode 100644 (file)
index 6792d86..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <pthread.h>
-#include <semaphore.h>
-#include <errno.h>
-#include <stdio.h>
-#include <time.h>
-#include <string.h>
-#include <unistd.h>
-
-/* a simple semaphore test, using three threads
- *
- *  a semaphore is initialized with a value of 1
- *
- *  Thread 1, 2 and 3 start at the same time
- *
- *  Thread 1 takes the semaphore, then sleeps for 2 seconds, then post the semaphore
- *  Thread 2 sleeps for 1 second, then waits the semaphore, sleeps for 2 seconds, then post the semaphoe
- *  Thread 3 sleeps 3 seconds, waits for the semaphore
- */
-
-static  sem_t   semaphore;
-
-static void*
-_thread1( void* unused )
-{
-    printf( "thread 1: waiting for semaphore\n" );
-    if ( sem_wait( &semaphore ) < 0 ) {
-        printf( "thread 1: could not wait for semaphore: %s\n", strerror(errno) );
-        return NULL;
-    }
-    printf( "thread 1: got the semaphore ! sleeping for 2 seconds\n" );
-    sleep( 2 );
-    printf( "thread 1: awake !! posting semaphore\n" );
-    if ( sem_post( &semaphore ) < 0 ) {
-        printf( "thread 2: could not post semaphore: %s\n", strerror(errno) );
-    }
-    printf( "thread 1: quitting\n" );
-    return NULL;
-}
-
-static void*
-_thread2( void* unused )
-{
-    printf( "thread 2: sleeping for 1 second\n" );
-    sleep(1);
-    printf( "thread 2: awake !! waiting for semaphore\n" );
-    if ( sem_wait( &semaphore ) < 0 ) {
-        printf( "thread 2: could not wait for semaphore: %s\n", strerror(errno) );
-        return NULL;
-    }
-    printf( "thread 2: got the semaphore ! sleeping for 2 seconds\n" );
-    sleep( 2 );
-    printf( "thread 2: awake !! posting semaphore\n" );
-    if ( sem_post( &semaphore ) < 0 ) {
-        printf( "thread 2: could not post semaphore: %s\n", strerror(errno) );
-    }
-    printf( "thread 2: quitting\n" );
-    return NULL;
-}
-
-
-static void*
-_thread3( void* unused )
-{
-    printf( "thread 3: sleeping for 3 seconds\n" );
-    sleep(3);
-    printf( "thread 3: awake !! waiting for semaphore\n" );
-    if ( sem_wait( &semaphore ) < 0 ) {
-        printf( "thread 3: could not wait for semaphore: %s\n", strerror(errno) );
-        return NULL;
-    }
-    printf( "thread 3: got semaphore. quitting\n" );
-    return NULL;
-}
-
-typedef void*  (*thread_func)(void*);
-
-static const  thread_func  thread_routines[] =
-{
-    &_thread1,
-    &_thread2,
-    &_thread3
-};
-
-int  main( void )
-{
-    pthread_t   t[3];
-    int         nn;
-
-    if ( sem_init( &semaphore, 0, 1 ) < 0 ) {
-        printf( "could not initialize semaphore: %s\n", strerror(errno) );
-        return -1;
-    }
-
-    for ( nn = 0; nn < 3; nn++ ) {
-        if ( pthread_create( &t[nn], NULL, thread_routines[nn], NULL ) < 0 ) {
-            printf("could not create thread %d: %s\n", nn+1, strerror(errno) );
-            return -2;
-        }
-    }
-    sleep( 5 );
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_seteuid.c b/tests/bionic/libc/common/test_seteuid.c
deleted file mode 100644 (file)
index ac330ce..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/types.h>
-
-int  main( void )
-{
-    uid_t ruid, euid;
-
-    printf( "sizeof(uid_t) = %d  sizeof(gid_t) = %d\n", sizeof(uid_t), sizeof(gid_t) );
-
-    ruid = getuid();
-    euid = geteuid();
-    printf("Start: ruid=%d euid=%d\n", ruid, euid);
-
-    if (seteuid(9999) != 0)
-       perror("seteuid(9999)");
-
-    ruid = getuid();
-    euid = geteuid();
-    printf("After set: ruid=%d euid=%d\n", ruid, euid);
-
-    if (seteuid(0) != 0)
-       perror("seteuid(0)");
-
-    ruid = getuid();
-    euid = geteuid();
-    printf("After restore: ruid=%d euid=%d\n", ruid, euid);
-
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_static_cpp_mutex.cpp b/tests/bionic/libc/common/test_static_cpp_mutex.cpp
deleted file mode 100644 (file)
index ea5d479..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-/* this program is used to test the locking of a recursive mutex in a static C++ constructor
- * this operation crashes on some
- */
-#include <pthread.h>
-#include <stdio.h>
-
-class Foo {
-private:
-    pthread_mutex_t  mMutex;
-public:
-    virtual int   getValue();
-    Foo();
-    virtual ~Foo();
-};
-
-Foo::Foo()
-{
-    pthread_mutexattr_t  mattr;
-
-    pthread_mutexattr_init(&mattr);
-    pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
-    pthread_mutex_init(&mMutex, &mattr);
-    pthread_mutex_lock(&mMutex);
-    fprintf(stderr, "recursive lock initialized and locked\n" );
-}
-
-Foo::~Foo()
-{
-    pthread_mutex_unlock(&mMutex);
-}
-
-int Foo::getValue()
-{
-    return 0;
-}
-
-static Foo  f;
-
-int main(void)
-{
-    printf( "f.getValue() returned: %d\n", f.getValue() );
-    return 0;
-}
diff --git a/tests/bionic/libc/common/test_udp.c b/tests/bionic/libc/common/test_udp.c
deleted file mode 100644 (file)
index 3c9dd07..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* this program is used to test UDP networking in Android.
- * used to debug the emulator's networking implementation
- */
-#define  PROGNAME      "test_udp"
-#define  DEFAULT_PORT  7000
-
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <string.h>
-
-#define BUFLEN 512
-#define NPACK  10
-
-void diep(char *s)
-{
-    perror(s);
-    exit(1);
-}
-
-static void
-usage(int  code)
-{
-    printf("usage: %s [options]\n", PROGNAME);
-    printf("options:\n");
-    printf("    -p<port>  use specific port (default %d)\n", DEFAULT_PORT);
-    printf("    -a<inet>  use specific IP address\n");
-    printf("    -s        run server (default is client)\n");
-    exit(code);
-}
-
-int main(int  argc, char**  argv)
-{
-    int   runServer = 0;
-    int   udpPort   = DEFAULT_PORT;
-    int   useLocal  = 0;
-    int   address   = htonl(INADDR_ANY);
-
-    struct sockaddr_in si_me, si_other;
-    int s, i, slen=sizeof(si_other);
-    char buf[BUFLEN];
-
-    while (argc > 1 && argv[1][0] == '-') {
-        const char*  optName = argv[1]+1;
-        argc--;
-        argv++;
-
-        switch (optName[0]) {
-            case 'p':
-                udpPort = atoi(optName+1);
-                if (udpPort < 1024 || udpPort > 65535) {
-                    fprintf(stderr, "UDP port must be between 1024 and 65535\n");
-                    exit(1);
-                }
-                break;
-
-            case 's':
-                runServer = 1;
-                break;
-
-            case 'a':
-                if (inet_aton(optName+1, &si_other.sin_addr) == 0)
-                    diep("inet_aton");
-                address = si_other.sin_addr.s_addr;
-                break;
-
-            default:
-                usage(1);
-        }
-    }
-
-    if (runServer) {
-        if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
-        diep("socket");
-
-        memset((char *) &si_me, 0, sizeof(si_me));
-        si_me.sin_family      = AF_INET;
-        si_me.sin_port        = htons(udpPort);
-        si_me.sin_addr.s_addr = address;
-        if (bind(s, (struct sockaddr*)&si_me, sizeof(si_me))==-1)
-            diep("bind");
-
-        printf("UDP server listening on %s:%d\n", inet_ntoa(si_me.sin_addr), udpPort);
-        for (i=0; i<NPACK; i++) {
-        if (recvfrom(s, buf, BUFLEN, 0, (struct sockaddr*)&si_other, (socklen_t*)&slen)==-1)
-            diep("recvfrom()");
-        printf("Received packet from %s:%d\nData: %s\n\n", 
-                inet_ntoa(si_other.sin_addr), ntohs(si_other.sin_port), buf);
-        }
-
-        printf("UDP server closing\n");
-        close(s);
-    }
-    else  /* !runServer */
-    {
-        if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
-            diep("socket");
-
-        memset((char *) &si_other, 0, sizeof(si_other));
-        si_other.sin_family = AF_INET;
-        si_other.sin_port = htons(udpPort);
-        si_other.sin_addr.s_addr = address;
-
-        printf("UDP client sending packets to %s:%d\n", inet_ntoa(si_other.sin_addr), udpPort);
-
-        for (i=0; i<NPACK; i++) {
-            printf("Sending packet %d\n", i);
-            sprintf(buf, "This is packet %d\n", i);
-            if (sendto(s, buf, BUFLEN, 0, (struct sockaddr*)&si_other, slen)==-1)
-            diep("sendto()");
-        }
-
-        close(s);
-        printf("UDP client closing\n");
-    }
-    return 0;
-}
diff --git a/tests/bionic/libc/glibc/assert/test-assert.c b/tests/bionic/libc/glibc/assert/test-assert.c
deleted file mode 100644 (file)
index 26b58d4..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Test assert().
- *
- * This is hairier than you'd think, involving games with
- * stdio and signals.
- *
- */
-
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <setjmp.h>
-
-jmp_buf rec;
-char buf[160];
-
-static void
-sigabrt (int unused)
-{
-  longjmp (rec, 1);  /* recover control */
-}
-
-#undef NDEBUG
-#include <assert.h>
-static void
-assert1 (void)
-{
-  assert (1 == 2);
-}
-
-static void
-assert2 (void)
-{
-  assert (1 == 1);
-}
-
-
-#define NDEBUG
-#include <assert.h>
-static void
-assert3 (void)
-{
-  assert (2 == 3);
-}
-
-int
-main (void)
-{
-
-  volatile int failed = 1;
-
-  fclose (stderr);
-  stderr = tmpfile ();
-  if(!stderr)
-    abort ();
-
-  signal (SIGABRT, sigabrt);
-
-  if (!setjmp (rec))
-    assert1 ();
-  else
-    failed = 0;  /* should happen */
-
-  if (!setjmp (rec))
-    assert2 ();
-  else
-    failed = 1; /* should not happen */
-
-  if (!setjmp (rec))
-    assert3 ();
-  else
-    failed = 1; /* should not happen */
-
-  rewind (stderr);
-  fgets (buf, 160, stderr);
-  if (!strstr (buf, "1 == 2"))
-    failed = 1;
-
-  fgets (buf, 160, stderr);
-  if (strstr (buf, "1 == 1"))
-    failed = 1;
-
-  fgets (buf, 160, stderr);
-  if (strstr (buf, "2 == 3"))
-    failed = 1;
-
-  return failed;
-}
diff --git a/tests/bionic/libc/other/test_sysconf.c b/tests/bionic/libc/other/test_sysconf.c
deleted file mode 100644 (file)
index 717cbcb..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-#include <unistd.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#define  T(_name,_cond)                                               \
-    errno = 0;                                                        \
-    printf( "testing %-*s : ", 32, #_name );                          \
-    ret   = sysconf( _name );                                         \
-    if (ret < 0 && errno != 0) {                                      \
-        printf( "error: %s\n", strerror(errno) );                     \
-    } else {                                                          \
-        if ( ret _cond )  {                                           \
-            printf( "OK  (%d)\n", ret );                              \
-        } else {                                                      \
-            printf( "ERROR: %d does not meet %s\n", ret, #_cond );    \
-        }                                                             \
-    }
-
-int  main( void )
-{
-    int  ret;
-    T(_SC_ARG_MAX, > 0);
-    T(_SC_BC_BASE_MAX, |1 );
-    T(_SC_BC_DIM_MAX, |1 );
-    T(_SC_BC_SCALE_MAX, |1 );
-    T(_SC_BC_STRING_MAX, |1 );
-    T(_SC_CHILD_MAX, >0 );
-    T(_SC_CLK_TCK, >0 );
-    T(_SC_COLL_WEIGHTS_MAX, |1 );
-    T(_SC_EXPR_NEST_MAX, |1 );
-    T(_SC_LINE_MAX, > 256 );
-    T(_SC_NGROUPS_MAX, >0 );
-    T(_SC_OPEN_MAX, >128 );
-    T(_SC_PASS_MAX, |1 );
-    T(_SC_2_C_BIND, >0 );
-    T(_SC_2_C_DEV, |1 );
-    T(_SC_2_C_VERSION, |1 );
-    T(_SC_2_CHAR_TERM, |1 );
-    T(_SC_2_FORT_DEV, |1 );
-    T(_SC_2_FORT_RUN, |1 );
-    T(_SC_2_LOCALEDEF, |1 );
-    T(_SC_2_SW_DEV, |1 );
-    T(_SC_2_UPE, |1 );
-    T(_SC_2_VERSION, |1);
-    T(_SC_JOB_CONTROL, == 1);
-    T(_SC_SAVED_IDS, == 1);
-    T(_SC_VERSION, |1);
-    T(_SC_RE_DUP_MAX, |1);
-    T(_SC_STREAM_MAX, > 0);
-    T(_SC_TZNAME_MAX, |1 );
-    T(_SC_XOPEN_CRYPT, |1 );
-    T(_SC_XOPEN_ENH_I18N, |1 );
-    T(_SC_XOPEN_SHM, |1 );
-    T(_SC_XOPEN_VERSION, |1 );
-    T(_SC_XOPEN_XCU_VERSION, |1 );
-    T(_SC_XOPEN_REALTIME, |1 );
-    T(_SC_XOPEN_REALTIME_THREADS, |1 );
-    T(_SC_XOPEN_LEGACY, |1 );
-    T(_SC_ATEXIT_MAX, >32 );
-    T(_SC_IOV_MAX, >0 );
-    T(_SC_PAGESIZE, == 4096 );
-    T(_SC_PAGE_SIZE, == 4096 );
-    T(_SC_XOPEN_UNIX, |1 );
-    T(_SC_XBS5_ILP32_OFF32, |1 );
-    T(_SC_XBS5_ILP32_OFFBIG, |1 );
-    T(_SC_XBS5_LP64_OFF64, |1 );
-    T(_SC_XBS5_LPBIG_OFFBIG, |1 );
-    T(_SC_AIO_LISTIO_MAX, |1 );
-    T(_SC_AIO_MAX, |1 );
-    T(_SC_AIO_PRIO_DELTA_MAX, |1 );
-    T(_SC_DELAYTIMER_MAX, >0 );
-    T(_SC_MQ_OPEN_MAX, |1 );
-    T(_SC_MQ_PRIO_MAX, >0 );
-    T(_SC_RTSIG_MAX, |1 );
-    T(_SC_SEM_NSEMS_MAX, |1 );
-    T(_SC_SEM_VALUE_MAX, |1 );
-    T(_SC_SIGQUEUE_MAX, >0 );
-    T(_SC_TIMER_MAX, |1 );
-    T(_SC_ASYNCHRONOUS_IO, |1 );
-    T(_SC_FSYNC, |1 );
-    T(_SC_MAPPED_FILES, |1 );
-    T(_SC_MEMLOCK, |1 );
-    T(_SC_MEMLOCK_RANGE, |1 );
-    T(_SC_MEMORY_PROTECTION, |1 );
-    T(_SC_MESSAGE_PASSING, |1 );
-    T(_SC_PRIORITIZED_IO, |1 );
-    T(_SC_PRIORITY_SCHEDULING, |1 );
-    T(_SC_REALTIME_SIGNALS, |1 );
-    T(_SC_SEMAPHORES, |1 );
-    T(_SC_SHARED_MEMORY_OBJECTS, |1 );
-    T(_SC_SYNCHRONIZED_IO, |1 );
-    T(_SC_TIMERS, |1 );
-    T(_SC_GETGR_R_SIZE_MAX, |1 );
-    T(_SC_GETPW_R_SIZE_MAX, |1 );
-    T(_SC_LOGIN_NAME_MAX, |1 );
-    T(_SC_THREAD_DESTRUCTOR_ITERATIONS, |1 );
-    T(_SC_THREAD_KEYS_MAX, > 0 );
-    T(_SC_THREAD_STACK_MIN, >= 8192 );
-    T(_SC_THREAD_THREADS_MAX, |1 );
-    T(_SC_TTY_NAME_MAX, > 0 );
-    T(_SC_THREADS, |1 );
-    T(_SC_THREAD_ATTR_STACKADDR, |1 );
-    T(_SC_THREAD_ATTR_STACKSIZE, |1 );
-    T(_SC_THREAD_PRIORITY_SCHEDULING, |1 );
-    T(_SC_THREAD_PRIO_INHERIT, |1 );
-    T(_SC_THREAD_PRIO_PROTECT, |1 );
-    T(_SC_THREAD_SAFE_FUNCTIONS, |1 );
-    return 0;
-}
diff --git a/tests/bionic/libc/other/test_vfprintf_leak.c b/tests/bionic/libc/other/test_vfprintf_leak.c
deleted file mode 100644 (file)
index 4e94c51..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 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.
- */
-/* this test is used to check that a memory-leak in vfprintf was fixed.
- * the initial code leaked heap memory each time a formatted double was printed
- */
-#include <stdio.h>
-
-extern size_t  dlmalloc_footprint();
-
-int  main(void)
-{
-    size_t   initial = dlmalloc_footprint();
-    size_t   final;
-    char     temp[64];
-    int      n;
-
-    for (n = 0; n < 10000; n++)
-        snprintf( temp, sizeof(temp), "%g", n*0.647287623 );
-
-    final   = dlmalloc_footprint();
-    /* vfprintf uses temporary heap blocks to do the formatting, so */
-    /* it's OK to have one page in there                            */
-    if (final <= 4096) {
-        printf( "OK: initial = %ld, final == %ld\n", (long)initial, (long)final );
-        return 0;
-    } else {
-        fprintf(stderr, "KO: initial == %ld, final == %ld\n", (long)initial, (long)final );
-        return 1;
-    }
-}
diff --git a/tests/bionic/libstdc++/Android.mk b/tests/bionic/libstdc++/Android.mk
deleted file mode 100644 (file)
index 1228662..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (C) 2009 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.
-#
-# Build control file for Bionic's test programs
-# define the BIONIC_TESTS environment variable to build the test programs
-#
-
-ifdef BIONIC_TESTS
-
-LOCAL_PATH:= $(call my-dir)
-
-# used to define a simple test program and build it as a standalone
-# device executable.
-#
-# you can use EXTRA_CFLAGS to indicate additional CFLAGS to use
-# in the build. the variable will be cleaned on exit
-#
-define device-test
-  $(foreach file,$(1), \
-    $(eval include $(CLEAR_VARS)) \
-    $(eval LOCAL_SRC_FILES := $(file)) \
-    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
-    $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \
-    $(eval LOCAL_MODULE_TAGS := tests) \
-    $(eval include $(BUILD_EXECUTABLE)) \
-  ) \
-  $(eval EXTRA_CFLAGS :=)
-endef
-
-# same as 'device-test' but builds a host executable instead
-# you can use EXTRA_LDLIBS to indicate additional linker flags
-#
-define host-test
-  $(foreach file,$(1), \
-    $(eval include $(CLEAR_VARS)) \
-    $(eval LOCAL_SRC_FILES := $(file)) \
-    $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \
-    $(eval LOCAL_CFLAGS += $(EXTRA_CFLAGS)) \
-    $(eval LOCAL_LDLIBS += $(EXTRA_LDLIBS)) \
-    $(eval LOCAL_MODULE_TAGS := tests) \
-    $(eval include $(BUILD_HOST_EXECUTABLE)) \
-  ) \
-  $(eval EXTRA_CFLAGS :=) \
-  $(eval EXTRA_LDLIBS :=)
-endef
-
-sources := \
-    test_cassert.cpp \
-    test_cctype.cpp \
-    test_climits.cpp \
-    test_cmath.cpp \
-    test_csetjmp.cpp \
-    test_csignal.cpp \
-    test_cstddef.cpp \
-    test_cstdio.cpp \
-    test_cstdlib.cpp \
-    test_cstring.cpp \
-    test_ctime.cpp
-
-$(call host-test, $(sources))
-
-EXTRA_CFLAGS := -DBIONIC=1 -I bionic/libstdc++/include
-
-# <cstdint> is not part of the C++ standard yet, and some
-# host environments don't provide it unless you use specific
-# compiler flags, so only build this test for device/Bionic
-# builds at the moment.
-#
-sources += test_cstdint.cpp
-
-$(call device-test, $(sources))
-
-endif  # BIONIC_TESTS
diff --git a/tests/bionic/libstdc++/README.TXT b/tests/bionic/libstdc++/README.TXT
deleted file mode 100644 (file)
index aa7f8a4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-This directory contains a set of tests for Android's Bionic Standard C++ library.
-
-You must define the BIONIC_TESTS environment variable to build these
-test programs. For example, do:
-
-    cd system/extras/tests/bionic/libstdc++
-    mm BIONIC_TESTS=1
-
-Preferably, to build and run you can use this:
-
-    runtest_py libstdcpp
-
-All test programs should exit with a status code of 0 in case of success, and 1
-in case of failure.
-
-The directory layout is currently flat because there is one Bionic test. If you
-want to add GNU STDC++ or benchmark tests, look in tests/bionic/libc as an
-example how to structure your files.
-
diff --git a/tests/bionic/libstdc++/test_cassert.cpp b/tests/bionic/libstdc++/test_cassert.cpp
deleted file mode 100644 (file)
index fc669a9..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-
-#include <cassert>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CASSERT__
-#error "Wrong header file included!!"
-#endif
-
-namespace {
-const int kPassed = 0;
-}  // anonymous namespace
-
-namespace android
-{
-#ifndef assert
-#error "assert must be a macro"
-#endif
-}  // android namespace
-
-int main(int argc, char **argv)
-{
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cctype.cpp b/tests/bionic/libstdc++/test_cctype.cpp
deleted file mode 100644 (file)
index cc64171..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cctype>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CCTYPE__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-}  // anonymous namespace
-
-namespace android
-{
-#ifdef isalnum
-#error "should be a real function"
-#endif
-#ifdef isalpha
-#error "should be a real function"
-#endif
-#ifdef iscntrl
-#error "should be a real function"
-#endif
-#ifdef isdigit
-#error "should be a real function"
-#endif
-#ifdef isgraph
-#error "should be a real function"
-#endif
-#ifdef islower
-#error "should be a real function"
-#endif
-#ifdef isprint
-#error "should be a real function"
-#endif
-#ifdef ispunct
-#error "should be a real function"
-#endif
-#ifdef isspace
-#error "should be a real function"
-#endif
-#ifdef isupper
-#error "should be a real function"
-#endif
-#ifdef isxdigit
-#error "should be a real function"
-#endif
-#ifdef tolower
-#error "should be a real function"
-#endif
-#ifdef toupper
-#error "should be a real function"
-#endif
-
-using std::isalnum;
-using std::isdigit;
-using std::isprint;
-using std::isupper;
-using std::tolower;
-using std::isalpha;
-using std::isgraph;
-using std::ispunct;
-using std::isxdigit;
-using std::toupper;
-using std::iscntrl;
-using std::islower;
-using std::isspace;
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_climits.cpp b/tests/bionic/libstdc++/test_climits.cpp
deleted file mode 100644 (file)
index 9fdba56..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-
-#include <climits>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CLIMITS__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-bool testLimits()
-{
-    // char
-    volatile char c1 = CHAR_BIT;
-    volatile char c2 = CHAR_MAX;
-    volatile char c3 = CHAR_MIN;
-
-    // int
-    volatile int i1 = INT_MAX;
-    volatile int i2 = INT_MIN;
-
-    // short
-    volatile short s1 = SHRT_MAX;
-    volatile short s2 = SHRT_MIN;
-
-    // long
-    volatile long l1 = LONG_MAX;
-    volatile long l2 = LONG_MIN;
-
-    // long long
-    volatile long long ll1 = LLONG_MAX;
-    volatile long long ll2 = LLONG_MIN;
-
-    volatile unsigned long mb = MB_LEN_MAX;
-
-    // signed char
-    volatile signed char sc1 = SCHAR_MIN;
-    volatile signed char sc2 = SCHAR_MAX;
-
-    // unsigned
-    volatile unsigned int ui = UINT_MAX;
-    volatile unsigned short us = USHRT_MAX;
-    volatile unsigned long ul = ULONG_MAX;
-    volatile unsigned long long ull = ULLONG_MAX;
-
-    return true;
-}
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testLimits);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cmath.cpp b/tests/bionic/libstdc++/test_cmath.cpp
deleted file mode 100644 (file)
index 847c934..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cmath>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CMATH__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-using ::cos;
-using ::sin;
-using ::tan;
-using ::acos;
-using ::asin;
-using ::atan;
-using ::atan2;
-
-using ::cosh;
-using ::sinh;
-using ::tanh;
-
-using ::exp;
-using ::frexp;
-using ::ldexp;
-using ::log;
-using ::log10;
-using ::modf;
-
-using ::pow;
-using ::sqrt;
-
-using ::ceil;
-using ::fabs;
-using ::floor;
-using ::fmod;
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_csetjmp.cpp b/tests/bionic/libstdc++/test_csetjmp.cpp
deleted file mode 100644 (file)
index 79b23d8..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <csetjmp>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSETJMP__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-#ifdef longjmp
-#error "longjmp must not be a macro"
-#endif
-
-#ifndef setjmp
-#error "setjmp must be a macro"
-#endif
-
-using std::longjmp;
-
-bool testJmpbuf()
-{
-    volatile std::jmp_buf jmpbuf;
-    return true;
-}
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testJmpbuf);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_csignal.cpp b/tests/bionic/libstdc++/test_csignal.cpp
deleted file mode 100644 (file)
index a460e64..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <csignal>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSIGNAL__
-#error "Wrong header file included!!"
-#endif
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-#ifdef raise
-#error "raise must not be a macro"
-#endif
-
-#ifndef SIGABRT
-#error "SIGABRT must be a macro"
-#endif
-
-#ifndef SIGILL
-#error "SIGILL must be a macro"
-#endif
-
-using std::raise;
-using std::signal;
-bool testSigAtomicT()
-{
-    volatile std::sig_atomic_t s;
-    return true;
-}
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testSigAtomicT);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cstddef.cpp b/tests/bionic/libstdc++/test_cstddef.cpp
deleted file mode 100644 (file)
index b1e280f..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cstddef>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTDDEF__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android {
-// Dummy struct used to calculate offset of some of its fields.
-struct Foo
-{
-    char field1;
-    char field2;
-};
-
-// Check various types are declared in the std namespace.
-bool testTypesStd()
-{
-    // size_t should be defined in both namespaces
-    volatile ::size_t size_t_in_top_ns = 0;
-    volatile ::std::size_t size_t_in_std_ns = 0;
-
-    if (sizeof(::size_t) != sizeof(::std::size_t))
-    {
-        return false;
-    }
-
-    // ptrdiff_t should be defined in both namespaces
-    volatile ::ptrdiff_t ptrdiff_t_in_top_ns = 0;
-    volatile ::std::ptrdiff_t ptrdiff_t_in_std_ns = 0;
-
-    if (sizeof(::ptrdiff_t) != sizeof(::std::ptrdiff_t))
-    {
-        return false;
-    }
-    // NULL is only in the top namespace
-    volatile int *null_is_defined = NULL;
-    return true;
-}
-
-bool testOffsetOf()
-{
-#ifndef offsetof
-#error "offsetof is not a macro"
-#endif
-
-    // offsetof is only in the top namespace
-    volatile size_t offset = offsetof(struct Foo, field2);
-    return offset == 1;
-}
-
-bool testNull()
-{
-#ifndef NULL
-#error "NULL is not a macro"
-#endif
-    // If NULL is void* this will issue a warning.
-    volatile int null_is_not_void_star = NULL;
-    return true;
-}
-
-}  // android namespace
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testTypesStd);
-    FAIL_UNLESS(testOffsetOf);
-    FAIL_UNLESS(testNull);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cstdint.cpp b/tests/bionic/libstdc++/test_cstdint.cpp
deleted file mode 100644 (file)
index a01164f..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cstdint>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTDINT__
-#error "Wrong header file included!!"
-#endif
-
-namespace {
-const int kPassed = 0;
-}  // anonymous namespace
-
-namespace android
-{
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cstdio.cpp b/tests/bionic/libstdc++/test_cstdio.cpp
deleted file mode 100644 (file)
index f22250a..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cstdio>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTDIO__
-#error "Wrong header file included!!"
-#endif
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-#ifndef BUFSIZ
-#error "BUFSIZ must be a macro"
-#endif
-
-#ifndef EOF
-#error "EOF must be a macro"
-#endif
-
-#ifndef FILENAME_MAX
-#error "FILENAME_MAX must be a macro"
-#endif
-
-#ifndef FOPEN_MAX
-#error "FOPEN_MAX must be a macro"
-#endif
-
-#ifndef L_tmpnam
-#error "L_tmpnam must be a macro"
-#endif
-
-#ifndef NULL
-#error "NULL must be a macro"
-#endif
-
-#ifndef SEEK_CUR
-#error "SEEK_CUR must be a macro"
-#endif
-
-#ifndef SEEK_END
-#error "SEEK_END must be a macro"
-#endif
-#ifndef SEEK_SET
-#error "SEEK_SET must be a macro"
-#endif
-
-#ifndef TMP_MAX
-#error "TMP_MAX must be a macro"
-#endif
-
-#ifndef _IOFBF
-#error "_IOFBF must be a macro"
-#endif
-
-#ifndef _IOLBF
-#error "_IOLBF must be a macro"
-#endif
-
-#ifndef _IONBF
-#error "_IONBF must be a macro"
-#endif
-
-#ifndef stderr
-#error "stderr must be a macro"
-#endif
-
-#ifndef stdin
-#error "stdin must be a macro"
-#endif
-
-#ifndef stdout
-#error "stdout must be a macro"
-#endif
-
-using std::clearerr;
-using std::fclose;
-using std::feof;
-using std::ferror;
-using std::fflush;
-using std::fgetc;
-using std::fgetpos;
-using std::fgets;
-using std::fopen;
-using std::fprintf;
-using std::fputc;
-using std::fputs;
-using std::fread;
-using std::freopen;
-using std::fscanf;
-using std::fseek;
-using std::fsetpos;
-using std::ftell;
-using std::fwrite;
-using std::getc;
-using std::getchar;
-using std::gets;
-using std::perror;
-using std::printf;
-using std::putc;
-using std::putchar;
-using std::puts;
-using std::remove;
-using std::rename;
-using std::rewind;
-using std::scanf;
-using std::setbuf;
-using std::setvbuf;
-using std::sprintf;
-using std::sscanf;
-using std::tmpfile;
-using std::tmpnam;
-using std::ungetc;
-using std::vfprintf;
-using std::vprintf;
-using std::vsprintf;
-
-using std::snprintf;
-using std::vfscanf;
-using std::vscanf;
-using std::vsnprintf;
-using std::vsscanf;
-
-bool testTypesStd()
-{
-    volatile std::size_t size;
-    volatile std::FILE file;
-    volatile std::fpos_t fpos_t;
-    return true;
-}
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testTypesStd);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cstdlib.cpp b/tests/bionic/libstdc++/test_cstdlib.cpp
deleted file mode 100644 (file)
index 0450d06..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cstdlib>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTDLIB__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-using ::exit;
-using ::abort;
-using ::atexit;
-using ::on_exit;
-
-using ::getenv;
-using ::putenv;
-using ::setenv;
-using ::unsetenv;
-using ::clearenv;
-
-using ::mktemp;
-using ::mkstemp;
-
-using ::strtol;
-using ::strtoll;
-using ::strtoul;
-using ::strtoull;
-using ::strtod;
-using ::strtof;
-
-using ::atoi;
-using ::atol;
-using ::atoll;
-using ::atof;
-
-using ::abs;
-using ::labs;
-using ::llabs;
-
-using ::realpath;
-using ::system;
-
-using ::bsearch;
-using ::qsort;
-
-using ::jrand48;
-using ::mrand48;
-using ::nrand48;
-using ::lrand48;
-using ::seed48;
-using ::srand48;
-
-using ::rand;
-using ::srand;
-using ::random;
-using ::srandom;
-
-using ::malloc;
-using ::free;
-using ::calloc;
-using ::realloc;
-
-using ::unlockpt;
-using ::ptsname;
-using ::ptsname_r;
-using ::getpt;
-using ::grantpt;
-
-using ::div_t;
-using ::div;
-using ::ldiv_t;
-using ::ldiv;
-using ::lldiv_t;
-using ::lldiv;
-
-using ::mblen;
-using ::mbstowcs;
-using ::mbtowc;
-using ::wctomb;
-using ::wcstombs;
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    //    FAIL_UNLESS(testTypesStd);
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_cstring.cpp b/tests/bionic/libstdc++/test_cstring.cpp
deleted file mode 100644 (file)
index f01b8a8..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <cstring>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CSTRING__
-#error "Wrong header file included!!"
-#endif
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-using std::memchr;
-using std::memcmp;
-using std::memcpy;
-using std::memmove;
-using std::memset;
-using std::strcat;
-using std::strchr;
-using std::strcmp;
-using std::strcoll;
-using std::strcpy;
-using std::strcspn;
-using std::strerror;
-using std::strlen;
-using std::strncat;
-using std::strncmp;
-using std::strncpy;
-using std::strpbrk;
-using std::strrchr;
-using std::strspn;
-using std::strstr;
-using std::strtok;
-using std::strxfrm;
-
-#ifndef NULL
-#error "NULL must be a macro"
-#endif
-
-volatile std::size_t size;
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    return kPassed;
-}
diff --git a/tests/bionic/libstdc++/test_ctime.cpp b/tests/bionic/libstdc++/test_ctime.cpp
deleted file mode 100644 (file)
index 9fae683..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-#include <ctime>
-#if defined BIONIC && !defined BIONIC_LIBSTDCPP_INCLUDE_CTIME__
-#error "Wrong header file included!!"
-#endif
-
-
-namespace {
-const int kPassed = 0;
-const int kFailed = 1;
-#define FAIL_UNLESS(f) if (!android::f()) return kFailed;
-}  // anonymous namespace
-
-namespace android
-{
-#ifndef CLOCKS_PER_SEC
-#error "CLOCKS_PER_SEC must be a macro"
-#endif
-
-#ifdef clock
-#error "should be a real function"
-#endif
-#ifdef difftime
-#error "should be a real function"
-#endif
-#ifdef mktime
-#error "should be a real function"
-#endif
-#ifdef time
-#error "should be a real function"
-#endif
-#ifdef asctime
-#error "should be a real function"
-#endif
-#ifdef ctime
-#error "should be a real function"
-#endif
-#ifdef gmtime
-#error "should be a real function"
-#endif
-#ifdef localtime
-#error "should be a real function"
-#endif
-#ifdef strftime
-#error "should be a real function"
-#endif
-
-using std::clock;
-using std::difftime;
-using std::mktime;
-using std::time;
-using std::asctime;
-using std::ctime;
-using std::gmtime;
-using std::localtime;
-using std::strftime;
-
-// Check various types are declared in the std namespace.
-// This is a compilation test.
-bool testTypesStd()
-{
-    volatile std::clock_t clock;
-    volatile std::time_t time;
-    volatile std::tm better_time;
-    return true;
-}
-
-bool testGetClock()
-{
-    volatile std::clock_t clock1 = std::clock();
-    volatile std::clock_t clock2 = std::clock();
-    if (clock2 < clock1) return false;
-    return true;
-}
-
-}  // namespace android
-
-int main(int argc, char **argv)
-{
-    FAIL_UNLESS(testTypesStd);
-    FAIL_UNLESS(testGetClock);
-    return kPassed;
-}
index 8e2d3f0..94476ce 100644 (file)
@@ -2,6 +2,7 @@
 ifeq ($(TARGET_ARCH),arm)
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 
 LOCAL_SRC_FILES:= \
                memtest.cpp.arm \
@@ -9,16 +10,10 @@ LOCAL_SRC_FILES:= \
                thumb.cpp \
                bandwidth.cpp \
 
-
-LOCAL_SHARED_LIBRARIES := libc libstlport
-
 LOCAL_MODULE:= memtest
-
 LOCAL_MODULE_TAGS := optional
-
-## LOCAL_CFLAGS += -fstack-protector-all
 LOCAL_CFLAGS += -fomit-frame-pointer
-LOCAL_C_INCLUDES += bionic external/stlport/stlport
 
+include external/stlport/libstlport.mk
 include $(BUILD_EXECUTABLE)
 endif
diff --git a/tests/pagingtest/Android.mk b/tests/pagingtest/Android.mk
new file mode 100644 (file)
index 0000000..727e3b8
--- /dev/null
@@ -0,0 +1,20 @@
+local_target_dir := $(TARGET_OUT_DATA)/local/tmp
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES:=    \
+    pagingtest.c    \
+    mmap_test.c      \
+    pageinout_test.c \
+    thrashing_test.c
+
+LOCAL_MODULE:= pagingtest
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_MODULE_PATH := $(local_target_dir)
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := pagingtest
+LOCAL_MODULE_STEM_64 := pagingtest64
+
+include $(BUILD_EXECUTABLE)
diff --git a/tests/pagingtest/mmap_test.c b/tests/pagingtest/mmap_test.c
new file mode 100644 (file)
index 0000000..07ba94b
--- /dev/null
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <string.h>
+#include "pagingtest.h"
+
+int mmap_test(int test_runs, unsigned long long alloc_size) {
+    void *buf;
+    int ret = -1;
+    int rc;
+    int i;
+    struct timeval begin_time, end_time, elapsed_time;
+    struct timeval total_time_mmap, total_time_munmap, total_time_in, total_time_out;
+
+    timerclear(&total_time_mmap);
+    timerclear(&total_time_munmap);
+    timerclear(&total_time_in);
+    timerclear(&total_time_out);
+
+    for (i = 0; i < test_runs; i++) {
+        gettimeofday(&begin_time, NULL);
+        buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+        gettimeofday(&end_time, NULL);
+        if (buf == ((void *)-1)) {
+            fprintf(stderr, "Failed to mmap anonymous memory: %s\n", strerror(errno));
+            goto err_map;
+        }
+        timersub(&end_time, &begin_time, &elapsed_time);
+        timeradd(&total_time_mmap, &elapsed_time, &total_time_mmap);
+
+        gettimeofday(&begin_time, NULL);
+        munmap(buf, alloc_size);
+        gettimeofday(&end_time, NULL);
+        timersub(&end_time, &begin_time, &elapsed_time);
+        timeradd(&total_time_mmap, &elapsed_time, &total_time_mmap);
+    }
+
+    printf("mmap: %llu us\n", total_time_mmap.tv_sec * USEC_PER_SEC + total_time_mmap.tv_usec);
+    printf("munmap: %llu us\n", total_time_munmap.tv_sec * USEC_PER_SEC + total_time_munmap.tv_usec);
+
+    ret = 0;
+    goto end;
+err:
+    munmap(buf, alloc_size);
+end:
+err_map:
+    return ret;
+}
diff --git a/tests/pagingtest/pageinout_test.c b/tests/pagingtest/pageinout_test.c
new file mode 100644 (file)
index 0000000..4c5a0e3
--- /dev/null
@@ -0,0 +1,90 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/mman.h>
+#include <fcntl.h>
+#include "pagingtest.h"
+
+int pageinout_test(int test_runs, unsigned long long file_size) {
+    int fd;
+    char tmpname[] = "pageinoutXXXXXX";
+    unsigned char *vec;
+    int i;
+    long long j;
+    volatile char *buf;
+    int ret = -1;
+    int rc;
+    struct timeval begin_time, end_time, elapsed_time, total_time_in, total_time_out;
+    long pagesize = sysconf(_SC_PAGE_SIZE);
+
+    timerclear(&total_time_in);
+    timerclear(&total_time_out);
+
+    fd = create_tmp_file(tmpname, file_size);
+    if (fd < 0) {
+        return -1;
+    }
+
+    vec = alloc_mincore_vec(file_size);
+    if (vec == NULL) {
+        goto err_alloc;
+    }
+
+    buf = mmap(NULL, file_size, PROT_READ, MAP_PRIVATE, fd, 0);
+    if (buf == ((void *)-1)) {
+        fprintf(stderr, "Failed to mmap file: %s\n", strerror(errno));
+        goto err_mmap;
+    }
+
+    if (!check_caching((void *)buf, vec, file_size, false)) {
+        goto err;
+    }
+
+    for (i = 0; i < test_runs; i++) {
+        gettimeofday(&begin_time, NULL);
+        //Read backwards to prevent mmap prefetching
+        for (j = ((file_size - 1) & ~(pagesize - 1)); j >= 0; j -= pagesize) {
+            buf[j];
+        }
+        gettimeofday(&end_time, NULL);
+
+        timersub(&end_time, &begin_time, &elapsed_time);
+        timeradd(&total_time_in, &elapsed_time, &total_time_in);
+
+        if (!check_caching((void *)buf, vec, file_size, true)) {
+            goto err;
+        }
+
+        gettimeofday(&begin_time, NULL);
+        rc = madvise((void *)buf, file_size, MADV_DONTNEED) ||
+               posix_fadvise(fd, 0, file_size, POSIX_FADV_DONTNEED);
+        gettimeofday(&end_time, NULL);
+        if (rc) {
+            fprintf(stderr, "posix_fadvise/madvise DONTNEED failed\n");
+            goto err;
+        }
+
+        timersub(&end_time, &begin_time, &elapsed_time);
+        timeradd(&total_time_out, &elapsed_time, &total_time_out);
+
+        if (!check_caching((void *)buf, vec, file_size, false)) {
+            goto err;
+        }
+    }
+
+    printf("page-in: %llu MB/s\n", (file_size * test_runs * USEC_PER_SEC) /
+             (1024 * 1024 * (total_time_in.tv_sec * USEC_PER_SEC + total_time_in.tv_usec)));
+    printf("page-out (clean): %llu MB/s\n", (file_size * test_runs * USEC_PER_SEC) /
+             (1024 * 1024 * (total_time_out.tv_sec * USEC_PER_SEC + total_time_out.tv_usec)));
+
+    ret = 0;
+
+err:
+    munmap((void *)buf, file_size);
+err_mmap:
+    free(vec);
+err_alloc:
+    close(fd);
+    return ret;
+}
diff --git a/tests/pagingtest/pagingtest.c b/tests/pagingtest/pagingtest.c
new file mode 100644 (file)
index 0000000..04ef0cc
--- /dev/null
@@ -0,0 +1,170 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include "pagingtest.h"
+
+#define TEST_RUNS 10
+#define ALLOC_SIZE (10 * 1024 * 1024)
+#define FILE_SIZE (10 * 1024 * 1024)
+
+int create_tmp_file(char *filename, off_t size) {
+    void *buf;
+    ssize_t rc;
+    int fd;
+    int urandom;
+
+    fd = mkstemp(filename);
+    if (fd < 0) {
+        fprintf(stderr, "unable to create temp file: %s\n", strerror(errno));
+        goto err_mkstemp;
+    }
+
+    urandom = open("/dev/urandom", O_RDONLY);
+    if (urandom < 0) {
+        fprintf(stderr, "unable to open urandom: %s\n", strerror(errno));
+        goto err_open;
+    }
+
+    if (unlink(filename)) {
+        fprintf(stderr, "unable to unlink temp file: %s\n", strerror(errno));
+        goto err_unlink;
+    }
+
+    if (ftruncate(fd, size)) {
+        fprintf(stderr, "unable to allocate temp file: %s\n", strerror(errno));
+        goto err_truncate;
+    }
+
+    buf = mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, 0);
+    if (buf == (void *)-1) {
+        fprintf(stderr, "unable to mmap temp file: %s\n", strerror(errno));
+        goto err_mmap;
+    }
+
+    rc = read(urandom, buf, size);
+
+    if (rc < 0) {
+        fprintf(stderr, "write random data failed: %s\n", strerror(errno));
+        goto err;
+    }
+
+    if (rc != size) {
+        fprintf(stderr, "write random data incomplete\n");
+        goto err;
+    }
+
+    if (madvise(buf, size, MADV_DONTNEED)) {
+        fprintf(stderr, "madvise DONTNEED failed: %s\n", strerror(errno));
+        goto err;
+    }
+
+    if (fsync(fd) < 0) {
+        fprintf(stderr, "fsync failed: %s\n", strerror(errno));
+        goto err;
+    }
+
+    rc = posix_fadvise(fd, 0, size, POSIX_FADV_DONTNEED);
+    if (rc) {
+        fprintf(stderr, "fadvise DONTNEED failed: %s\n", strerror(errno));
+        goto err;
+    }
+
+    munmap(buf, size);
+    close(urandom);
+    return fd;
+
+err:
+    munmap(buf, size);
+err_mmap:
+err_truncate:
+err_unlink:
+    close(urandom);
+err_open:
+    close(fd);
+err_mkstemp:
+    return -1;
+}
+
+unsigned char *alloc_mincore_vec(size_t size) {
+    unsigned char *vec;
+
+    vec = malloc(mincore_vec_len(size));
+    if (vec == NULL) {
+        fprintf(stderr, "malloc failed\n");
+    }
+
+    return vec;
+}
+
+bool check_caching(void *buf, unsigned char *vec, size_t size, bool is_cached) {
+    bool ret = true;
+    size_t i;
+
+    if (mincore(buf, size, vec)) {
+        fprintf(stderr, "mincore failed: %s\n", strerror(errno));
+        return false;
+    }
+
+    if (is_cached) {
+        for (i = 0; i < mincore_vec_len(size); i++) {
+            if (!(vec[i] & 0x1)) {
+                fprintf(stderr, "found an uncached page at page offset %zd\n", i);
+                ret = false;
+            }
+        }
+    } else {
+        for (i = 0; i < mincore_vec_len(size); i++) {
+            if (vec[i] & 0x1) {
+                fprintf(stderr, "found a cached page at page offset %zd\n", i);
+                ret = false;
+            }
+        }
+    }
+
+    return ret;
+}
+
+int main(int argc, char **argv) {
+    unsigned long long alloc_size = 0ULL;
+    unsigned long long file_size = 0ULL;
+    int test_runs = 0;
+    int rc;
+
+    //arguments: <program> [test_runs [alloc_size [file_size]]]
+    if (argc >= 2) {
+        test_runs = atoi(argv[1]);
+    }
+    if (test_runs <= 0) {
+        test_runs = TEST_RUNS;
+    }
+    if (argc >= 3) {
+        alloc_size = strtoull(argv[2], NULL, 10);
+    }
+    if (!alloc_size) {
+        alloc_size = ALLOC_SIZE;
+    }
+    if (argc >= 4) {
+        file_size = strtoull(argv[3], NULL, 10);
+    }
+    if (!file_size) {
+        file_size = FILE_SIZE;
+    }
+
+    rc = mmap_test(test_runs, alloc_size);
+    if (rc) {
+        return rc;
+    }
+    rc = pageinout_test(test_runs, file_size);
+    if (rc) {
+        return rc;
+    }
+    rc = thrashing_test(test_runs);
+
+    return rc;
+}
diff --git a/tests/pagingtest/pagingtest.h b/tests/pagingtest/pagingtest.h
new file mode 100644 (file)
index 0000000..2da9818
--- /dev/null
@@ -0,0 +1,20 @@
+#include <unistd.h>
+#include <stdbool.h>
+
+#ifndef __PAGINGTEST_H__
+#define __PAGINGTEST_H__
+#define USEC_PER_SEC 1000000ULL
+#define mincore_vec_len(size) (((size) + sysconf(_SC_PAGE_SIZE) - 1) / sysconf(_SC_PAGE_SIZE))
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
+
+//Helpers
+int create_tmp_file(char *filename, off_t size);
+unsigned char *alloc_mincore_vec(size_t size);
+bool check_caching(void *buf, unsigned char *vec, size_t size, bool is_cached);
+
+//Tests
+int mmap_test(int test_runs, unsigned long long alloc_size);
+int pageinout_test(int test_runs, unsigned long long file_size);
+int thrashing_test(int test_runs);
+
+#endif //__PAGINGTEST_H__
diff --git a/tests/pagingtest/thrashing_test.c b/tests/pagingtest/thrashing_test.c
new file mode 100644 (file)
index 0000000..c1ce162
--- /dev/null
@@ -0,0 +1,78 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "pagingtest.h"
+
+#define LINESIZE 32
+
+int thrashing_test(int test_runs) {
+    int fds[4] = {-1, -1, -1, -1};
+    char tmpnames[4][17] = { "thrashing1XXXXXX", "thrashing2XXXXXX", "thrashing3XXXXXX", "thrashing4XXXXXX" };
+    volatile char *bufs[4] = {0};
+    unsigned i, j;
+    long long k;
+    int ret = -1;
+    struct timeval begin_time, end_time, elapsed_time, total_time;
+    unsigned long long filesize;
+    long num_pages;
+    long pagesize;
+
+    timerclear(&total_time);
+
+    num_pages = sysconf(_SC_PHYS_PAGES);
+    pagesize = sysconf(_SC_PAGE_SIZE);
+    if (num_pages < 0) {
+        fprintf(stderr, "failed to get the number of pages\n");
+        return -1;
+    }
+
+    filesize = num_pages * pagesize / (ARRAY_SIZE(fds) - 1);
+
+    for (i = 0; i < ARRAY_SIZE(fds); i++) {
+        fds[i] = create_tmp_file(tmpnames[i], filesize);
+        if (fds[i] < 0) {
+            goto err_fd;
+        }
+    }
+
+    for (i = 0; i < ARRAY_SIZE(fds); i++) {
+        bufs[i] = mmap(NULL, filesize, PROT_READ, MAP_PRIVATE, fds[i], 0);
+        if (bufs[i] == ((void *)-1)) {
+            fprintf(stderr, "Failed to mmap file: %s\n", strerror(errno));
+            goto err;
+        }
+    }
+
+    for (i = 0; i < test_runs; i++) {
+        for (j = 0; j < ARRAY_SIZE(fds); j++) {
+            gettimeofday(&begin_time, NULL);
+            //Unfortunately when under memory pressure, fadvise and madvise stop working...
+            //Read backwards to prevent mmap prefetching
+            for (k = ((filesize - 1) & ~(pagesize - 1)); k >= 0; k -= pagesize) {
+                bufs[j][k];
+            }
+            gettimeofday(&end_time, NULL);
+
+            timersub(&end_time, &begin_time, &elapsed_time);
+            timeradd(&total_time, &elapsed_time, &total_time);
+        }
+    }
+
+    printf("thrashing: %llu MB/s\n", (filesize * ARRAY_SIZE(fds) * test_runs * USEC_PER_SEC) /
+             (1024 * 1024 * (total_time.tv_sec * USEC_PER_SEC + total_time.tv_usec)));
+
+    ret = 0;
+
+err:
+    for (i = 0; i < ARRAY_SIZE(bufs) && bufs[i] != NULL; i++) {
+        munmap((void *)bufs[i], filesize);
+    }
+err_fd:
+    for (i = 0; i < ARRAY_SIZE(fds) && fds[i] >= 0; i++) {
+        close(fds[i]);
+    }
+    return ret;
+}
index 801e44a..5dc2692 100644 (file)
  * through the use of the -t command-line option.
  */
 
+#define _GNU_SOURCE
+
 #include <assert.h>
 #include <errno.h>
 #include <libgen.h>
 #include <math.h>
-#define _GNU_SOURCE
 #include <sched.h>
 #include <stdio.h>
 #include <stdlib.h>