diff options
Diffstat (limited to 'src/regress/lib/libc')
22 files changed, 1089 insertions, 104 deletions
diff --git a/src/regress/lib/libc/Makefile b/src/regress/lib/libc/Makefile index 81d8779db0..7a8db225ef 100644 --- a/src/regress/lib/libc/Makefile +++ b/src/regress/lib/libc/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.60 2025/04/14 17:33:48 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.62 2025/08/04 06:10:40 tb Exp $ |
| 2 | 2 | ||
| 3 | SUBDIR+= _setjmp | 3 | SUBDIR+= _setjmp |
| 4 | SUBDIR+= alloca arc4random-fork atexit | 4 | SUBDIR+= alloca arc4random-fork atexit |
| @@ -11,7 +11,7 @@ SUBDIR+= ffs fmemopen fnmatch fpclassify fread | |||
| 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob | 11 | SUBDIR+= gcvt getaddrinfo getcap getopt getopt_long glob |
| 12 | SUBDIR+= hash | 12 | SUBDIR+= hash |
| 13 | SUBDIR+= hsearch | 13 | SUBDIR+= hsearch |
| 14 | SUBDIR+= ieeefp ifnameindex | 14 | SUBDIR+= ieeefp ifnameindex illumos |
| 15 | SUBDIR+= ldexp locale longjmp | 15 | SUBDIR+= ldexp locale longjmp |
| 16 | SUBDIR+= malloc mkstemp modf | 16 | SUBDIR+= malloc mkstemp modf |
| 17 | SUBDIR+= netdb | 17 | SUBDIR+= netdb |
| @@ -19,9 +19,9 @@ SUBDIR+= open_memstream orientation | |||
| 19 | SUBDIR+= popen printf | 19 | SUBDIR+= popen printf |
| 20 | SUBDIR+= qsort | 20 | SUBDIR+= qsort |
| 21 | SUBDIR+= regex | 21 | SUBDIR+= regex |
| 22 | SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio_threading | 22 | SUBDIR+= setjmp setjmp-signal sigsetjmp sigthr sleep sprintf stdio |
| 23 | SUBDIR+= stpncpy strchr strerror strlcat strlcpy strnlen strtod strtol strtonum | 23 | SUBDIR+= stdio_threading stpncpy strchr strerror strlcat strlcpy strnlen |
| 24 | SUBDIR+= sys | 24 | SUBDIR+= strtod strtol strtonum sys |
| 25 | SUBDIR+= telldir time timingsafe | 25 | SUBDIR+= telldir time timingsafe |
| 26 | SUBDIR+= uuid | 26 | SUBDIR+= uuid |
| 27 | SUBDIR+= vis | 27 | SUBDIR+= vis |
diff --git a/src/regress/lib/libc/elf_aux_info/elf_aux_info.c b/src/regress/lib/libc/elf_aux_info/elf_aux_info.c index 14870e253c..e78d282283 100644 --- a/src/regress/lib/libc/elf_aux_info/elf_aux_info.c +++ b/src/regress/lib/libc/elf_aux_info/elf_aux_info.c | |||
| @@ -9,6 +9,7 @@ main(void) | |||
| 9 | int ret = 0; | 9 | int ret = 0; |
| 10 | int a; | 10 | int a; |
| 11 | unsigned long b; | 11 | unsigned long b; |
| 12 | unsigned long long c; | ||
| 12 | 13 | ||
| 13 | /* Should always succeed */ | 14 | /* Should always succeed */ |
| 14 | if (elf_aux_info(AT_PAGESZ, &a, sizeof(a))) | 15 | if (elf_aux_info(AT_PAGESZ, &a, sizeof(a))) |
| @@ -17,7 +18,7 @@ main(void) | |||
| 17 | fprintf(stderr, "AT_PAGESZ %d\n", a); | 18 | fprintf(stderr, "AT_PAGESZ %d\n", a); |
| 18 | 19 | ||
| 19 | /* Wrong size */ | 20 | /* Wrong size */ |
| 20 | if (elf_aux_info(AT_PAGESZ, &b, sizeof(b)) != EINVAL) | 21 | if (elf_aux_info(AT_PAGESZ, &c, sizeof(c)) != EINVAL) |
| 21 | ret |= 2; | 22 | ret |= 2; |
| 22 | 23 | ||
| 23 | /* Invalid request */ | 24 | /* Invalid request */ |
diff --git a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c index 496bafb208..30c86290e8 100644 --- a/src/regress/lib/libc/explicit_bzero/explicit_bzero.c +++ b/src/regress/lib/libc/explicit_bzero/explicit_bzero.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: explicit_bzero.c,v 1.9 2022/02/10 08:39:32 tb Exp $ */ | 1 | /* $OpenBSD: explicit_bzero.c,v 1.10 2025/05/31 15:31:40 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Google Inc. | 3 | * Copyright (c) 2014 Google Inc. |
| 4 | * | 4 | * |
| @@ -28,9 +28,11 @@ | |||
| 28 | 28 | ||
| 29 | #if defined(__has_feature) | 29 | #if defined(__has_feature) |
| 30 | #if __has_feature(address_sanitizer) | 30 | #if __has_feature(address_sanitizer) |
| 31 | #ifndef __SANITIZE_ADDRESS__ | ||
| 31 | #define __SANITIZE_ADDRESS__ | 32 | #define __SANITIZE_ADDRESS__ |
| 32 | #endif | 33 | #endif |
| 33 | #endif | 34 | #endif |
| 35 | #endif | ||
| 34 | #ifdef __SANITIZE_ADDRESS__ | 36 | #ifdef __SANITIZE_ADDRESS__ |
| 35 | #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) | 37 | #define ATTRIBUTE_NO_SANITIZE_ADDRESS __attribute__((no_sanitize_address)) |
| 36 | #else | 38 | #else |
diff --git a/src/regress/lib/libc/hash/hash_test.c b/src/regress/lib/libc/hash/hash_test.c index f9dc641186..c04a0458fe 100644 --- a/src/regress/lib/libc/hash/hash_test.c +++ b/src/regress/lib/libc/hash/hash_test.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: hash_test.c,v 1.2 2025/04/14 18:33:56 tb Exp $ */ | 1 | /* $OpenBSD: hash_test.c,v 1.3 2025/08/02 06:05:13 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> | 4 | * Copyright (c) 2025 Theo Buehler <tb@openbsd.org> |
| @@ -757,7 +757,7 @@ struct hash_ctx { | |||
| 757 | void *ctx; | 757 | void *ctx; |
| 758 | void (*init)(void *); | 758 | void (*init)(void *); |
| 759 | void (*update)(void *, const uint8_t *, size_t); | 759 | void (*update)(void *, const uint8_t *, size_t); |
| 760 | void (*final)(void *, void *final); | 760 | void (*final)(void *, void *); |
| 761 | }; | 761 | }; |
| 762 | 762 | ||
| 763 | static const struct hash_tests { | 763 | static const struct hash_tests { |
| @@ -814,7 +814,7 @@ hash_test_case(struct hash_ctx *ctx, const struct hash_test_case *tc, | |||
| 814 | size_t in_len = tc->in != NULL ? strlen(tc->in) : 0; | 814 | size_t in_len = tc->in != NULL ? strlen(tc->in) : 0; |
| 815 | 815 | ||
| 816 | ctx->init(ctx->ctx); | 816 | ctx->init(ctx->ctx); |
| 817 | ctx->update(ctx->ctx, (uint8_t *)tc->in, in_len); | 817 | ctx->update(ctx->ctx, (const uint8_t *)tc->in, in_len); |
| 818 | ctx->final(ctx->digest, ctx->ctx); | 818 | ctx->final(ctx->digest, ctx->ctx); |
| 819 | 819 | ||
| 820 | if (memcmp(tc->out, ctx->digest, ctx->digest_len) != 0) { | 820 | if (memcmp(tc->out, ctx->digest, ctx->digest_len) != 0) { |
diff --git a/src/regress/lib/libc/illumos/Makefile b/src/regress/lib/libc/illumos/Makefile new file mode 100644 index 0000000000..cf2d22eb44 --- /dev/null +++ b/src/regress/lib/libc/illumos/Makefile | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $ | ||
| 2 | |||
| 3 | SUBDIR += oclo | ||
| 4 | |||
| 5 | install: | ||
| 6 | |||
| 7 | .include <bsd.subdir.mk> | ||
diff --git a/src/regress/lib/libc/illumos/Makefile.inc b/src/regress/lib/libc/illumos/Makefile.inc new file mode 100644 index 0000000000..4296b6e690 --- /dev/null +++ b/src/regress/lib/libc/illumos/Makefile.inc | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | # $OpenBSD: Makefile.inc,v 1.1.1.1 2025/08/02 06:16:34 tb Exp $ | ||
| 2 | |||
| 3 | ILLUMOS_OS_TESTDIR = /usr/local/share/illumos-os-tests | ||
| 4 | |||
| 5 | .if !exists(${ILLUMOS_OS_TESTDIR}) | ||
| 6 | regress: | ||
| 7 | @echo package illumos-os-tests is required for this regress | ||
| 8 | @echo SKIPPED | ||
| 9 | .endif | ||
diff --git a/src/regress/lib/libc/illumos/oclo/Makefile b/src/regress/lib/libc/illumos/oclo/Makefile new file mode 100644 index 0000000000..284e49dc73 --- /dev/null +++ b/src/regress/lib/libc/illumos/oclo/Makefile | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.2 2025/08/09 18:17:42 anton Exp $ | ||
| 2 | |||
| 3 | .if exists(/usr/local/share/illumos-os-tests) | ||
| 4 | |||
| 5 | PROGS = oclo | ||
| 6 | PROGS += oclo_errors | ||
| 7 | PROGS += ocloexec_verify | ||
| 8 | |||
| 9 | LDADD_ocloexec_verify = -lkvm | ||
| 10 | |||
| 11 | WARNINGS = yes | ||
| 12 | |||
| 13 | regress: ${PROGS} | ||
| 14 | |||
| 15 | .PATH: /usr/local/share/illumos-os-tests/tests/oclo | ||
| 16 | .endif | ||
| 17 | |||
| 18 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c index 486c247f0d..57d799f49d 100644 --- a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c +++ b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_errs.c,v 1.5 2024/04/14 17:47:41 otto Exp $ */ | 1 | /* $OpenBSD: malloc_errs.c,v 1.6 2025/05/24 06:40:29 otto Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> |
| 4 | * | 4 | * |
| @@ -286,11 +286,10 @@ int main(int argc, char *argv[]) | |||
| 286 | int i, status; | 286 | int i, status; |
| 287 | pid_t pid; | 287 | pid_t pid; |
| 288 | char num[10]; | 288 | char num[10]; |
| 289 | char options[10]; | 289 | char options[40]; |
| 290 | extern char* malloc_options; | 290 | char const *env[2]; |
| 291 | 291 | ||
| 292 | if (argc == 3) { | 292 | if (argc == 2) { |
| 293 | malloc_options = argv[2]; | ||
| 294 | /* prevent coredumps */ | 293 | /* prevent coredumps */ |
| 295 | setrlimit(RLIMIT_CORE, &lim); | 294 | setrlimit(RLIMIT_CORE, &lim); |
| 296 | i = atoi(argv[1]); | 295 | i = atoi(argv[1]); |
| @@ -303,9 +302,11 @@ int main(int argc, char *argv[]) | |||
| 303 | pid = fork(); | 302 | pid = fork(); |
| 304 | switch (pid) { | 303 | switch (pid) { |
| 305 | case 0: | 304 | case 0: |
| 306 | snprintf(options, sizeof(options), "us%s", tests[i].flags); | 305 | snprintf(options, sizeof(options), "MALLOC_OPTIONS=us%s", tests[i].flags); |
| 307 | snprintf(num, sizeof(num), "%d", i); | 306 | snprintf(num, sizeof(num), "%d", i); |
| 308 | execl(argv[0], argv[0], num, options, NULL); | 307 | env[0] = options; |
| 308 | env[1] = NULL; | ||
| 309 | execle(argv[0], argv[0], num, NULL, env); | ||
| 309 | err(1, "exec"); | 310 | err(1, "exec"); |
| 310 | break; | 311 | break; |
| 311 | case -1: | 312 | case -1: |
diff --git a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c b/src/regress/lib/libc/malloc/malloc_general/malloc_general.c index b243787bcf..b0387ce64e 100644 --- a/src/regress/lib/libc/malloc/malloc_general/malloc_general.c +++ b/src/regress/lib/libc/malloc/malloc_general/malloc_general.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_general.c,v 1.7 2022/01/09 07:18:50 otto Exp $ */ | 1 | /* $OpenBSD: malloc_general.c,v 1.8 2025/10/26 21:25:12 miod Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2017 Otto Moerbeek <otto@drijf.net> |
| 4 | * | 4 | * |
| @@ -24,6 +24,12 @@ | |||
| 24 | 24 | ||
| 25 | #define N 1000 | 25 | #define N 1000 |
| 26 | 26 | ||
| 27 | #if defined(_LP64) | ||
| 28 | #define COUNT 800000 | ||
| 29 | #else | ||
| 30 | #define COUNT 20000 | ||
| 31 | #endif | ||
| 32 | |||
| 27 | size_t | 33 | size_t |
| 28 | size(void) | 34 | size(void) |
| 29 | { | 35 | { |
| @@ -59,7 +65,7 @@ main(int argc, char *argv[]) | |||
| 59 | void * q; | 65 | void * q; |
| 60 | size_t sz; | 66 | size_t sz; |
| 61 | 67 | ||
| 62 | for (count = 0; count < 800000; count++) { | 68 | for (count = 0; count < COUNT; count++) { |
| 63 | if (count % 10000 == 0) { | 69 | if (count % 10000 == 0) { |
| 64 | printf("."); | 70 | printf("."); |
| 65 | fflush(stdout); | 71 | fflush(stdout); |
diff --git a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c index 799d2b9117..7e53c32dbc 100644 --- a/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c +++ b/src/regress/lib/libc/malloc/malloc_ulimit1/malloc_ulimit1.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_ulimit1.c,v 1.5 2019/06/12 11:31:36 bluhm Exp $ */ | 1 | /* $OpenBSD: malloc_ulimit1.c,v 1.6 2025/05/24 06:47:27 otto Exp $ */ |
| 2 | 2 | ||
| 3 | /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ | 3 | /* Public Domain, 2006, Otto Moerbeek <otto@drijf.net> */ |
| 4 | 4 | ||
| @@ -23,7 +23,7 @@ | |||
| 23 | #define FACTOR 1024 | 23 | #define FACTOR 1024 |
| 24 | 24 | ||
| 25 | /* This test takes forever with junking turned on. */ | 25 | /* This test takes forever with junking turned on. */ |
| 26 | char *malloc_options = "jj"; | 26 | const char * const malloc_options = "jj"; |
| 27 | 27 | ||
| 28 | int | 28 | int |
| 29 | main() | 29 | main() |
diff --git a/src/regress/lib/libc/stdio/Makefile b/src/regress/lib/libc/stdio/Makefile new file mode 100644 index 0000000000..f1e980f688 --- /dev/null +++ b/src/regress/lib/libc/stdio/Makefile | |||
| @@ -0,0 +1,29 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.4 2025/06/03 14:35:27 yasuoka Exp $ | ||
| 2 | |||
| 3 | PROGS= test_fflush | ||
| 4 | CLEANFILES= test_fflush.tmp | ||
| 5 | |||
| 6 | PROGS+= test_ungetwc | ||
| 7 | CLEANFILES+= test_ungetwc.tmp | ||
| 8 | |||
| 9 | PROGS+= test___freading | ||
| 10 | CLEANFILES+= test___freading.tmp | ||
| 11 | |||
| 12 | PROGS+= test___fwriting | ||
| 13 | CLEANFILES+= test___fwriting.tmp | ||
| 14 | |||
| 15 | PROGS+= test___fpending | ||
| 16 | CLEANFILES+= test___fpending.tmp | ||
| 17 | |||
| 18 | PROGS+= test___freadahead | ||
| 19 | CLEANFILES+= test___freadahead.tmp | ||
| 20 | |||
| 21 | PROGS+= test___freadptr | ||
| 22 | CLEANFILES+= test___freadptr.tmp | ||
| 23 | |||
| 24 | PROGS+= test___fseterr | ||
| 25 | CLEANFILES+= test___fseterr.tmp | ||
| 26 | |||
| 27 | WARNINGS= yes | ||
| 28 | |||
| 29 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/stdio/test___fpending.c b/src/regress/lib/libc/stdio/test___fpending.c new file mode 100644 index 0000000000..96ace2e481 --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fpending.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* $OpenBSD: test___fpending.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fpending.tmp" | ||
| 28 | |||
| 29 | void test___fpending0(void); | ||
| 30 | |||
| 31 | void | ||
| 32 | test___fpending0(void) | ||
| 33 | { | ||
| 34 | FILE *fp; | ||
| 35 | int r; | ||
| 36 | size_t s; | ||
| 37 | |||
| 38 | fp = fopen(TMPFILENAME, "w"); | ||
| 39 | assert(fp != NULL); | ||
| 40 | r = fputs("Hello world", fp); | ||
| 41 | assert(r >= 0); | ||
| 42 | s = __fpending(fp); | ||
| 43 | assert(s > 0); /* assume buffered */ | ||
| 44 | r = fflush(fp); | ||
| 45 | assert(r == 0); | ||
| 46 | s = __fpending(fp); | ||
| 47 | assert(s == 0); /* buffer must be 0 */ | ||
| 48 | r = fclose(fp); | ||
| 49 | assert(r == 0); | ||
| 50 | } | ||
| 51 | |||
| 52 | int | ||
| 53 | main(int argc, char *argv[]) | ||
| 54 | { | ||
| 55 | test___fpending0(); | ||
| 56 | |||
| 57 | exit(0); | ||
| 58 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freadahead.c b/src/regress/lib/libc/stdio/test___freadahead.c new file mode 100644 index 0000000000..66d5e3492a --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freadahead.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* $OpenBSD: test___freadahead.c,v 1.2 2025/06/03 14:35:27 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <errno.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdio_ext.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | |||
| 25 | /* we use assert() */ | ||
| 26 | #undef NDEBUG | ||
| 27 | |||
| 28 | #define TMPFILENAME "test___freadahead.tmp" | ||
| 29 | |||
| 30 | void test___freadahead0(void); | ||
| 31 | |||
| 32 | void | ||
| 33 | test___freadahead0(void) | ||
| 34 | { | ||
| 35 | FILE *fp; | ||
| 36 | int r; | ||
| 37 | size_t s; | ||
| 38 | |||
| 39 | fp = fopen(TMPFILENAME, "w"); | ||
| 40 | assert(fp != NULL); | ||
| 41 | r = fputs("Hello world", fp); | ||
| 42 | assert(r >= 0); | ||
| 43 | r = fclose(fp); | ||
| 44 | |||
| 45 | fp = fopen(TMPFILENAME, "r"); | ||
| 46 | s = __freadahead(fp); | ||
| 47 | assert(s == 0); | ||
| 48 | assert(fgetc(fp) == 'H'); | ||
| 49 | s = __freadahead(fp); | ||
| 50 | assert(s == 10); | ||
| 51 | r = fflush(fp); | ||
| 52 | #if 0 | ||
| 53 | /* fflush() to reading file is not supported (yet) */ | ||
| 54 | assert(errno == EBADF); | ||
| 55 | #else | ||
| 56 | assert(r == 0); | ||
| 57 | s = __freadahead(fp); | ||
| 58 | assert(s == 0); | ||
| 59 | #endif | ||
| 60 | |||
| 61 | r = fclose(fp); | ||
| 62 | assert(r == 0); | ||
| 63 | } | ||
| 64 | |||
| 65 | int | ||
| 66 | main(int argc, char *argv[]) | ||
| 67 | { | ||
| 68 | test___freadahead0(); | ||
| 69 | |||
| 70 | exit(0); | ||
| 71 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freading.c b/src/regress/lib/libc/stdio/test___freading.c new file mode 100644 index 0000000000..f74eb78d35 --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freading.c | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* $OpenBSD: test___freading.c,v 1.2 2025/06/12 07:39:26 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <unistd.h> | ||
| 25 | |||
| 26 | /* we use assert() */ | ||
| 27 | #undef NDEBUG | ||
| 28 | |||
| 29 | #define TMPFILENAME "test___freading.tmp" | ||
| 30 | |||
| 31 | void setup(void); | ||
| 32 | |||
| 33 | void test___freading0(void); | ||
| 34 | void test___freading1(void); | ||
| 35 | void test___freading2(void); | ||
| 36 | |||
| 37 | void | ||
| 38 | setup(void) | ||
| 39 | { | ||
| 40 | FILE *fp; | ||
| 41 | |||
| 42 | /* common setup */ | ||
| 43 | unlink(TMPFILENAME); | ||
| 44 | fp = fopen(TMPFILENAME, "w+"); | ||
| 45 | assert(fp != NULL); | ||
| 46 | fputs("Hello world\n", fp); | ||
| 47 | fclose(fp); | ||
| 48 | } | ||
| 49 | |||
| 50 | void | ||
| 51 | test___freading0(void) | ||
| 52 | { | ||
| 53 | FILE *fp; | ||
| 54 | int r; | ||
| 55 | char buf[80]; | ||
| 56 | |||
| 57 | fp = popen("echo Hello world", "r"); | ||
| 58 | assert(fp != NULL); | ||
| 59 | assert(__freading(fp) != 0); | ||
| 60 | assert(fgets(buf, sizeof(buf), fp) != NULL); | ||
| 61 | assert(strcmp(buf, "Hello world\n") == 0); | ||
| 62 | r = pclose(fp); | ||
| 63 | assert(r == 0); | ||
| 64 | } | ||
| 65 | |||
| 66 | void | ||
| 67 | test___freading1(void) | ||
| 68 | { | ||
| 69 | FILE *fp; | ||
| 70 | int r; | ||
| 71 | |||
| 72 | /* when the last operaiton is read, __freading() returns true */ | ||
| 73 | fp = fopen(TMPFILENAME, "w+"); | ||
| 74 | assert(fp != NULL); | ||
| 75 | assert(__freading(fp) == 0); | ||
| 76 | r = fputs("Hello world\n", fp); | ||
| 77 | assert(r >= 0); | ||
| 78 | assert(__freading(fp) == 0); | ||
| 79 | rewind(fp); | ||
| 80 | assert(fgetc(fp) == 'H'); | ||
| 81 | assert(__freading(fp) != 0); | ||
| 82 | /* write */ | ||
| 83 | fseek(fp, 0, SEEK_END); | ||
| 84 | r = fputs("\n", fp); | ||
| 85 | assert(__freading(fp) == 0); | ||
| 86 | /* ungetc */ | ||
| 87 | rewind(fp); | ||
| 88 | assert(ungetc('X', fp) != 0); | ||
| 89 | assert(__freading(fp) != 0); /* reading */ | ||
| 90 | |||
| 91 | r = fclose(fp); | ||
| 92 | assert(r == 0); | ||
| 93 | } | ||
| 94 | |||
| 95 | void | ||
| 96 | test___freading2(void) | ||
| 97 | { | ||
| 98 | int r; | ||
| 99 | FILE *fp; | ||
| 100 | |||
| 101 | /* | ||
| 102 | * until v1.10 of fpurge.c mistakenly enables the writing buffer | ||
| 103 | * without _SRD flag set. | ||
| 104 | */ | ||
| 105 | fp = fopen(TMPFILENAME, "r+"); | ||
| 106 | assert(fp != NULL); | ||
| 107 | assert(fgetc(fp) == 'H'); | ||
| 108 | fpurge(fp); | ||
| 109 | fseek(fp, 0, SEEK_CUR); | ||
| 110 | assert(fputc('X', fp) == 'X'); | ||
| 111 | assert(__freading(fp) == 0); | ||
| 112 | |||
| 113 | r = fclose(fp); | ||
| 114 | assert(r == 0); | ||
| 115 | } | ||
| 116 | |||
| 117 | int | ||
| 118 | main(int argc, char *argv[]) | ||
| 119 | { | ||
| 120 | test___freading0(); | ||
| 121 | test___freading1(); | ||
| 122 | test___freading2(); | ||
| 123 | |||
| 124 | exit(0); | ||
| 125 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___freadptr.c b/src/regress/lib/libc/stdio/test___freadptr.c new file mode 100644 index 0000000000..cce362f2ae --- /dev/null +++ b/src/regress/lib/libc/stdio/test___freadptr.c | |||
| @@ -0,0 +1,78 @@ | |||
| 1 | /* $OpenBSD: test___freadptr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <sys/types.h> | ||
| 20 | #include <assert.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdio_ext.h> | ||
| 23 | #include <stdlib.h> | ||
| 24 | #include <string.h> | ||
| 25 | |||
| 26 | /* we use assert() */ | ||
| 27 | #undef NDEBUG | ||
| 28 | |||
| 29 | #define TMPFILENAME "test___freadptr.tmp" | ||
| 30 | |||
| 31 | void test___freadptr0(void); | ||
| 32 | |||
| 33 | /* test __freadptr() and __freadptrinc() */ | ||
| 34 | void | ||
| 35 | test___freadptr0(void) | ||
| 36 | { | ||
| 37 | FILE *fp; | ||
| 38 | int r; | ||
| 39 | ssize_t s; | ||
| 40 | const char *p; | ||
| 41 | |||
| 42 | fp = fopen(TMPFILENAME, "w"); | ||
| 43 | assert(fp != NULL); | ||
| 44 | r = fputs("Hello world", fp); | ||
| 45 | assert(r >= 0); | ||
| 46 | r = fclose(fp); | ||
| 47 | |||
| 48 | fp = fopen(TMPFILENAME, "r"); | ||
| 49 | assert(fgetc(fp) == 'H'); | ||
| 50 | p = __freadptr(fp, &s); | ||
| 51 | assert(p != NULL); | ||
| 52 | assert(s > 4); /* this test assume this (not by the spec) */ | ||
| 53 | assert(*p == 'e'); | ||
| 54 | assert(strncmp(p, "ello world", s) == 0); | ||
| 55 | |||
| 56 | __freadptrinc(fp, 4); | ||
| 57 | assert(fgetc(fp) == ' '); | ||
| 58 | |||
| 59 | ungetc('A', fp); | ||
| 60 | ungetc('A', fp); | ||
| 61 | ungetc('A', fp); | ||
| 62 | p = __freadptr(fp, &s); | ||
| 63 | assert(s > 0); | ||
| 64 | assert(*p == 'A'); | ||
| 65 | /* ptr will contains only the pushback buffer */ | ||
| 66 | assert(strncmp(p, "AAAworld", s) == 0); | ||
| 67 | |||
| 68 | r = fclose(fp); | ||
| 69 | assert(r == 0); | ||
| 70 | } | ||
| 71 | |||
| 72 | int | ||
| 73 | main(int argc, char *argv[]) | ||
| 74 | { | ||
| 75 | test___freadptr0(); | ||
| 76 | |||
| 77 | exit(0); | ||
| 78 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___fseterr.c b/src/regress/lib/libc/stdio/test___fseterr.c new file mode 100644 index 0000000000..70fb491c6c --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fseterr.c | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | /* $OpenBSD: test___fseterr.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fseterr.tmp" | ||
| 28 | |||
| 29 | void test___fseterr0(void); | ||
| 30 | |||
| 31 | void | ||
| 32 | test___fseterr0(void) | ||
| 33 | { | ||
| 34 | FILE *fp; | ||
| 35 | int r; | ||
| 36 | |||
| 37 | fp = fopen(TMPFILENAME, "w+"); | ||
| 38 | assert(fp != NULL); | ||
| 39 | |||
| 40 | assert(!ferror(fp)); | ||
| 41 | |||
| 42 | r = fprintf(fp, "hello world\n"); | ||
| 43 | assert(r > 0); | ||
| 44 | |||
| 45 | __fseterr(fp); | ||
| 46 | assert(ferror(fp)); | ||
| 47 | |||
| 48 | r = fprintf(fp, "hello world\n"); | ||
| 49 | assert(r == -1); | ||
| 50 | |||
| 51 | fclose(fp); | ||
| 52 | } | ||
| 53 | |||
| 54 | int | ||
| 55 | main(int argc, char *argv[]) | ||
| 56 | { | ||
| 57 | test___fseterr0(); | ||
| 58 | |||
| 59 | exit(0); | ||
| 60 | } | ||
diff --git a/src/regress/lib/libc/stdio/test___fwriting.c b/src/regress/lib/libc/stdio/test___fwriting.c new file mode 100644 index 0000000000..eb4671d3cf --- /dev/null +++ b/src/regress/lib/libc/stdio/test___fwriting.c | |||
| @@ -0,0 +1,83 @@ | |||
| 1 | /* $OpenBSD: test___fwriting.c,v 1.1 2025/05/25 00:20:54 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdio_ext.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* we use assert() */ | ||
| 25 | #undef NDEBUG | ||
| 26 | |||
| 27 | #define TMPFILENAME "test___fwriting.tmp" | ||
| 28 | |||
| 29 | void test___fwriting0(void); | ||
| 30 | void test___fwriting1(void); | ||
| 31 | |||
| 32 | void | ||
| 33 | test___fwriting0(void) | ||
| 34 | { | ||
| 35 | FILE *fp; | ||
| 36 | int r; | ||
| 37 | |||
| 38 | fp = fopen(TMPFILENAME, "w"); /* write only */ | ||
| 39 | assert(fp != NULL); | ||
| 40 | assert(__fwriting(fp) != 0); /* writing is true immediately */ | ||
| 41 | r = fputs("Hello world\n", fp); | ||
| 42 | assert(r >= 0); | ||
| 43 | r = fclose(fp); | ||
| 44 | assert(r == 0); | ||
| 45 | |||
| 46 | fp = fopen(TMPFILENAME, "a"); /* append only */ | ||
| 47 | assert(fp != NULL); | ||
| 48 | assert(__fwriting(fp) != 0); /* writing immediately */ | ||
| 49 | r = fclose(fp); | ||
| 50 | assert(r == 0); | ||
| 51 | } | ||
| 52 | |||
| 53 | void | ||
| 54 | test___fwriting1(void) | ||
| 55 | { | ||
| 56 | FILE *fp; | ||
| 57 | int r; | ||
| 58 | |||
| 59 | fp = fopen(TMPFILENAME, "w+"); /* read / write */ | ||
| 60 | assert(fp != NULL); | ||
| 61 | r = fputs("Hello world\n", fp); | ||
| 62 | assert(r >= 0); | ||
| 63 | assert(__fwriting(fp) != 0); | ||
| 64 | rewind(fp); | ||
| 65 | assert(fgetc(fp) == 'H'); /* read */ | ||
| 66 | assert(__fwriting(fp) == 0); /* writing becomes false */ | ||
| 67 | fputc('e', fp); | ||
| 68 | assert(__fwriting(fp) != 0); /* writing becomes true */ | ||
| 69 | ungetc('e', fp); | ||
| 70 | assert(__fwriting(fp) == 0); /* ungetc -> writing becomes false */ | ||
| 71 | |||
| 72 | r = fclose(fp); | ||
| 73 | assert(r == 0); | ||
| 74 | } | ||
| 75 | |||
| 76 | int | ||
| 77 | main(int argc, char *argv[]) | ||
| 78 | { | ||
| 79 | test___fwriting0(); | ||
| 80 | test___fwriting1(); | ||
| 81 | |||
| 82 | exit(0); | ||
| 83 | } | ||
diff --git a/src/regress/lib/libc/stdio/test_fflush.c b/src/regress/lib/libc/stdio/test_fflush.c new file mode 100644 index 0000000000..a0586b7d14 --- /dev/null +++ b/src/regress/lib/libc/stdio/test_fflush.c | |||
| @@ -0,0 +1,345 @@ | |||
| 1 | /* $OpenBSD: test_fflush.c,v 1.3 2025/06/08 08:53:53 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <locale.h> | ||
| 21 | #include <stdio.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <unistd.h> | ||
| 25 | #include <wchar.h> | ||
| 26 | |||
| 27 | /* we use assert() */ | ||
| 28 | #undef NDEBUG | ||
| 29 | |||
| 30 | #define TMPFILENAME "test_fflush.tmp" | ||
| 31 | |||
| 32 | void setup(void); | ||
| 33 | |||
| 34 | void test_fflush_read0(void); | ||
| 35 | void test_fflush_read1(void); | ||
| 36 | void test_fflush_read2(void); | ||
| 37 | void test_fflush_read3(void); | ||
| 38 | void test_fflush_read4(void); | ||
| 39 | void setupw(void); | ||
| 40 | void test_fflush_read5(void); | ||
| 41 | void test_fflush_read6(void); | ||
| 42 | |||
| 43 | void | ||
| 44 | setup(void) | ||
| 45 | { | ||
| 46 | FILE *fp; | ||
| 47 | |||
| 48 | /* common setup */ | ||
| 49 | unlink(TMPFILENAME); | ||
| 50 | fp = fopen(TMPFILENAME, "w+"); | ||
| 51 | assert(fp != NULL); | ||
| 52 | fputs("Hello world\n", fp); | ||
| 53 | fclose(fp); | ||
| 54 | } | ||
| 55 | |||
| 56 | /* fflush work with reading file and seekable */ | ||
| 57 | void | ||
| 58 | test_fflush_read0(void) | ||
| 59 | { | ||
| 60 | int r; | ||
| 61 | char buf[80]; | ||
| 62 | FILE *fp; | ||
| 63 | |||
| 64 | setup(); | ||
| 65 | |||
| 66 | /* In POSIX 2008, fflush() must work with the file object for reading */ | ||
| 67 | fp = fopen(TMPFILENAME, "r"); | ||
| 68 | assert(fp != NULL); | ||
| 69 | assert(fgetc(fp) == 'H'); | ||
| 70 | r = fflush(fp); | ||
| 71 | assert(r == 0); | ||
| 72 | |||
| 73 | /* the position is moved to 1 */ | ||
| 74 | assert(ftell(fp) == 1); | ||
| 75 | |||
| 76 | /* can read rest of that */ | ||
| 77 | fgets(buf, sizeof(buf), fp); | ||
| 78 | assert(strcmp(buf, "ello world\n") == 0); | ||
| 79 | r = fclose(fp); | ||
| 80 | assert(r == 0); | ||
| 81 | } | ||
| 82 | |||
| 83 | /* fflush work with reading file and seekable + unget */ | ||
| 84 | void | ||
| 85 | test_fflush_read1(void) | ||
| 86 | { | ||
| 87 | int r; | ||
| 88 | char buf[80]; | ||
| 89 | FILE *fp; | ||
| 90 | |||
| 91 | setup(); | ||
| 92 | |||
| 93 | fp = fopen(TMPFILENAME, "r"); | ||
| 94 | assert(fp != NULL); | ||
| 95 | assert(fgetc(fp) == 'H'); | ||
| 96 | assert(fgetc(fp) == 'e'); | ||
| 97 | assert(fgetc(fp) == 'l'); | ||
| 98 | assert(fgetc(fp) == 'l'); | ||
| 99 | assert(fgetc(fp) == 'o'); | ||
| 100 | |||
| 101 | /* push the 'AAAA' back */ | ||
| 102 | ungetc('A', fp); | ||
| 103 | ungetc('A', fp); | ||
| 104 | ungetc('A', fp); | ||
| 105 | ungetc('A', fp); | ||
| 106 | |||
| 107 | /* can read rest of that */ | ||
| 108 | fgets(buf, sizeof(buf), fp); | ||
| 109 | assert(strcmp(buf, "AAAA world\n") == 0); | ||
| 110 | r = fclose(fp); | ||
| 111 | assert(r == 0); | ||
| 112 | |||
| 113 | /* do the same thing + fflush */ | ||
| 114 | |||
| 115 | fp = fopen(TMPFILENAME, "r"); | ||
| 116 | assert(fp != NULL); | ||
| 117 | assert(fgetc(fp) == 'H'); | ||
| 118 | assert(fgetc(fp) == 'e'); | ||
| 119 | assert(fgetc(fp) == 'l'); | ||
| 120 | assert(fgetc(fp) == 'l'); | ||
| 121 | assert(fgetc(fp) == 'o'); | ||
| 122 | |||
| 123 | /* push 'AAAA' back */ | ||
| 124 | ungetc('A', fp); | ||
| 125 | ungetc('A', fp); | ||
| 126 | ungetc('A', fp); | ||
| 127 | ungetc('A', fp); | ||
| 128 | |||
| 129 | /* then fflush */ | ||
| 130 | r = fflush(fp); | ||
| 131 | assert(r == 0); | ||
| 132 | |||
| 133 | /* fllush() clears the all pushed back chars */ | ||
| 134 | |||
| 135 | /* can read rest of that */ | ||
| 136 | fgets(buf, sizeof(buf), fp); | ||
| 137 | assert(strcmp(buf, " world\n") == 0); | ||
| 138 | r = fclose(fp); | ||
| 139 | assert(r == 0); | ||
| 140 | } | ||
| 141 | |||
| 142 | /* fflush() to reading and non-seekable stream */ | ||
| 143 | void | ||
| 144 | test_fflush_read2(void) | ||
| 145 | { | ||
| 146 | int r; | ||
| 147 | FILE *fp; | ||
| 148 | char buf[80]; | ||
| 149 | |||
| 150 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 151 | fp = popen("echo Hello world", "r"); | ||
| 152 | assert(fp != NULL); | ||
| 153 | assert(fgetc(fp) == 'H'); | ||
| 154 | r = fflush(fp); | ||
| 155 | assert(r == 0); | ||
| 156 | |||
| 157 | /* | ||
| 158 | * FILE object for read and NOT seekable. In that case, fflush does | ||
| 159 | * nothing, but must keep the buffer. | ||
| 160 | */ | ||
| 161 | |||
| 162 | /* can read rest of that */ | ||
| 163 | fgets(buf, sizeof(buf), fp); | ||
| 164 | assert(strcmp(buf, "ello world\n") == 0); | ||
| 165 | r = pclose(fp); | ||
| 166 | assert(r == 0); | ||
| 167 | } | ||
| 168 | |||
| 169 | /* fflush() to the file which doesn't have any buffer */ | ||
| 170 | void | ||
| 171 | test_fflush_read3(void) | ||
| 172 | { | ||
| 173 | int r; | ||
| 174 | FILE *fp; | ||
| 175 | |||
| 176 | setup(); | ||
| 177 | |||
| 178 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 179 | fp = fopen(TMPFILENAME, "r"); | ||
| 180 | assert(fp != NULL); | ||
| 181 | r = fflush(fp); | ||
| 182 | assert(r == 0); | ||
| 183 | r = fclose(fp); | ||
| 184 | assert(r == 0); | ||
| 185 | } | ||
| 186 | |||
| 187 | /* freopen() should call fflush() internal */ | ||
| 188 | void | ||
| 189 | test_fflush_read4(void) | ||
| 190 | { | ||
| 191 | int r; | ||
| 192 | FILE *fp; | ||
| 193 | off_t pos; | ||
| 194 | char buf[80]; | ||
| 195 | |||
| 196 | setup(); | ||
| 197 | |||
| 198 | /* In POSIX-2008, fflush() must work with the file object for reading */ | ||
| 199 | fp = fopen(TMPFILENAME, "r"); | ||
| 200 | assert(fp != NULL); | ||
| 201 | |||
| 202 | assert(fgetc(fp) == 'H'); /* read 1 */ | ||
| 203 | |||
| 204 | pos = lseek(fileno(fp), 0, SEEK_CUR); | ||
| 205 | assert(pos >= 1); | ||
| 206 | assert(pos > 1); /* this test assume the buffer is used */ | ||
| 207 | |||
| 208 | /* freopen() should call fflush() internal */ | ||
| 209 | fp = freopen(TMPFILENAME, "r", fp); | ||
| 210 | assert(fp != NULL); | ||
| 211 | |||
| 212 | /* can read rest of that on fp */ | ||
| 213 | fgets(buf, sizeof(buf), fp); | ||
| 214 | assert(strcmp(buf, "Hello world\n") == 0); | ||
| 215 | |||
| 216 | r = fclose(fp); | ||
| 217 | assert(r == 0); | ||
| 218 | } | ||
| 219 | |||
| 220 | void | ||
| 221 | setupw(void) | ||
| 222 | { | ||
| 223 | FILE *fp; | ||
| 224 | |||
| 225 | /* common setup */ | ||
| 226 | unlink(TMPFILENAME); | ||
| 227 | fp = fopen(TMPFILENAME, "w+"); | ||
| 228 | assert(fp != NULL); | ||
| 229 | /* Konnitiwa Sekai(in Kanji) */ | ||
| 230 | fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp); | ||
| 231 | fclose(fp); | ||
| 232 | } | ||
| 233 | |||
| 234 | /* fflush work with reading file and seekable + ungetwc */ | ||
| 235 | void | ||
| 236 | test_fflush_read5(void) | ||
| 237 | { | ||
| 238 | int r; | ||
| 239 | wchar_t buf[80]; | ||
| 240 | FILE *fp; | ||
| 241 | |||
| 242 | setupw(); | ||
| 243 | |||
| 244 | fp = fopen(TMPFILENAME, "r"); | ||
| 245 | |||
| 246 | assert(fp != NULL); | ||
| 247 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 248 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 249 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 250 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 251 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 252 | |||
| 253 | /* push 263A(smile) back */ | ||
| 254 | assert(ungetwc(L'\u263a', fp)); | ||
| 255 | |||
| 256 | /* we support 1 push back wchar_t */ | ||
| 257 | assert(fgetwc(fp) == L'\u263a'); | ||
| 258 | |||
| 259 | /* can read reset of that */ | ||
| 260 | fgetws(buf, sizeof(buf), fp); | ||
| 261 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 262 | |||
| 263 | r = fclose(fp); | ||
| 264 | assert(r == 0); | ||
| 265 | |||
| 266 | /* do the same thing + fflush */ | ||
| 267 | fp = fopen(TMPFILENAME, "r"); | ||
| 268 | |||
| 269 | assert(fp != NULL); | ||
| 270 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 271 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 272 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 273 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 274 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 275 | |||
| 276 | /* push 263A(smile) back */ | ||
| 277 | assert(ungetwc(L'\u263a', fp)); | ||
| 278 | |||
| 279 | /* we support 1 push back wchar_t */ | ||
| 280 | assert(fgetwc(fp) == L'\u263a'); | ||
| 281 | |||
| 282 | /* then fflush */ | ||
| 283 | r = fflush(fp); | ||
| 284 | assert(r == 0); | ||
| 285 | |||
| 286 | /* fllush() clears the all pushed back chars */ | ||
| 287 | |||
| 288 | /* can read rest of that */ | ||
| 289 | fgetws(buf, sizeof(buf), fp); | ||
| 290 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 291 | r = fclose(fp); | ||
| 292 | assert(r == 0); | ||
| 293 | } | ||
| 294 | |||
| 295 | void | ||
| 296 | test_fflush_read6(void) | ||
| 297 | { | ||
| 298 | int r, c; | ||
| 299 | FILE *fp; | ||
| 300 | |||
| 301 | setup(); | ||
| 302 | fp = fopen(TMPFILENAME, "r"); | ||
| 303 | assert(fp != NULL); | ||
| 304 | |||
| 305 | /* | ||
| 306 | * https://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html | ||
| 307 | * .. any characters pushed back onto the stream by ungetc() or ungetwc() | ||
| 308 | * that have not subsequently been read from the stream shall be discarded | ||
| 309 | * (without further changing the file offset). | ||
| 310 | */ | ||
| 311 | |||
| 312 | assert(fgetc(fp) == 'H'); | ||
| 313 | c = getc(fp); | ||
| 314 | ungetc(c, fp); /* push back the character has been read */ | ||
| 315 | r = fflush(fp); | ||
| 316 | assert(r == 0); | ||
| 317 | assert(getc(fp) == c); | ||
| 318 | |||
| 319 | fseek(fp, 0, SEEK_SET); | ||
| 320 | assert(fgetc(fp) == 'H'); | ||
| 321 | c = getc(fp); | ||
| 322 | ungetc('X', fp); /* push back the character has not been read */ | ||
| 323 | r = fflush(fp); | ||
| 324 | assert(r == 0); | ||
| 325 | assert(getc(fp) == 'l'); | ||
| 326 | |||
| 327 | r = fclose(fp); | ||
| 328 | assert(r == 0); | ||
| 329 | } | ||
| 330 | |||
| 331 | int | ||
| 332 | main(int argc, char *argv[]) | ||
| 333 | { | ||
| 334 | setlocale(LC_ALL, "C.UTF-8"); | ||
| 335 | |||
| 336 | test_fflush_read0(); | ||
| 337 | test_fflush_read1(); | ||
| 338 | test_fflush_read2(); | ||
| 339 | test_fflush_read3(); | ||
| 340 | test_fflush_read4(); | ||
| 341 | test_fflush_read5(); | ||
| 342 | test_fflush_read6(); | ||
| 343 | |||
| 344 | exit(0); | ||
| 345 | } | ||
diff --git a/src/regress/lib/libc/stdio/test_ungetwc.c b/src/regress/lib/libc/stdio/test_ungetwc.c new file mode 100644 index 0000000000..bb4e853020 --- /dev/null +++ b/src/regress/lib/libc/stdio/test_ungetwc.c | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | /* $OpenBSD: test_ungetwc.c,v 1.1 2025/05/25 05:32:45 yasuoka Exp $ */ | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Copyright (c) 2025 YASUOKA Masahiko <yasuoka@yasuoka.net> | ||
| 5 | * | ||
| 6 | * Permission to use, copy, modify, and distribute this software for any | ||
| 7 | * purpose with or without fee is hereby granted, provided that the above | ||
| 8 | * copyright notice and this permission notice appear in all copies. | ||
| 9 | * | ||
| 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <assert.h> | ||
| 20 | #include <stdio.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | #include <locale.h> | ||
| 25 | #include <wchar.h> | ||
| 26 | |||
| 27 | /* we use assert() */ | ||
| 28 | #undef NDEBUG | ||
| 29 | |||
| 30 | #define TMPFILENAME "test_ungetwc.tmp" | ||
| 31 | |||
| 32 | void setupw(void); | ||
| 33 | void test_fflush_ungetwc0(void); | ||
| 34 | |||
| 35 | void | ||
| 36 | setupw(void) | ||
| 37 | { | ||
| 38 | FILE *fp; | ||
| 39 | |||
| 40 | /* common setup */ | ||
| 41 | unlink(TMPFILENAME); | ||
| 42 | fp = fopen(TMPFILENAME, "w+"); | ||
| 43 | assert(fp != NULL); | ||
| 44 | /* Konnitiwa Sekai(in Kanji) */ | ||
| 45 | fputws(L"\u3053\u3093\u306b\u3061\u308f \u4e16\u754c\n", fp); | ||
| 46 | fclose(fp); | ||
| 47 | } | ||
| 48 | |||
| 49 | /* fflush work with reading file and seekable + ungetwc */ | ||
| 50 | void | ||
| 51 | test_fflush_ungetwc0(void) | ||
| 52 | { | ||
| 53 | int r; | ||
| 54 | wchar_t buf[80]; | ||
| 55 | FILE *fp; | ||
| 56 | |||
| 57 | setupw(); | ||
| 58 | |||
| 59 | fp = fopen(TMPFILENAME, "r"); | ||
| 60 | |||
| 61 | assert(fp != NULL); | ||
| 62 | assert(fgetwc(fp) == L'\u3053'); /* Ko */ | ||
| 63 | assert(fgetwc(fp) == L'\u3093'); /* N */ | ||
| 64 | assert(fgetwc(fp) == L'\u306b'); /* Ni */ | ||
| 65 | assert(fgetwc(fp) == L'\u3061'); /* Ti */ | ||
| 66 | assert(fgetwc(fp) == L'\u308f'); /* Wa */ | ||
| 67 | |||
| 68 | /* push 263A(smile) back */ | ||
| 69 | assert(ungetwc(L'\u263a', fp)); | ||
| 70 | |||
| 71 | /* we support 1 push back wchar_t */ | ||
| 72 | assert(fgetwc(fp) == L'\u263a'); | ||
| 73 | |||
| 74 | /* can read reset of that */ | ||
| 75 | fgetws(buf, sizeof(buf), fp); | ||
| 76 | assert(wcscmp(buf, L" \u4e16\u754c\n") == 0); | ||
| 77 | |||
| 78 | r = fclose(fp); | ||
| 79 | assert(r == 0); | ||
| 80 | } | ||
| 81 | |||
| 82 | int | ||
| 83 | main(int argc, char *argv[]) | ||
| 84 | { | ||
| 85 | setlocale(LC_ALL, "C.UTF-8"); | ||
| 86 | |||
| 87 | test_fflush_ungetwc0(); | ||
| 88 | |||
| 89 | exit(0); | ||
| 90 | } | ||
diff --git a/src/regress/lib/libc/sys/t_fork.c b/src/regress/lib/libc/sys/t_fork.c index b55b557824..1084855aee 100644 --- a/src/regress/lib/libc/sys/t_fork.c +++ b/src/regress/lib/libc/sys/t_fork.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_fork.c,v 1.5 2021/12/13 16:56:48 deraadt Exp $ */ | 1 | /* $OpenBSD: t_fork.c,v 1.6 2025/10/31 17:14:46 miod Exp $ */ |
| 2 | /* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ | 2 | /* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -28,7 +28,7 @@ | |||
| 28 | */ | 28 | */ |
| 29 | #include "macros.h" | 29 | #include "macros.h" |
| 30 | 30 | ||
| 31 | #include <sys/types.h> | 31 | #include <sys/param.h> /* for MACHINE_STACK_GROWS_UP */ |
| 32 | #include <sys/signal.h> | 32 | #include <sys/signal.h> |
| 33 | #ifdef __OpenBSD__ | 33 | #ifdef __OpenBSD__ |
| 34 | #include <sys/proc.h> | 34 | #include <sys/proc.h> |
| @@ -282,7 +282,7 @@ nested_raw(const char *fn, volatile int flags) | |||
| 282 | stack = malloc(stack_size); | 282 | stack = malloc(stack_size); |
| 283 | ATF_REQUIRE(stack != NULL); | 283 | ATF_REQUIRE(stack != NULL); |
| 284 | 284 | ||
| 285 | #ifdef __MACHINE_STACK_GROWS_UP | 285 | #ifdef MACHINE_STACK_GROWS_UP |
| 286 | stack_base = stack; | 286 | stack_base = stack; |
| 287 | #else | 287 | #else |
| 288 | stack_base = (char *)stack + stack_size; | 288 | stack_base = (char *)stack + stack_size; |
diff --git a/src/regress/lib/libc/sys/t_getrusage.c b/src/regress/lib/libc/sys/t_getrusage.c index 1a9e3d139c..04ad7e4e87 100644 --- a/src/regress/lib/libc/sys/t_getrusage.c +++ b/src/regress/lib/libc/sys/t_getrusage.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: t_getrusage.c,v 1.3 2021/12/13 16:56:48 deraadt Exp $ */ | 1 | /* $OpenBSD: t_getrusage.c,v 1.4 2025/11/06 12:56:58 miod Exp $ */ |
| 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ | 2 | /* $NetBSD: t_getrusage.c,v 1.8 2018/05/09 08:45:03 mrg Exp $ */ |
| 3 | 3 | ||
| 4 | /*- | 4 | /*- |
| @@ -68,6 +68,8 @@ work(void) | |||
| 68 | asm volatile("l.nop"); /* Do something. */ | 68 | asm volatile("l.nop"); /* Do something. */ |
| 69 | #elif defined(__ia64__) | 69 | #elif defined(__ia64__) |
| 70 | asm volatile("nop 0"); /* Do something. */ | 70 | asm volatile("nop 0"); /* Do something. */ |
| 71 | #elif defined(__m88k) | ||
| 72 | asm volatile("or %r0, %r0, %r0"); /* Do something. */ | ||
| 71 | #else | 73 | #else |
| 72 | asm volatile("nop"); /* Do something. */ | 74 | asm volatile("nop"); /* Do something. */ |
| 73 | #endif | 75 | #endif |
diff --git a/src/regress/lib/libc/time/time_conversion/timetest.c b/src/regress/lib/libc/time/time_conversion/timetest.c index 0706704ee1..1405f1c6a5 100644 --- a/src/regress/lib/libc/time/time_conversion/timetest.c +++ b/src/regress/lib/libc/time/time_conversion/timetest.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: timetest.c,v 1.4 2023/04/13 11:32:06 mbuhl Exp $ */ | 1 | /* $OpenBSD: timetest.c,v 1.5 2025/08/17 08:43:03 phessler Exp $ */ |
| 2 | 2 | ||
| 3 | /* | 3 | /* |
| 4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 4 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
| @@ -79,12 +79,12 @@ struct timetest timetests[] = { | |||
| 79 | .tm_yday=171, | 79 | .tm_yday=171, |
| 80 | .tm_isdst=0, | 80 | .tm_isdst=0, |
| 81 | .tm_gmtoff=0, | 81 | .tm_gmtoff=0, |
| 82 | .tm_zone="GMT" | 82 | .tm_zone="UTC" |
| 83 | }, | 83 | }, |
| 84 | }, | 84 | }, |
| 85 | { | 85 | { |
| 86 | .descr="moon", | 86 | .descr="moon", |
| 87 | .timezone="right/UTC", | 87 | .timezone="right/GMT", |
| 88 | .time=-16751025, | 88 | .time=-16751025, |
| 89 | .local_tm= { | 89 | .local_tm= { |
| 90 | .tm_year=69, | 90 | .tm_year=69, |
| @@ -97,7 +97,7 @@ struct timetest timetests[] = { | |||
| 97 | .tm_yday=171, | 97 | .tm_yday=171, |
| 98 | .tm_isdst=0, | 98 | .tm_isdst=0, |
| 99 | .tm_gmtoff=0, | 99 | .tm_gmtoff=0, |
| 100 | .tm_zone="UTC" | 100 | .tm_zone="GMT" |
| 101 | }, | 101 | }, |
| 102 | .gmt_tm= { | 102 | .gmt_tm= { |
| 103 | .tm_year=69, | 103 | .tm_year=69, |
| @@ -110,7 +110,7 @@ struct timetest timetests[] = { | |||
| 110 | .tm_yday=171, | 110 | .tm_yday=171, |
| 111 | .tm_isdst=0, | 111 | .tm_isdst=0, |
| 112 | .tm_gmtoff=0, | 112 | .tm_gmtoff=0, |
| 113 | .tm_zone="GMT" | 113 | .tm_zone="UTC" |
| 114 | }, | 114 | }, |
| 115 | }, | 115 | }, |
| 116 | { | 116 | { |
| @@ -141,7 +141,7 @@ struct timetest timetests[] = { | |||
| 141 | .tm_yday=171, | 141 | .tm_yday=171, |
| 142 | .tm_isdst=0, | 142 | .tm_isdst=0, |
| 143 | .tm_gmtoff=0, | 143 | .tm_gmtoff=0, |
| 144 | .tm_zone="GMT" | 144 | .tm_zone="UTC" |
| 145 | }, | 145 | }, |
| 146 | }, | 146 | }, |
| 147 | { | 147 | { |
| @@ -172,12 +172,12 @@ struct timetest timetests[] = { | |||
| 172 | .tm_yday=0, | 172 | .tm_yday=0, |
| 173 | .tm_isdst=0, | 173 | .tm_isdst=0, |
| 174 | .tm_gmtoff=0, | 174 | .tm_gmtoff=0, |
| 175 | .tm_zone="GMT" | 175 | .tm_zone="UTC" |
| 176 | }, | 176 | }, |
| 177 | }, | 177 | }, |
| 178 | { | 178 | { |
| 179 | .descr="epoch", | 179 | .descr="epoch", |
| 180 | .timezone="right/UTC", | 180 | .timezone="right/GMT", |
| 181 | .time=0, | 181 | .time=0, |
| 182 | .local_tm= { | 182 | .local_tm= { |
| 183 | .tm_year=70, | 183 | .tm_year=70, |
| @@ -190,7 +190,7 @@ struct timetest timetests[] = { | |||
| 190 | .tm_yday=0, | 190 | .tm_yday=0, |
| 191 | .tm_isdst=0, | 191 | .tm_isdst=0, |
| 192 | .tm_gmtoff=0, | 192 | .tm_gmtoff=0, |
| 193 | .tm_zone="UTC" | 193 | .tm_zone="GMT" |
| 194 | }, | 194 | }, |
| 195 | .gmt_tm= { | 195 | .gmt_tm= { |
| 196 | .tm_year=70, | 196 | .tm_year=70, |
| @@ -203,7 +203,7 @@ struct timetest timetests[] = { | |||
| 203 | .tm_yday=0, | 203 | .tm_yday=0, |
| 204 | .tm_isdst=0, | 204 | .tm_isdst=0, |
| 205 | .tm_gmtoff=0, | 205 | .tm_gmtoff=0, |
| 206 | .tm_zone="GMT" | 206 | .tm_zone="UTC" |
| 207 | }, | 207 | }, |
| 208 | }, | 208 | }, |
| 209 | { | 209 | { |
| @@ -234,7 +234,7 @@ struct timetest timetests[] = { | |||
| 234 | .tm_yday=0, | 234 | .tm_yday=0, |
| 235 | .tm_isdst=0, | 235 | .tm_isdst=0, |
| 236 | .tm_gmtoff=0, | 236 | .tm_gmtoff=0, |
| 237 | .tm_zone="GMT" | 237 | .tm_zone="UTC" |
| 238 | }, | 238 | }, |
| 239 | }, | 239 | }, |
| 240 | { | 240 | { |
| @@ -265,12 +265,12 @@ struct timetest timetests[] = { | |||
| 265 | .tm_yday=364, | 265 | .tm_yday=364, |
| 266 | .tm_isdst=0, | 266 | .tm_isdst=0, |
| 267 | .tm_gmtoff=0, | 267 | .tm_gmtoff=0, |
| 268 | .tm_zone="GMT" | 268 | .tm_zone="UTC" |
| 269 | }, | 269 | }, |
| 270 | }, | 270 | }, |
| 271 | { | 271 | { |
| 272 | .descr="epoch - 1", | 272 | .descr="epoch - 1", |
| 273 | .timezone="right/UTC", | 273 | .timezone="right/GMT", |
| 274 | .time=-1, | 274 | .time=-1, |
| 275 | .local_tm= { | 275 | .local_tm= { |
| 276 | .tm_year=69, | 276 | .tm_year=69, |
| @@ -283,7 +283,7 @@ struct timetest timetests[] = { | |||
| 283 | .tm_yday=364, | 283 | .tm_yday=364, |
| 284 | .tm_isdst=0, | 284 | .tm_isdst=0, |
| 285 | .tm_gmtoff=0, | 285 | .tm_gmtoff=0, |
| 286 | .tm_zone="UTC" | 286 | .tm_zone="GMT" |
| 287 | }, | 287 | }, |
| 288 | .gmt_tm= { | 288 | .gmt_tm= { |
| 289 | .tm_year=69, | 289 | .tm_year=69, |
| @@ -296,7 +296,7 @@ struct timetest timetests[] = { | |||
| 296 | .tm_yday=364, | 296 | .tm_yday=364, |
| 297 | .tm_isdst=0, | 297 | .tm_isdst=0, |
| 298 | .tm_gmtoff=0, | 298 | .tm_gmtoff=0, |
| 299 | .tm_zone="GMT" | 299 | .tm_zone="UTC" |
| 300 | }, | 300 | }, |
| 301 | }, | 301 | }, |
| 302 | { | 302 | { |
| @@ -327,7 +327,7 @@ struct timetest timetests[] = { | |||
| 327 | .tm_yday=364, | 327 | .tm_yday=364, |
| 328 | .tm_isdst=0, | 328 | .tm_isdst=0, |
| 329 | .tm_gmtoff=0, | 329 | .tm_gmtoff=0, |
| 330 | .tm_zone="GMT" | 330 | .tm_zone="UTC" |
| 331 | }, | 331 | }, |
| 332 | }, | 332 | }, |
| 333 | { | 333 | { |
| @@ -358,12 +358,12 @@ struct timetest timetests[] = { | |||
| 358 | .tm_yday=346, | 358 | .tm_yday=346, |
| 359 | .tm_isdst=0, | 359 | .tm_isdst=0, |
| 360 | .tm_gmtoff=0, | 360 | .tm_gmtoff=0, |
| 361 | .tm_zone="GMT" | 361 | .tm_zone="UTC" |
| 362 | }, | 362 | }, |
| 363 | }, | 363 | }, |
| 364 | { | 364 | { |
| 365 | .descr="legacy min", | 365 | .descr="legacy min", |
| 366 | .timezone="right/UTC", | 366 | .timezone="right/GMT", |
| 367 | .time=-2147483648, | 367 | .time=-2147483648, |
| 368 | .local_tm= { | 368 | .local_tm= { |
| 369 | .tm_year=1, | 369 | .tm_year=1, |
| @@ -376,7 +376,7 @@ struct timetest timetests[] = { | |||
| 376 | .tm_yday=346, | 376 | .tm_yday=346, |
| 377 | .tm_isdst=0, | 377 | .tm_isdst=0, |
| 378 | .tm_gmtoff=0, | 378 | .tm_gmtoff=0, |
| 379 | .tm_zone="UTC" | 379 | .tm_zone="GMT" |
| 380 | }, | 380 | }, |
| 381 | .gmt_tm= { | 381 | .gmt_tm= { |
| 382 | .tm_year=1, | 382 | .tm_year=1, |
| @@ -389,7 +389,7 @@ struct timetest timetests[] = { | |||
| 389 | .tm_yday=346, | 389 | .tm_yday=346, |
| 390 | .tm_isdst=0, | 390 | .tm_isdst=0, |
| 391 | .tm_gmtoff=0, | 391 | .tm_gmtoff=0, |
| 392 | .tm_zone="GMT" | 392 | .tm_zone="UTC" |
| 393 | }, | 393 | }, |
| 394 | }, | 394 | }, |
| 395 | { | 395 | { |
| @@ -420,12 +420,12 @@ struct timetest timetests[] = { | |||
| 420 | .tm_yday=346, | 420 | .tm_yday=346, |
| 421 | .tm_isdst=0, | 421 | .tm_isdst=0, |
| 422 | .tm_gmtoff=0, | 422 | .tm_gmtoff=0, |
| 423 | .tm_zone="GMT" | 423 | .tm_zone="UTC" |
| 424 | }, | 424 | }, |
| 425 | }, | 425 | }, |
| 426 | { | 426 | { |
| 427 | .descr="legacy min - 1", | 427 | .descr="legacy min - 1", |
| 428 | .timezone="right/UTC", | 428 | .timezone="right/GMT", |
| 429 | .time=-2147483649, | 429 | .time=-2147483649, |
| 430 | .local_tm= { | 430 | .local_tm= { |
| 431 | .tm_year=1, | 431 | .tm_year=1, |
| @@ -438,7 +438,7 @@ struct timetest timetests[] = { | |||
| 438 | .tm_yday=346, | 438 | .tm_yday=346, |
| 439 | .tm_isdst=0, | 439 | .tm_isdst=0, |
| 440 | .tm_gmtoff=0, | 440 | .tm_gmtoff=0, |
| 441 | .tm_zone="UTC" | 441 | .tm_zone="GMT" |
| 442 | }, | 442 | }, |
| 443 | .gmt_tm= { | 443 | .gmt_tm= { |
| 444 | .tm_year=1, | 444 | .tm_year=1, |
| @@ -451,7 +451,7 @@ struct timetest timetests[] = { | |||
| 451 | .tm_yday=346, | 451 | .tm_yday=346, |
| 452 | .tm_isdst=0, | 452 | .tm_isdst=0, |
| 453 | .tm_gmtoff=0, | 453 | .tm_gmtoff=0, |
| 454 | .tm_zone="GMT" | 454 | .tm_zone="UTC" |
| 455 | }, | 455 | }, |
| 456 | }, | 456 | }, |
| 457 | { | 457 | { |
| @@ -482,12 +482,12 @@ struct timetest timetests[] = { | |||
| 482 | .tm_yday=18, | 482 | .tm_yday=18, |
| 483 | .tm_isdst=0, | 483 | .tm_isdst=0, |
| 484 | .tm_gmtoff=0, | 484 | .tm_gmtoff=0, |
| 485 | .tm_zone="GMT" | 485 | .tm_zone="UTC" |
| 486 | }, | 486 | }, |
| 487 | }, | 487 | }, |
| 488 | { | 488 | { |
| 489 | .descr="legacy max", | 489 | .descr="legacy max", |
| 490 | .timezone="right/UTC", | 490 | .timezone="right/GMT", |
| 491 | .time=2147483647, | 491 | .time=2147483647, |
| 492 | .local_tm= { | 492 | .local_tm= { |
| 493 | .tm_year=138, | 493 | .tm_year=138, |
| @@ -500,7 +500,7 @@ struct timetest timetests[] = { | |||
| 500 | .tm_yday=18, | 500 | .tm_yday=18, |
| 501 | .tm_isdst=0, | 501 | .tm_isdst=0, |
| 502 | .tm_gmtoff=0, | 502 | .tm_gmtoff=0, |
| 503 | .tm_zone="UTC" | 503 | .tm_zone="GMT" |
| 504 | }, | 504 | }, |
| 505 | .gmt_tm= { | 505 | .gmt_tm= { |
| 506 | .tm_year=138, | 506 | .tm_year=138, |
| @@ -513,7 +513,7 @@ struct timetest timetests[] = { | |||
| 513 | .tm_yday=18, | 513 | .tm_yday=18, |
| 514 | .tm_isdst=0, | 514 | .tm_isdst=0, |
| 515 | .tm_gmtoff=0, | 515 | .tm_gmtoff=0, |
| 516 | .tm_zone="GMT" | 516 | .tm_zone="UTC" |
| 517 | }, | 517 | }, |
| 518 | }, | 518 | }, |
| 519 | { | 519 | { |
| @@ -544,12 +544,12 @@ struct timetest timetests[] = { | |||
| 544 | .tm_yday=18, | 544 | .tm_yday=18, |
| 545 | .tm_isdst=0, | 545 | .tm_isdst=0, |
| 546 | .tm_gmtoff=0, | 546 | .tm_gmtoff=0, |
| 547 | .tm_zone="GMT" | 547 | .tm_zone="UTC" |
| 548 | }, | 548 | }, |
| 549 | }, | 549 | }, |
| 550 | { | 550 | { |
| 551 | .descr="legacy max + 1", | 551 | .descr="legacy max + 1", |
| 552 | .timezone="right/UTC", | 552 | .timezone="right/GMT", |
| 553 | .time=2147483648, | 553 | .time=2147483648, |
| 554 | .local_tm= { | 554 | .local_tm= { |
| 555 | .tm_year=138, | 555 | .tm_year=138, |
| @@ -562,7 +562,7 @@ struct timetest timetests[] = { | |||
| 562 | .tm_yday=18, | 562 | .tm_yday=18, |
| 563 | .tm_isdst=0, | 563 | .tm_isdst=0, |
| 564 | .tm_gmtoff=0, | 564 | .tm_gmtoff=0, |
| 565 | .tm_zone="UTC" | 565 | .tm_zone="GMT" |
| 566 | }, | 566 | }, |
| 567 | .gmt_tm= { | 567 | .gmt_tm= { |
| 568 | .tm_year=138, | 568 | .tm_year=138, |
| @@ -575,7 +575,7 @@ struct timetest timetests[] = { | |||
| 575 | .tm_yday=18, | 575 | .tm_yday=18, |
| 576 | .tm_isdst=0, | 576 | .tm_isdst=0, |
| 577 | .tm_gmtoff=0, | 577 | .tm_gmtoff=0, |
| 578 | .tm_zone="GMT" | 578 | .tm_zone="UTC" |
| 579 | }, | 579 | }, |
| 580 | }, | 580 | }, |
| 581 | { | 581 | { |
| @@ -611,7 +611,7 @@ struct timetest timetests[] = { | |||
| 611 | }, | 611 | }, |
| 612 | { | 612 | { |
| 613 | .descr="min", | 613 | .descr="min", |
| 614 | .timezone="right/UTC", | 614 | .timezone="right/GMT", |
| 615 | .time=INT64_MIN, | 615 | .time=INT64_MIN, |
| 616 | .local_tm= { | 616 | .local_tm= { |
| 617 | .tm_year=0, | 617 | .tm_year=0, |
| @@ -704,7 +704,7 @@ struct timetest timetests[] = { | |||
| 704 | }, | 704 | }, |
| 705 | { | 705 | { |
| 706 | .descr="max", | 706 | .descr="max", |
| 707 | .timezone="right/UTC", | 707 | .timezone="right/GMT", |
| 708 | .time=9223372036854775807, | 708 | .time=9223372036854775807, |
| 709 | .local_tm= { | 709 | .local_tm= { |
| 710 | .tm_year=0, | 710 | .tm_year=0, |
| @@ -792,7 +792,7 @@ struct timetest timetests[] = { | |||
| 792 | .tm_yday=30, | 792 | .tm_yday=30, |
| 793 | .tm_isdst=0, | 793 | .tm_isdst=0, |
| 794 | .tm_gmtoff=0, | 794 | .tm_gmtoff=0, |
| 795 | .tm_zone="GMT" | 795 | .tm_zone="UTC" |
| 796 | }, | 796 | }, |
| 797 | }, | 797 | }, |
| 798 | { | 798 | { |
| @@ -823,12 +823,12 @@ struct timetest timetests[] = { | |||
| 823 | .tm_yday=30, | 823 | .tm_yday=30, |
| 824 | .tm_isdst=0, | 824 | .tm_isdst=0, |
| 825 | .tm_gmtoff=0, | 825 | .tm_gmtoff=0, |
| 826 | .tm_zone="GMT" | 826 | .tm_zone="UTC" |
| 827 | }, | 827 | }, |
| 828 | }, | 828 | }, |
| 829 | { | 829 | { |
| 830 | .descr="maxint struct tm", | 830 | .descr="maxint struct tm", |
| 831 | .timezone="right/UTC", | 831 | .timezone="right/GMT", |
| 832 | .time=67767976204675199, | 832 | .time=67767976204675199, |
| 833 | .local_tm= { | 833 | .local_tm= { |
| 834 | .tm_year=2147481747, | 834 | .tm_year=2147481747, |
| @@ -841,7 +841,7 @@ struct timetest timetests[] = { | |||
| 841 | .tm_yday=30, | 841 | .tm_yday=30, |
| 842 | .tm_isdst=0, | 842 | .tm_isdst=0, |
| 843 | .tm_gmtoff=0, | 843 | .tm_gmtoff=0, |
| 844 | .tm_zone="UTC" | 844 | .tm_zone="GMT" |
| 845 | }, | 845 | }, |
| 846 | .gmt_tm= { | 846 | .gmt_tm= { |
| 847 | .tm_year=2147481747, | 847 | .tm_year=2147481747, |
| @@ -854,12 +854,12 @@ struct timetest timetests[] = { | |||
| 854 | .tm_yday=30, | 854 | .tm_yday=30, |
| 855 | .tm_isdst=0, | 855 | .tm_isdst=0, |
| 856 | .tm_gmtoff=0, | 856 | .tm_gmtoff=0, |
| 857 | .tm_zone="GMT" | 857 | .tm_zone="UTC" |
| 858 | }, | 858 | }, |
| 859 | }, | 859 | }, |
| 860 | { | 860 | { |
| 861 | .descr="minint struct tm", | 861 | .descr="minint struct tm", |
| 862 | .timezone="right/UTC", | 862 | .timezone="right/GMT", |
| 863 | .time=-67768038398073601, | 863 | .time=-67768038398073601, |
| 864 | .local_tm= { | 864 | .local_tm= { |
| 865 | .tm_year=-2147483578, | 865 | .tm_year=-2147483578, |
| @@ -872,7 +872,7 @@ struct timetest timetests[] = { | |||
| 872 | .tm_yday=30, | 872 | .tm_yday=30, |
| 873 | .tm_isdst=0, | 873 | .tm_isdst=0, |
| 874 | .tm_gmtoff=0, | 874 | .tm_gmtoff=0, |
| 875 | .tm_zone="UTC" | 875 | .tm_zone="GMT" |
| 876 | }, | 876 | }, |
| 877 | .gmt_tm= { | 877 | .gmt_tm= { |
| 878 | .tm_year=-2147483578, | 878 | .tm_year=-2147483578, |
| @@ -885,7 +885,7 @@ struct timetest timetests[] = { | |||
| 885 | .tm_yday=30, | 885 | .tm_yday=30, |
| 886 | .tm_isdst=0, | 886 | .tm_isdst=0, |
| 887 | .tm_gmtoff=0, | 887 | .tm_gmtoff=0, |
| 888 | .tm_zone="GMT" | 888 | .tm_zone="UTC" |
| 889 | }, | 889 | }, |
| 890 | }, | 890 | }, |
| 891 | { | 891 | { |
| @@ -916,12 +916,12 @@ struct timetest timetests[] = { | |||
| 916 | .tm_yday=0, | 916 | .tm_yday=0, |
| 917 | .tm_isdst=0, | 917 | .tm_isdst=0, |
| 918 | .tm_gmtoff=0, | 918 | .tm_gmtoff=0, |
| 919 | .tm_zone="GMT" | 919 | .tm_zone="UTC" |
| 920 | }, | 920 | }, |
| 921 | }, | 921 | }, |
| 922 | { | 922 | { |
| 923 | .descr="0000", | 923 | .descr="0000", |
| 924 | .timezone="right/UTC", | 924 | .timezone="right/GMT", |
| 925 | .time=-62167219200, | 925 | .time=-62167219200, |
| 926 | .local_tm= { | 926 | .local_tm= { |
| 927 | .tm_year=-1900, | 927 | .tm_year=-1900, |
| @@ -934,7 +934,7 @@ struct timetest timetests[] = { | |||
| 934 | .tm_yday=0, | 934 | .tm_yday=0, |
| 935 | .tm_isdst=0, | 935 | .tm_isdst=0, |
| 936 | .tm_gmtoff=0, | 936 | .tm_gmtoff=0, |
| 937 | .tm_zone="UTC" | 937 | .tm_zone="GMT" |
| 938 | }, | 938 | }, |
| 939 | .gmt_tm= { | 939 | .gmt_tm= { |
| 940 | .tm_year=-1900, | 940 | .tm_year=-1900, |
| @@ -947,7 +947,7 @@ struct timetest timetests[] = { | |||
| 947 | .tm_yday=0, | 947 | .tm_yday=0, |
| 948 | .tm_isdst=0, | 948 | .tm_isdst=0, |
| 949 | .tm_gmtoff=0, | 949 | .tm_gmtoff=0, |
| 950 | .tm_zone="GMT" | 950 | .tm_zone="UTC" |
| 951 | }, | 951 | }, |
| 952 | }, | 952 | }, |
| 953 | { | 953 | { |
| @@ -978,7 +978,7 @@ struct timetest timetests[] = { | |||
| 978 | .tm_yday=0, | 978 | .tm_yday=0, |
| 979 | .tm_isdst=0, | 979 | .tm_isdst=0, |
| 980 | .tm_gmtoff=0, | 980 | .tm_gmtoff=0, |
| 981 | .tm_zone="GMT" | 981 | .tm_zone="UTC" |
| 982 | }, | 982 | }, |
| 983 | }, | 983 | }, |
| 984 | { | 984 | { |
| @@ -1009,12 +1009,12 @@ struct timetest timetests[] = { | |||
| 1009 | .tm_yday=364, | 1009 | .tm_yday=364, |
| 1010 | .tm_isdst=0, | 1010 | .tm_isdst=0, |
| 1011 | .tm_gmtoff=0, | 1011 | .tm_gmtoff=0, |
| 1012 | .tm_zone="GMT" | 1012 | .tm_zone="UTC" |
| 1013 | }, | 1013 | }, |
| 1014 | }, | 1014 | }, |
| 1015 | { | 1015 | { |
| 1016 | .descr="9999", | 1016 | .descr="9999", |
| 1017 | .timezone="right/UTC", | 1017 | .timezone="right/GMT", |
| 1018 | .time=253402300799, | 1018 | .time=253402300799, |
| 1019 | .local_tm= { | 1019 | .local_tm= { |
| 1020 | .tm_year=8099, | 1020 | .tm_year=8099, |
| @@ -1027,7 +1027,7 @@ struct timetest timetests[] = { | |||
| 1027 | .tm_yday=364, | 1027 | .tm_yday=364, |
| 1028 | .tm_isdst=0, | 1028 | .tm_isdst=0, |
| 1029 | .tm_gmtoff=0, | 1029 | .tm_gmtoff=0, |
| 1030 | .tm_zone="UTC" | 1030 | .tm_zone="GMT" |
| 1031 | }, | 1031 | }, |
| 1032 | .gmt_tm= { | 1032 | .gmt_tm= { |
| 1033 | .tm_year=8099, | 1033 | .tm_year=8099, |
| @@ -1040,7 +1040,7 @@ struct timetest timetests[] = { | |||
| 1040 | .tm_yday=364, | 1040 | .tm_yday=364, |
| 1041 | .tm_isdst=0, | 1041 | .tm_isdst=0, |
| 1042 | .tm_gmtoff=0, | 1042 | .tm_gmtoff=0, |
| 1043 | .tm_zone="GMT" | 1043 | .tm_zone="UTC" |
| 1044 | }, | 1044 | }, |
| 1045 | }, | 1045 | }, |
| 1046 | { | 1046 | { |
| @@ -1071,7 +1071,7 @@ struct timetest timetests[] = { | |||
| 1071 | .tm_yday=364, | 1071 | .tm_yday=364, |
| 1072 | .tm_isdst=0, | 1072 | .tm_isdst=0, |
| 1073 | .tm_gmtoff=0, | 1073 | .tm_gmtoff=0, |
| 1074 | .tm_zone="GMT" | 1074 | .tm_zone="UTC" |
| 1075 | }, | 1075 | }, |
| 1076 | }, | 1076 | }, |
| 1077 | { | 1077 | { |
| @@ -1102,7 +1102,7 @@ struct timetest timetests[] = { | |||
| 1102 | .tm_yday=0, | 1102 | .tm_yday=0, |
| 1103 | .tm_isdst=0, | 1103 | .tm_isdst=0, |
| 1104 | .tm_gmtoff=0, | 1104 | .tm_gmtoff=0, |
| 1105 | .tm_zone="GMT" | 1105 | .tm_zone="UTC" |
| 1106 | }, | 1106 | }, |
| 1107 | }, | 1107 | }, |
| 1108 | { | 1108 | { |
| @@ -1133,7 +1133,7 @@ struct timetest timetests[] = { | |||
| 1133 | .tm_yday=0, | 1133 | .tm_yday=0, |
| 1134 | .tm_isdst=0, | 1134 | .tm_isdst=0, |
| 1135 | .tm_gmtoff=0, | 1135 | .tm_gmtoff=0, |
| 1136 | .tm_zone="GMT" | 1136 | .tm_zone="UTC" |
| 1137 | }, | 1137 | }, |
| 1138 | }, | 1138 | }, |
| 1139 | { | 1139 | { |
| @@ -1164,12 +1164,12 @@ struct timetest timetests[] = { | |||
| 1164 | .tm_yday=0, | 1164 | .tm_yday=0, |
| 1165 | .tm_isdst=0, | 1165 | .tm_isdst=0, |
| 1166 | .tm_gmtoff=0, | 1166 | .tm_gmtoff=0, |
| 1167 | .tm_zone="GMT" | 1167 | .tm_zone="UTC" |
| 1168 | }, | 1168 | }, |
| 1169 | }, | 1169 | }, |
| 1170 | { | 1170 | { |
| 1171 | .descr="leap second - 1", | 1171 | .descr="leap second - 1", |
| 1172 | .timezone="right/UTC", | 1172 | .timezone="right/GMT", |
| 1173 | .time=1483228825, | 1173 | .time=1483228825, |
| 1174 | .local_tm= { | 1174 | .local_tm= { |
| 1175 | .tm_year=116, | 1175 | .tm_year=116, |
| @@ -1182,7 +1182,7 @@ struct timetest timetests[] = { | |||
| 1182 | .tm_yday=365, | 1182 | .tm_yday=365, |
| 1183 | .tm_isdst=0, | 1183 | .tm_isdst=0, |
| 1184 | .tm_gmtoff=0, | 1184 | .tm_gmtoff=0, |
| 1185 | .tm_zone="UTC" | 1185 | .tm_zone="GMT" |
| 1186 | }, | 1186 | }, |
| 1187 | .gmt_tm= { | 1187 | .gmt_tm= { |
| 1188 | .tm_year=117, | 1188 | .tm_year=117, |
| @@ -1195,12 +1195,12 @@ struct timetest timetests[] = { | |||
| 1195 | .tm_yday=0, | 1195 | .tm_yday=0, |
| 1196 | .tm_isdst=0, | 1196 | .tm_isdst=0, |
| 1197 | .tm_gmtoff=0, | 1197 | .tm_gmtoff=0, |
| 1198 | .tm_zone="GMT" | 1198 | .tm_zone="UTC" |
| 1199 | }, | 1199 | }, |
| 1200 | }, | 1200 | }, |
| 1201 | { | 1201 | { |
| 1202 | .descr="leap second", | 1202 | .descr="leap second", |
| 1203 | .timezone="right/UTC", | 1203 | .timezone="right/GMT", |
| 1204 | .time=1483228826, | 1204 | .time=1483228826, |
| 1205 | .local_tm= { | 1205 | .local_tm= { |
| 1206 | .tm_year=116, | 1206 | .tm_year=116, |
| @@ -1213,7 +1213,7 @@ struct timetest timetests[] = { | |||
| 1213 | .tm_yday=365, | 1213 | .tm_yday=365, |
| 1214 | .tm_isdst=0, | 1214 | .tm_isdst=0, |
| 1215 | .tm_gmtoff=0, | 1215 | .tm_gmtoff=0, |
| 1216 | .tm_zone="UTC" | 1216 | .tm_zone="GMT" |
| 1217 | }, | 1217 | }, |
| 1218 | .gmt_tm= { | 1218 | .gmt_tm= { |
| 1219 | .tm_year=117, | 1219 | .tm_year=117, |
| @@ -1226,12 +1226,12 @@ struct timetest timetests[] = { | |||
| 1226 | .tm_yday=0, | 1226 | .tm_yday=0, |
| 1227 | .tm_isdst=0, | 1227 | .tm_isdst=0, |
| 1228 | .tm_gmtoff=0, | 1228 | .tm_gmtoff=0, |
| 1229 | .tm_zone="GMT" | 1229 | .tm_zone="UTC" |
| 1230 | }, | 1230 | }, |
| 1231 | }, | 1231 | }, |
| 1232 | { | 1232 | { |
| 1233 | .descr="leap second + 1", | 1233 | .descr="leap second + 1", |
| 1234 | .timezone="right/UTC", | 1234 | .timezone="right/GMT", |
| 1235 | .time=1483228827, | 1235 | .time=1483228827, |
| 1236 | .local_tm= { | 1236 | .local_tm= { |
| 1237 | .tm_year=117, | 1237 | .tm_year=117, |
| @@ -1244,7 +1244,7 @@ struct timetest timetests[] = { | |||
| 1244 | .tm_yday=0, | 1244 | .tm_yday=0, |
| 1245 | .tm_isdst=0, | 1245 | .tm_isdst=0, |
| 1246 | .tm_gmtoff=0, | 1246 | .tm_gmtoff=0, |
| 1247 | .tm_zone="UTC" | 1247 | .tm_zone="GMT" |
| 1248 | }, | 1248 | }, |
| 1249 | .gmt_tm= { | 1249 | .gmt_tm= { |
| 1250 | .tm_year=117, | 1250 | .tm_year=117, |
| @@ -1257,7 +1257,7 @@ struct timetest timetests[] = { | |||
| 1257 | .tm_yday=0, | 1257 | .tm_yday=0, |
| 1258 | .tm_isdst=0, | 1258 | .tm_isdst=0, |
| 1259 | .tm_gmtoff=0, | 1259 | .tm_gmtoff=0, |
| 1260 | .tm_zone="GMT" | 1260 | .tm_zone="UTC" |
| 1261 | }, | 1261 | }, |
| 1262 | }, | 1262 | }, |
| 1263 | { | 1263 | { |
| @@ -1288,7 +1288,7 @@ struct timetest timetests[] = { | |||
| 1288 | .tm_yday=0, | 1288 | .tm_yday=0, |
| 1289 | .tm_isdst=0, | 1289 | .tm_isdst=0, |
| 1290 | .tm_gmtoff=0, | 1290 | .tm_gmtoff=0, |
| 1291 | .tm_zone="GMT" | 1291 | .tm_zone="UTC" |
| 1292 | }, | 1292 | }, |
| 1293 | }, | 1293 | }, |
| 1294 | { | 1294 | { |
| @@ -1319,7 +1319,7 @@ struct timetest timetests[] = { | |||
| 1319 | .tm_yday=0, | 1319 | .tm_yday=0, |
| 1320 | .tm_isdst=0, | 1320 | .tm_isdst=0, |
| 1321 | .tm_gmtoff=0, | 1321 | .tm_gmtoff=0, |
| 1322 | .tm_zone="GMT" | 1322 | .tm_zone="UTC" |
| 1323 | }, | 1323 | }, |
| 1324 | }, | 1324 | }, |
| 1325 | { | 1325 | { |
| @@ -1350,7 +1350,7 @@ struct timetest timetests[] = { | |||
| 1350 | .tm_yday=0, | 1350 | .tm_yday=0, |
| 1351 | .tm_isdst=0, | 1351 | .tm_isdst=0, |
| 1352 | .tm_gmtoff=0, | 1352 | .tm_gmtoff=0, |
| 1353 | .tm_zone="GMT" | 1353 | .tm_zone="UTC" |
| 1354 | }, | 1354 | }, |
| 1355 | }, | 1355 | }, |
| 1356 | { | 1356 | { |
| @@ -1381,7 +1381,7 @@ struct timetest timetests[] = { | |||
| 1381 | .tm_yday=72, | 1381 | .tm_yday=72, |
| 1382 | .tm_isdst=0, | 1382 | .tm_isdst=0, |
| 1383 | .tm_gmtoff=0, | 1383 | .tm_gmtoff=0, |
| 1384 | .tm_zone="GMT" | 1384 | .tm_zone="UTC" |
| 1385 | }, | 1385 | }, |
| 1386 | }, | 1386 | }, |
| 1387 | { | 1387 | { |
| @@ -1412,7 +1412,7 @@ struct timetest timetests[] = { | |||
| 1412 | .tm_yday=72, | 1412 | .tm_yday=72, |
| 1413 | .tm_isdst=0, | 1413 | .tm_isdst=0, |
| 1414 | .tm_gmtoff=0, | 1414 | .tm_gmtoff=0, |
| 1415 | .tm_zone="GMT" | 1415 | .tm_zone="UTC" |
| 1416 | }, | 1416 | }, |
| 1417 | }, | 1417 | }, |
| 1418 | { | 1418 | { |
| @@ -1443,7 +1443,7 @@ struct timetest timetests[] = { | |||
| 1443 | .tm_yday=72, | 1443 | .tm_yday=72, |
| 1444 | .tm_isdst=0, | 1444 | .tm_isdst=0, |
| 1445 | .tm_gmtoff=0, | 1445 | .tm_gmtoff=0, |
| 1446 | .tm_zone="GMT" | 1446 | .tm_zone="UTC" |
| 1447 | }, | 1447 | }, |
| 1448 | }, | 1448 | }, |
| 1449 | { | 1449 | { |
| @@ -1474,7 +1474,7 @@ struct timetest timetests[] = { | |||
| 1474 | .tm_yday=72, | 1474 | .tm_yday=72, |
| 1475 | .tm_isdst=0, | 1475 | .tm_isdst=0, |
| 1476 | .tm_gmtoff=0, | 1476 | .tm_gmtoff=0, |
| 1477 | .tm_zone="GMT" | 1477 | .tm_zone="UTC" |
| 1478 | }, | 1478 | }, |
| 1479 | }, | 1479 | }, |
| 1480 | { | 1480 | { |
| @@ -1505,7 +1505,7 @@ struct timetest timetests[] = { | |||
| 1505 | .tm_yday=72, | 1505 | .tm_yday=72, |
| 1506 | .tm_isdst=0, | 1506 | .tm_isdst=0, |
| 1507 | .tm_gmtoff=0, | 1507 | .tm_gmtoff=0, |
| 1508 | .tm_zone="GMT" | 1508 | .tm_zone="UTC" |
| 1509 | }, | 1509 | }, |
| 1510 | }, | 1510 | }, |
| 1511 | { | 1511 | { |
| @@ -1536,7 +1536,7 @@ struct timetest timetests[] = { | |||
| 1536 | .tm_yday=72, | 1536 | .tm_yday=72, |
| 1537 | .tm_isdst=0, | 1537 | .tm_isdst=0, |
| 1538 | .tm_gmtoff=0, | 1538 | .tm_gmtoff=0, |
| 1539 | .tm_zone="GMT" | 1539 | .tm_zone="UTC" |
| 1540 | }, | 1540 | }, |
| 1541 | }, | 1541 | }, |
| 1542 | { | 1542 | { |
| @@ -1567,7 +1567,7 @@ struct timetest timetests[] = { | |||
| 1567 | .tm_yday=310, | 1567 | .tm_yday=310, |
| 1568 | .tm_isdst=0, | 1568 | .tm_isdst=0, |
| 1569 | .tm_gmtoff=0, | 1569 | .tm_gmtoff=0, |
| 1570 | .tm_zone="GMT" | 1570 | .tm_zone="UTC" |
| 1571 | }, | 1571 | }, |
| 1572 | }, | 1572 | }, |
| 1573 | { | 1573 | { |
| @@ -1598,7 +1598,7 @@ struct timetest timetests[] = { | |||
| 1598 | .tm_yday=310, | 1598 | .tm_yday=310, |
| 1599 | .tm_isdst=0, | 1599 | .tm_isdst=0, |
| 1600 | .tm_gmtoff=0, | 1600 | .tm_gmtoff=0, |
| 1601 | .tm_zone="GMT" | 1601 | .tm_zone="UTC" |
| 1602 | }, | 1602 | }, |
| 1603 | }, | 1603 | }, |
| 1604 | { | 1604 | { |
| @@ -1629,7 +1629,7 @@ struct timetest timetests[] = { | |||
| 1629 | .tm_yday=310, | 1629 | .tm_yday=310, |
| 1630 | .tm_isdst=0, | 1630 | .tm_isdst=0, |
| 1631 | .tm_gmtoff=0, | 1631 | .tm_gmtoff=0, |
| 1632 | .tm_zone="GMT" | 1632 | .tm_zone="UTC" |
| 1633 | }, | 1633 | }, |
| 1634 | }, | 1634 | }, |
| 1635 | { | 1635 | { |
| @@ -1660,7 +1660,7 @@ struct timetest timetests[] = { | |||
| 1660 | .tm_yday=310, | 1660 | .tm_yday=310, |
| 1661 | .tm_isdst=0, | 1661 | .tm_isdst=0, |
| 1662 | .tm_gmtoff=0, | 1662 | .tm_gmtoff=0, |
| 1663 | .tm_zone="GMT" | 1663 | .tm_zone="UTC" |
| 1664 | }, | 1664 | }, |
| 1665 | }, | 1665 | }, |
| 1666 | { | 1666 | { |
| @@ -1691,7 +1691,7 @@ struct timetest timetests[] = { | |||
| 1691 | .tm_yday=310, | 1691 | .tm_yday=310, |
| 1692 | .tm_isdst=0, | 1692 | .tm_isdst=0, |
| 1693 | .tm_gmtoff=0, | 1693 | .tm_gmtoff=0, |
| 1694 | .tm_zone="GMT" | 1694 | .tm_zone="UTC" |
| 1695 | }, | 1695 | }, |
| 1696 | }, | 1696 | }, |
| 1697 | { | 1697 | { |
| @@ -1722,7 +1722,7 @@ struct timetest timetests[] = { | |||
| 1722 | .tm_yday=310, | 1722 | .tm_yday=310, |
| 1723 | .tm_isdst=0, | 1723 | .tm_isdst=0, |
| 1724 | .tm_gmtoff=0, | 1724 | .tm_gmtoff=0, |
| 1725 | .tm_zone="GMT" | 1725 | .tm_zone="UTC" |
| 1726 | }, | 1726 | }, |
| 1727 | }, | 1727 | }, |
| 1728 | { | 1728 | { |
