diff options
author | Elliott Hughes <enh@google.com> | 2014-10-29 12:32:23 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-29 12:32:23 +0000 |
commit | e9626c97e24fab1e20400abb65a4c1309bde1f5b (patch) | |
tree | 5f4dd763465faad3ed869f718b01e1c82628b0a7 | |
parent | d43f9fdc708726bef2df59f836f1ade962da43a7 (diff) | |
parent | 78b686d1e88e81f29c8cfc479115b356ca72f661 (diff) | |
download | extras-e9626c97e24fab1e20400abb65a4c1309bde1f5b.tar.gz |
am 78b686d1: Merge "bionic libc tests: clean up test for static_init"
* commit '78b686d1e88e81f29c8cfc479115b356ca72f661':
bionic libc tests: clean up test for static_init
-rw-r--r-- | tests/bionic/libc/Android.mk | 19 | ||||
-rw-r--r-- | tests/bionic/libc/bionic/lib_static_init.cpp | 18 | ||||
-rw-r--r-- | tests/bionic/libc/bionic/lib_static_init.h | 20 | ||||
-rw-r--r-- | tests/bionic/libc/bionic/test_static_init.cpp | 30 |
4 files changed, 0 insertions, 87 deletions
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk index 6f3343af..c29c237d 100644 --- a/tests/bionic/libc/Android.mk +++ b/tests/bionic/libc/Android.mk @@ -82,25 +82,6 @@ sources := \ $(call device-test, $(sources)) -# 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) - # TODO: Add a variety of GLibc test programs too... # Hello World to test libstdc++ support diff --git a/tests/bionic/libc/bionic/lib_static_init.cpp b/tests/bionic/libc/bionic/lib_static_init.cpp deleted file mode 100644 index d847110a..00000000 --- a/tests/bionic/libc/bionic/lib_static_init.cpp +++ /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 index 934eb8f4..00000000 --- a/tests/bionic/libc/bionic/lib_static_init.h +++ /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/test_static_init.cpp b/tests/bionic/libc/bionic/test_static_init.cpp deleted file mode 100644 index cbc4a59d..00000000 --- a/tests/bionic/libc/bionic/test_static_init.cpp +++ /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; -} |