Remove <time.h> tests.
I've turned the strftime and strptime tests into CTS tests, and it's
not obvious what the other test was usefully testing.
Change-Id: I9d0ba08c6f2e2170e902e4a2aa379dd7289bdf6c
diff --git a/tests/bionic/libc/Android.mk b/tests/bionic/libc/Android.mk
index 9e157c9..9d00681 100644
--- a/tests/bionic/libc/Android.mk
+++ b/tests/bionic/libc/Android.mk
@@ -78,9 +78,6 @@
common/test_sem_post.c \
common/test_seteuid.c \
common/test_static_cpp_mutex.cpp \
- common/test_strftime_2039.c \
- common/test_strptime.c \
- common/test_tm_zone.c \
common/test_udp.c \
# _XOPEN_SOURCE=600 is needed to get pthread_mutexattr_settype() on GLibc
diff --git a/tests/bionic/libc/common/test_strftime_2039.c b/tests/bionic/libc/common/test_strftime_2039.c
deleted file mode 100644
index 25ed540..0000000
--- a/tests/bionic/libc/common/test_strftime_2039.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* this tests tries to call strftime() with a date > 2038
- * to see if it works correctly.
- */
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main(void)
-{
- char buff[256];
- time_t now = time(NULL);
- struct tm tm = *localtime(&now);
-
- tm.tm_year = 2039 - 1900;
-
- /* "%s" is the number of seconds since the epoch */
- if (strftime(buff, sizeof buff, "%s", &tm) == 0) {
- fprintf(stderr, "strftime() returned 0\n");
- exit(EXIT_FAILURE);
- }
- printf("seconds since epoch: %s\n", buff);
-
- /* a 32-bit limited implementation will return a negative number */
- if (buff[0] == '-') {
- fprintf(stderr, "FAIL\n");
- exit(EXIT_FAILURE);
- }
-
- /* "%c" is the usual date string for the current locale */
- if (strftime(buff, sizeof buff, "%c", &tm) == 0) {
- fprintf(stderr, "strftime() returned 0\n");
- exit(EXIT_FAILURE);
- }
- printf("date string : %s\n", buff);
- return 0;
-}
diff --git a/tests/bionic/libc/common/test_strptime.c b/tests/bionic/libc/common/test_strptime.c
deleted file mode 100644
index 3cfc03b..0000000
--- a/tests/bionic/libc/common/test_strptime.c
+++ /dev/null
@@ -1,44 +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 strptime
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-int main(int argc, char **argv)
-{
- struct tm tm;
- char buf[255];
-
- // For now, only test a couple of formats that use recursion
-
- memset(&tm, 0, sizeof(tm));
- strptime("11:14", "%R", &tm);
- strftime(buf, sizeof(buf), "%H:%M", &tm);
- puts(buf);
- puts(!strcmp(buf, "11:14") ? "OK" : "FAILED");
-
- memset(&tm, 0, sizeof(tm));
- strptime("09:41:53", "%T", &tm);
- strftime(buf, sizeof(buf), "%H:%M:%S", &tm);
- puts(buf);
- puts(!strcmp(buf, "09:41:53") ? "OK" : "FAILED");
-
- return EXIT_SUCCESS;
-}
diff --git a/tests/bionic/libc/common/test_tm_zone.c b/tests/bionic/libc/common/test_tm_zone.c
deleted file mode 100644
index 63e0635..0000000
--- a/tests/bionic/libc/common/test_tm_zone.c
+++ /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.
- */
-/* a small program to test the tm_zone setting in Bionic */
-#include <time.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main( void )
-{
-#ifndef TM_ZONE
- fprintf(stderr, "TM_ZONE is not defined in <time.h> !!\n" );
- return 1;
-#else
- const char* tz = getenv("TZ");
- time_t now = time(NULL);
- struct tm tm0;
- struct tm* tm;
-
- if (tz) {
- printf( "TZ set to '%s'\n", tz );
- } else
- printf( "TZ is not defined\n" );
-
- tm = localtime_r( &now, &tm0 );
- printf( "localtime_r() returns timezone abbreviation '%s'\n", tm->TM_ZONE ? tm->TM_ZONE : "<NULL POINTER>" );
- printf( "tzname[0] is '%s'\n", tzname[0] ? tzname[0] : "<NULL POINTER>" );
- printf( "tzname[1] is '%s'\n", tzname[1] ? tzname[1] : "<NULL POINTER>" );
-#endif
- return 0;
-}