summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-03-10 17:51:21 -0700
committerElliott Hughes <enh@google.com>2014-03-10 17:59:40 -0700
commit00bd9b6a527407b0f31ccb898189fa05ccec5788 (patch)
tree2b598542557b0c764663d6a4a31ba3246aaa651b
parentd22a6b47204f7866039049fba566fc8c75598ff0 (diff)
downloadextras-00bd9b6a527407b0f31ccb898189fa05ccec5788.tar.gz
Remove tests that are already better tested as part of CTS.
Change-Id: I06592a245c2229ca455156bab40eb1a815eef75b
-rw-r--r--tests/bionic/libc/Android.mk23
-rw-r--r--tests/bionic/libc/common/test_clone.c83
-rw-r--r--tests/bionic/libc/common/test_drand48.c114
-rw-r--r--tests/bionic/libc/common/test_libgen.c221
4 files changed, 0 insertions, 441 deletions
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk
index 9047f8b5..9e157c93 100644
--- a/tests/bionic/libc/Android.mk
+++ b/tests/bionic/libc/Android.mk
@@ -64,7 +64,6 @@ sources := \
common/bench_stdio.c \
common/test_clock.c \
common/test_cpu_set.c \
- common/test_drand48.c \
common/test_executable_destructor.c \
common/test_getaddrinfo.c \
common/test_gethostbyname.c \
@@ -128,13 +127,6 @@ EXTRA_LDLIBS := -ldl -Wl,--export-dynamic -Wl,-u,foo
$(call device-test, $(sources))
-sources := \
- common/test_libgen.c \
-
-EXTRA_CFLAGS := -DHOST
-$(call host-test, $(sources))
-$(call device-test, $(sources))
-
# Second, the Bionic-specific tests
sources := \
@@ -228,21 +220,6 @@ LOCAL_LDFLAGS := -ldl
LOCAL_MODULE_TAGS := tests
include $(BUILD_EXECUTABLE)
-# Testing 'clone' is only possible on Linux systems
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := common/test_clone.c
-LOCAL_MODULE := test_clone
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_EXECUTABLE)
-
-ifeq ($(HOST_OS),linux)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := common/test_clone.c
-LOCAL_MODULE := test_clone
-LOCAL_MODULE_TAGS := tests
-include $(BUILD_HOST_EXECUTABLE)
-endif
-
# TODO: Add a variety of GLibc test programs too...
# Hello World to test libstdc++ support
diff --git a/tests/bionic/libc/common/test_clone.c b/tests/bionic/libc/common/test_clone.c
deleted file mode 100644
index bb313e8f..00000000
--- a/tests/bionic/libc/common/test_clone.c
+++ /dev/null
@@ -1,83 +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.
- */
-/* Check that clone() is implemented and properly works
- */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <errno.h>
-#include <sched.h>
-#include <unistd.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/ptrace.h>
-#include <sys/wait.h>
-#include <stdarg.h>
-#include <string.h>
-
-static int
-clone_child (void *arg)
-{
- errno = 0;
- ptrace (PTRACE_TRACEME, 0, 0, 0);
- if (errno != 0)
- perror ("ptrace");
- if (kill (getpid (), SIGSTOP) < 0)
- perror ("kill");
- return 0;
-}
-
-#define PAGE_SIZE 4096
-#define STACK_SIZE (4 * PAGE_SIZE)
-
-char clone_stack[STACK_SIZE] __attribute__ ((aligned (PAGE_SIZE)));
-
-int
-main ()
-{
- int pid,child;
- int status;
-
- pid = clone (clone_child, clone_stack + 3 * PAGE_SIZE,
- CLONE_VM | SIGCHLD, NULL);
- if (pid < 0)
- {
- perror ("clone");
- exit (1);
- }
- printf ("child pid %d\n", pid);
-
- //sleep(20);
- child = waitpid (pid, &status, 0);
- printf("waitpid returned %d\n", child);
- if (child < 0) {
- perror ("waitpid");
- return 1;
- }
- printf ("child %d, status 0x%x\n", child, status);
- return 0;
-}
diff --git a/tests/bionic/libc/common/test_drand48.c b/tests/bionic/libc/common/test_drand48.c
deleted file mode 100644
index 56e9b2eb..00000000
--- a/tests/bionic/libc/common/test_drand48.c
+++ /dev/null
@@ -1,114 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-double drand48(void);
-
-static int fails = 0;
-
-static int
-double_eq(double a, double b)
-{
- /* Compare two double values, and return 1 if they are "close" enough */
- double diff = a -b;
- if (diff < 0) diff = -diff;
- if (a < 0) {
- if (b >= 0)
- return 0;
- a = -a;
- b = -b;
- } else if (b < 0) {
- return 0;
- }
- if (a >= b)
- a = b;
-
- return diff < a*1e-8;
-}
-
-#define EXPECT_LONG(value,expected) \
- do { \
- long _val = (value); \
- long _expected = (expected); \
- printf( "%s: ", #value); \
- if (_val != _expected) { \
- printf("KO: %ld (%ld expected)\n", _val, _expected); \
- fails += 1; \
- } else { \
- printf("%ld (ok)\n", _expected); \
- } \
- } while (0)
-
-#define EXPECT_DOUBLE(value,expected) \
- do { \
- double _val = (value); \
- double _expected = (expected); \
- printf( "%s: ", #value); \
- if (!double_eq(_val,_expected)) { \
- printf("KO: %.12g (%.12g expected)\n", _val, _expected); \
- fails += 1; \
- } else { \
- printf("%.12g (ok)\n", _expected); \
- } \
- } while (0)
-
-int
-main(void)
-{
- long int l = -345678L;
- float f = 123.456e14;
- double d = -87.65432e45;
-
- // Verify display of hard-coded float and double values.
- // This is done to confirm the correct printf format specifiers
- // are being used.
- puts("Hard-coded values");
- printf(" l: %li\n", l);
- printf(" f: %g\n", (double) f);
- printf(" d: %g\n", d);
-
- // lrand48
- puts("lrand48");
- puts(" srand48(100)");
- srand48(100);
- EXPECT_LONG(lrand48(),539144888);
- EXPECT_LONG(lrand48(),448713282);
- EXPECT_LONG(lrand48(),2020627300);
-
- // Try again, with same seed. Should get the same values
- puts(" srand48(100)");
- srand48(100);
- EXPECT_LONG(lrand48(),539144888);
- EXPECT_LONG(lrand48(),448713282);
- EXPECT_LONG(lrand48(),2020627300);
-
- // Try again, but with a different seed
- puts(" srand48(101)");
- srand48(101);
- EXPECT_LONG(lrand48(),261694958);
- EXPECT_LONG(lrand48(),1961809783);
- EXPECT_LONG(lrand48(),1458943423);
-
- // drand48
- puts("drand48");
- puts(" srand48(100)");
- srand48(100);
- EXPECT_DOUBLE(drand48(),0.251058902665);
- EXPECT_DOUBLE(drand48(),0.208948404851);
- EXPECT_DOUBLE(drand48(),0.940927909958);
-
- // Try again, with same seed. Should get the same values
- puts(" srand48(100)");
- srand48(100);
- EXPECT_DOUBLE(drand48(),0.251058902665);
- EXPECT_DOUBLE(drand48(),0.208948404851);
- EXPECT_DOUBLE(drand48(),0.940927909958);
-
- // Try again, but with a different seed
- puts(" srand48(101)");
- srand48(101);
- EXPECT_DOUBLE(drand48(),0.121861211331);
- EXPECT_DOUBLE(drand48(),0.913538869095);
- EXPECT_DOUBLE(drand48(),0.679373472502);
-
- return (fails > 0) ? 1 : 0;
-}
diff --git a/tests/bionic/libc/common/test_libgen.c b/tests/bionic/libc/common/test_libgen.c
deleted file mode 100644
index fd85816e..00000000
--- a/tests/bionic/libc/common/test_libgen.c
+++ /dev/null
@@ -1,221 +0,0 @@
-// test the basename, dirname, basename_r and dirname_r
-#include <libgen.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-static int fail = 0;
-
-static void
-test_basename(char* _input, const char* _expected, int _errno)
-{
- char temp[256], *input = _input;
- char* ret;
-#if HOST
- /* GLibc does modify the input string. bummer */
- if (_input) {
- strcpy(temp, _input);
- input = temp;
- }
-#endif
- errno = 0;
- ret = basename(input);
- if (_expected == NULL) {
- if (ret != NULL) {
- fprintf(stderr,
- "KO: basename(\"%s\") returned \"%s\", NULL expected)\n",
- _input, ret);
- fail += 1;
- } else if (errno != _errno) {
- fprintf(stderr,
- "KO: basename(\"%s\") returned NULL with error: %d (%d expected)\n",
- _input, errno, _errno);
- fail += 1;
- } else {
- printf( "OK: basename(\"%s\") returned NULL with error %d\n",
- _input, _errno );
- }
- } else {
- if (ret == NULL) {
- fprintf(stderr, "KO: basename(\"%s\") returned NULL with error %d\n",
- _input, errno);
- fail += 1;
- }
- else if (strcmp(ret, _expected)) {
- fprintf(stderr, "KO: basename(\"%s\") returned \"%s\", instead of \"%s\"\n",
- _input, ret, _expected);
- }
- else {
- printf( "OK: basename(\"%s\") returned \"%s\"\n",
- _input, ret );
- }
- }
-}
-
-
-#if !HOST
-static void
-test_basename_r(char* _input, const char* _expected_content, int _expected, char* _buff, size_t _bufflen, int _errno)
-{
- int ret;
- errno = 0;
- ret = basename_r(_input, _buff, _bufflen );
- if (ret != _expected) {
- fprintf(stderr,
- "KO: basename_r(\"%s\", <buff>, %d) returned %d (expected %d)\n",
- _input, _bufflen, ret, _expected);
- fail += 1;
- return;
- }
- if (ret == -1) {
- if (errno != _errno) {
- fprintf(stderr,
- "KO: basename_r(\"%s\", <buff>, %d) returned -1 with errno=%d (expected %d)\n",
- _input, _bufflen, errno, _errno);
- fail += 1;
- return;
- }
- }
- else if (_buff != NULL && memcmp( _buff, _expected_content, ret ) ) {
- fprintf(stderr,
- "KO: basename_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n",
- _input, _bufflen, _buff, _expected_content );
- fail += 1;
- return;
- }
- printf("OK: basename_r(\"%s\", <buff>, %d) returned \"%s\"\n",
- _input, _bufflen, _expected_content );
-}
-
-static void
-test_dirname_r(char* _input, const char* _expected_content, int _expected, char* _buff, size_t _bufflen, int _errno)
-{
- int ret;
- errno = 0;
- ret = dirname_r(_input, _buff, _bufflen );
- if (ret != _expected) {
- fprintf(stderr,
- "KO: dirname_r(\"%s\", <buff>, %d) returned %d (expected %d)\n",
- _input, _bufflen, ret, _expected);
- fail += 1;
- return;
- }
- if (ret == -1) {
- if (errno != _errno) {
- fprintf(stderr,
- "KO: dirname_r(\"%s\", <buff>, %d) returned -1 with errno=%d (expected %d)\n",
- _input, _bufflen, errno, _errno);
- fail += 1;
- return;
- }
- }
- else if (_buff != NULL && memcmp( _buff, _expected_content, ret ) ) {
- fprintf(stderr,
- "KO: dirname_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n",
- _input, _bufflen, _buff, _expected_content );
- fail += 1;
- return;
- }
- printf("OK: dirname_r(\"%s\", <buff>, %d) returned \"%s\"\n",
- _input, _bufflen, _expected_content );
-}
-#endif
-
-
-static void
-test_dirname(char* _input, const char* _expected, int _errno)
-{
- char temp[256], *input = _input;
- char* ret;
-#if HOST
- /* GLibc does modify the input string. bummer */
- if (_input) {
- strcpy(temp, _input);
- input = temp;
- }
-#endif
- errno = 0;
- ret = dirname(input);
- if (_expected == NULL) {
- if (ret != NULL) {
- fprintf(stderr,
- "KO: dirname(\"%s\") returned \"%s\", NULL expected)\n",
- _input, ret);
- fail += 1;
- } else if (errno != _errno) {
- fprintf(stderr,
- "KO: dirname(\"%s\") returned NULL with error: %d (%d expected)\n",
- _input, errno, _errno);
- fail += 1;
- } else {
- printf( "OK: dirname(\"%s\") returned NULL with error %d\n",
- _input, _errno );
- }
- } else {
- if (ret == NULL) {
- fprintf(stderr, "KO: dirname(\"%s\") returned NULL with error %d\n",
- _input, errno);
- fail += 1;
- }
- else if (strcmp(ret, _expected)) {
- fprintf(stderr, "KO: dirname(\"%s\") returned \"%s\", instead of \"%s\"\n",
- _input, ret, _expected);
- }
- else {
- printf( "OK: dirname(\"%s\") returned \"%s\"\n",
- _input, ret );
- }
- }
-}
-
-
-
-
-int main( void )
-{
- char buff[256];
-
- test_basename( "", ".", 0 );
- test_basename( "/usr/lib", "lib", 0 );
- test_basename( "/usr/", "usr", 0 );
- test_basename( "usr", "usr", 0 );
- test_basename( "/", "/", 0 );
- test_basename( ".", ".", 0 );
- test_basename( "..", "..", 0 );
-
-#if !HOST
- test_basename_r( "", ".", 1, NULL, 0, 0 );
- test_basename_r( "", ".", -1, buff, 0, ERANGE );
- test_basename_r( "", ".", -1, buff, 1, ERANGE );
- test_basename_r( "", ".", 1, buff, 2, 0 );
- test_basename_r( "", ".", 1, buff, sizeof(buff), 0 );
- test_basename_r( "/usr/lib", "lib", 3, buff, sizeof(buff), 0 );
- test_basename_r( "/usr/", "usr", 3, buff, sizeof(buff), 0 );
- test_basename_r( "usr", "usr", 3, buff, sizeof(buff), 0 );
- test_basename_r( "/", "/", 1, buff, sizeof(buff), 0 );
- test_basename_r( ".", ".", 1, buff, sizeof(buff), 0 );
- test_basename_r( "..", "..", 2, buff, sizeof(buff), 0 );
-#endif
-
- test_dirname( "", ".", 0 );
- test_dirname( "/usr/lib", "/usr", 0 );
- test_dirname( "/usr/", "/", 0 );
- test_dirname( "usr", ".", 0 );
- test_dirname( ".", ".", 0 );
- test_dirname( "..", ".", 0 );
-
-#if !HOST
- test_dirname_r( "", ".", 1, NULL, 0, 0 );
- test_dirname_r( "", ".", -1, buff, 0, ERANGE );
- test_dirname_r( "", ".", -1, buff, 1, ERANGE );
- test_dirname_r( "", ".", 1, buff, 2, 0 );
- test_dirname_r( "/usr/lib", "/usr", 4, buff, sizeof(buff), 0 );
- test_dirname_r( "/usr/", "/", 1, buff, sizeof(buff), 0 );
- test_dirname_r( "usr", ".", 1, buff, sizeof(buff), 0 );
- test_dirname_r( ".", ".", 1, buff, sizeof(buff), 0 );
- test_dirname_r( "..", ".", 1, buff, sizeof(buff), 0 );
-#endif
-
- return (fail > 0);
-}
-