Home | History | Annotate | only in /src/tests/lib/libc/stdio
History log of /src/tests/lib/libc/stdio
RevisionDateAuthorComments
 1.16 08-Jul-2021  christos need to set BINDIR
 1.15 08-Jul-2021  christos Add interrupted I/O tests (from RVP)
 1.14 29-Jun-2020  jruoho Use -Wl,--no-fatal-warnings for the mktemp(3) test.
 1.13 27-Jun-2020  jruoho Move the test for mktemp(3) to the right place.
 1.12 15-Oct-2014  justin PR standards/49279 add tests for open_memstream, ported from OpenBSD
 1.11 25-Apr-2013  joerg Since the mktemp test case uses mktemp, make linker warnings non-fatal.
 1.10 22-Apr-2013  christos new mktemp test
 1.9 17-Feb-2012  christos branches: 1.9.2;
add positional argument tests
 1.8 11-Sep-2011  jruoho branches: 1.8.2;
Naive tests for the naive putc(3) family.
 1.7 11-Sep-2011  jruoho Few unit tests for the fopen(3) family.
 1.6 11-Sep-2011  jruoho Couple of unit tests for fflush(3).
 1.5 08-Jul-2011  jruoho Split out 't_printf' and 't_scanf' from 't_format' to gain the common
"functional scope" for the test files.
 1.4 01-May-2011  jruoho Naive tests for clearerr(3).

Converted from the "PCCA" test suite by Stathis Kamperis.
 1.3 23-Dec-2010  pgoyette Migrate a couple more tests to aft
 1.2 19-Nov-2010  njoly Add testcase for PR/44113: printf(3) should ignore zero padding for
nan/inf.
 1.1 24-Sep-2010  tnozaki add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
 1.8.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.2.1 17-Apr-2012  yamt sync with head
 1.9.2.1 23-Jun-2013  tls resync from head
 1.6 11-Sep-2021  rillig tests/stdio: normalize whitespace
 1.5 10-Jul-2021  christos space before star
 1.4 09-Jul-2021  kre Make opts.cmd const char * rather than char * -- nothing ever modifies
the string it points to, it is never passed to a function not taking a
const char * arg, and this allows "" (or other literal strings if ever
needed) to be assigned to it - which should fix the build.
 1.3 09-Jul-2021  christos fixes from RVP
 1.2 08-Jul-2021  christos fix printf format strings
 1.1 08-Jul-2021  christos Add interrupted I/O tests (from RVP)
 1.1 08-Jul-2021  christos Add interrupted I/O tests (from RVP)
 1.2 05-Sep-2021  rillig tests/stdio: on test failure, print more details

On amd64, the test stdio_intr_iofbf fails:

stdout: numbers.in...iw.ir.ir. OK
stderr: h_testnumbers: bad line 3914889

This information is not enough to get a complete picture of the
situation, so provide more details.
 1.1 08-Jul-2021  christos Add interrupted I/O tests (from RVP)
 1.1 01-May-2011  jruoho Naive tests for clearerr(3).

Converted from the "PCCA" test suite by Stathis Kamperis.
 1.1 11-Sep-2011  jruoho Couple of unit tests for fflush(3).
 1.7 11-Sep-2021  rillig tests/stdio: normalize whitespace
 1.6 10-Jul-2021  martin Use intmax_t to printf an off_t
 1.5 10-Jul-2021  christos add more info to ease future debugging.
 1.4 19-Oct-2013  christos fix unused variable warnings
 1.3 22-Aug-2011  dholland branches: 1.3.2; 1.3.8;
Requires stdint.h.
 1.2 03-Nov-2010  christos add Makefile.inc everywhere so that we can set WARNS=4 by default. Amazing
how many bugs this found :-)
 1.1 24-Sep-2010  tnozaki add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
 1.3.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8 21-Feb-2020  kamil Avoid undefined behavior in is_module_present()

t_fopen.c:339:18, member access within misaligned address 0x7f7ff7ebd004
for type 'modstat_t' (aka 'struct modstat') which requires 8 byte alignment
 1.7 16-Jul-2019  martin PR misc/54382: whenever open(2) is called with O_CREAT, make sure to
pass an open mode argument.
 1.6 05-Feb-2019  kamil Add 2 new tests in t_fopen

Added:
- fopen_nullptr (without COMPAT_10)
- fopen_nullptr_compat10 (with COMPAT_10)

PR kern/53948

Reviewed by <mgorny>
 1.5 06-Nov-2017  kre branches: 1.5.4;
In the fopen_regular and fopen_symlink tests, when (that is, if) a
failure occurs, distinguish in the failure message the cases where the
open succeeded (and should not have), and where it failed, but not for
the expected reason (the "wrong errno" case not tested, would require
manufacturing a broken kernel...).

Add O_NOFOLLOW ('l' mode modifier) tests to the fopen_mode test case
(tests that are intended to open the file) and also add a few missing
commas which were causing a few of the sub-tests to be skipped, and
others to be not quite testing exactly what was intended.
 1.4 06-Nov-2017  christos add a symlink test
 1.3 14-Sep-2011  martin A test case may not assume opening /dev/tty does something sensible.
 1.2 12-Sep-2011  jruoho Add one more case. Also remove a double fclose(3) and do not
steal stderr(3) as atf(7) may use it in case of failures.
 1.1 11-Sep-2011  jruoho Few unit tests for the fopen(3) family.
 1.5.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.1 10-Jun-2019  christos Sync with HEAD
 1.6 08-Jul-2011  jruoho Split out 't_printf' and 't_scanf' from 't_format' to gain the common
"functional scope" for the test files.
 1.5 23-Dec-2010  pgoyette Fix the $NetBSD$ tag (missed the trailing $)
 1.4 21-Dec-2010  pgoyette Migrate a few more tests from old regress style to atf
 1.3 01-Dec-2010  pooka comment why vax is left out of all the fun
 1.2 22-Nov-2010  mrg vax doesn't have ieee fp, so, don't try to test ieee fp on vax.
 1.1 19-Nov-2010  njoly Add testcase for PR/44113: printf(3) should ignore zero padding for
nan/inf.
 1.1 11-Sep-2011  jruoho Naive tests for the naive putc(3) family.
 1.7 01-May-2024  gson Increase the estimate of disk space required for the test, as the old
estimate recently proved too optimistic on the amd64 testbed on b4.
 1.6 31-Oct-2021  gson Skip the test when there is insufficient disk space. Fixes PR misc/56324.
 1.5 09-Sep-2021  rillig tests/stdio: disable flappy test for EINTR with _IOFBF for now

This case is currently not handled correctly by fwrite/fflush, which
makes the test fail sometimes. The tests for _IONBF and _IOLBF are
pretty stable though.
 1.4 05-Sep-2021  rillig tests/stdio: use standard ATF tools for verifying the test output

In case of a test failure, this outputs a diff between the actual and
expected files.

Even with the smaller buffer size LMAX, the fully buffered test fails.
It does so after printing numbers up to 12773, which together take 65532
bytes. The next number, 12774, would cross the 65536 boundary, but
instead of that number, 12710730 was written.
 1.3 05-Sep-2021  rillig tests/stdio: wrap test command with atf_check

Previously, the test output was:

FAILED: Test case body returned a non-ok exit code, but this is
not allowed

In many cases, the test now succeeds, but in some cases it fails:

h_testnumbers: bad line "1287185
", expected 12774

h_testnumbers: bad line "6186889
", expected 6154889
 1.2 09-Jul-2021  christos fixes from RVP
 1.1 08-Jul-2021  christos Add interrupted I/O tests (from RVP)
 1.2 27-Jun-2020  jruoho Move the test for mktemp(3) to the right place.
 1.1 22-Apr-2013  christos branches: 1.1.2; 1.1.8;
new mktemp test
 1.1.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 22-Apr-2013  yamt file t_mktemp.c was added on branch yamt-pagecache on 2014-05-22 11:42:21 +0000
 1.1.2.2 23-Jun-2013  tls resync from head
 1.1.2.1 22-Apr-2013  tls file t_mktemp.c was added on branch tls-maxphys on 2013-06-23 06:28:56 +0000
 1.3 11-Sep-2021  rillig tests/stdio: normalize whitespace
 1.2 19-Oct-2014  justin Add negative offset checks to fseeko

These were not strictly needed before, as lseek would error on negative
arguments, but having added open_memstream we have a virtual file pointer
that assumes that it gets sane values, so we get an assertion triggered
on a negative value. Best to check in one place rather than at all the
relevant points.
 1.1 15-Oct-2014  justin PR standards/49279 add tests for open_memstream, ported from OpenBSD
 1.4 15-Feb-2013  christos look at my index finger
 1.3 13-Jul-2011  jruoho branches: 1.3.2; 1.3.8;
Rename few test case names. No functional change.
 1.2 11-Jun-2011  christos Turn warns on for all tests and fix all the bugs.
 1.1 23-Dec-2010  pgoyette branches: 1.1.4;
Migrate a couple more tests to aft
 1.1.4.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3.8.1 25-Feb-2013  tls resync with head
 1.3.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18 11-May-2024  riastradh tests/lib/libc/stdio/t_printf: Fix sign error in ld128 case.

Also link back to where the test case came from.
 1.17 11-May-2024  riastradh tests/lib/libc/stdio/t_printf: Fix typo in ld128 case.

printf %La does not write the `L' suffix.
 1.16 09-May-2024  riastradh tests/lib/libc/stdio/t_printf: Fix another rounding error.

Noted by kre.

This doesn't break a passing test or fix a failed test, at least on
x86 -- our printf produces `0x1.533p+3' for the double case and
`0xa.99ap+0' for the long double case. But of the hexadecimal number
literals that that start with 0x5 having three hexadigits to the
right of the fractional point, 0x5.4cdp+1 closest to the IEEE 754
binary64, VAX D, x86 extended precision, and IEEE 754 binary128
floating-point numbers closest to 10.6.

The reason is that the number 10.6 (or the nearest floating-point
number in any format with enough precision) is:

101.0100 1100 1100|1100... * 2^1 = 0x5.4cc|c...p+1

If we round at the vertical bar to the _nearest_ output with three
hexadigits of precision, the result is:

101.0100 1100 1101 * 2^1 = 0x5.4cdp+1
 1.15 09-May-2024  riastradh Revert various broken changes to printf %La (hldtoa).

This reverts:

hdtoa.c 1.12 (PR/56247: Greg A. Woods: printf("%La", LDBL_MIN) dumps core)
hdtoa.c 1.11 (fix tyop)
hdtoa.c 1.10 (Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).)

The underlying motivation for this change was that when ld128 is
decomposed into 4x32 words, this hldtoa logic is broken.

But we don't decompose ld128 into 4x32 words; we decompose it into
6x64 words.

And the change, which was supposed to be a noop in our case of 2x64
words (or similar for x87 80-bit floating-point), broke it to the
point of causing buffer overruns (PR 56247) which when worked around
led to just incorrect output output (PR 56937).

If we want to make the #ifdefs for 4x32 words work, that's fine, but
we absolutely must have automatic test cases to detect this kind of
regression because %La formatting is extremely important for
diagnosing details of floating-point data since it doesn't involve
rounding in binary formats. For now I've added some trivial tests;
there is a more extensive test suite inside gdtoa that we need to
wire up before anyone tries any other shenanigans in this code.

PR lib/56937: printf(3) long double %a formatting is broken
 1.14 08-May-2024  riastradh tests/lib/libc/stdio/t_printf: Add another %La test.

This one was adapted from the screw case shown in

https://mail-index.netbsd.org/tech-userlevel/2020/04/11/msg012329.html

which wasn't broken in our libc, but which nevertheless prompted us
to commit a wrong and apparently untested patch that has rendered
printf %La broken for the last four years, which is a little
embarrassing. (The part of that patch that led to a buffer overrun
has been worked around, so now the output is just incorrect.)

PR lib/56937: printf(3) long double %a formatting is broken
 1.13 08-May-2024  riastradh tests/lib/libc/stdio/t_printf: Fix %a test the same way.
 1.12 08-May-2024  riastradh tests/lib/libc/stdio/t_printf: Fix %La test.

0xa.99ap+0 is closer to (long double)10.6 in x86 ld80 and in
binary128 (and possibly more formats, haven't verified).
 1.11 08-May-2024  riastradh tests/lib/libc/stdio/t_printf: Add a couple simple %La tests.

PR lib/56937: printf(3) long double %a formatting is broken
 1.10 04-Apr-2023  he Fix the test for "inf" output, also include newline in printf format...
 1.9 04-Apr-2023  christos Add a test for PR/57250 from Havard Eidnes
 1.8 11-Apr-2012  jruoho branches: 1.8.34; 1.8.42;
Reduce the number of snprintf(3) invocations, as sparc/qemu timeouts.
 1.7 18-Mar-2012  jruoho Verify that PR lib/22019 is no longer an issue.
 1.6 18-Mar-2012  jruoho Move the references to PRs from code comments to the test description. Once
ATF has the ability to output the metadata in the HTML reports, it should be
easy to traverse between releng and gnats -reports via links.
 1.5 15-Mar-2012  joerg Fix format strings to properly quote %.
 1.4 26-Feb-2012  christos add a test to verify that snprintf float does not leak.
 1.3 17-Feb-2012  christos add positional argument tests
 1.2 13-Jul-2011  jruoho branches: 1.2.2; 1.2.4;
Rename few test case names. No functional change.
 1.1 08-Jul-2011  jruoho Split out 't_printf' and 't_scanf' from 't_format' to gain the common
"functional scope" for the test files.
 1.2.4.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by joerg in ticket #119):
tests/lib/libc/stdio/t_printf.c: revision 1.5
tests/lib/libc/stdio/t_scanf.c: revision 1.2
tests/lib/libc/gen/t_humanize_number.c: revision 1.6
Mark w_printf as __printflike and fix a format string error.
Fix format strings to properly quote %.
 1.2.2.1 17-Apr-2012  yamt sync with head
 1.8.42.2 22-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #787):

tests/lib/libc/stdio/t_printf.c: revision 1.17
tests/lib/libc/stdio/t_printf.c: revision 1.18
lib/libc/gdtoa/hdtoa.c: revision 1.13
tests/lib/libc/stdio/t_printf.c: revision 1.11
tests/lib/libc/stdio/t_printf.c: revision 1.12
tests/lib/libc/stdio/t_printf.c: revision 1.13
tests/lib/libc/stdio/t_printf.c: revision 1.14
tests/lib/libc/stdio/t_printf.c: revision 1.15
tests/lib/libc/stdio/t_printf.c: revision 1.16

tests/lib/libc/stdio/t_printf: Add a couple simple %La tests.

PR lib/56937: printf(3) long double %a formatting is broken
tests/lib/libc/stdio/t_printf: Fix %La test.
0xa.99ap+0 is closer to (long double)10.6 in x86 ld80 and in
binary128 (and possibly more formats, haven't verified).
tests/lib/libc/stdio/t_printf: Fix %a test the same way.
tests/lib/libc/stdio/t_printf: Add another %La test.

This one was adapted from the screw case shown in
https://mail-index.netbsd.org/tech-userlevel/2020/04/11/msg012329.html
which wasn't broken in our libc, but which nevertheless prompted us
to commit a wrong and apparently untested patch that has rendered
printf %La broken for the last four years, which is a little
embarrassing. (The part of that patch that led to a buffer overrun
has been worked around, so now the output is just incorrect.)

PR lib/56937: printf(3) long double %a formatting is broken

Revert various broken changes to printf %La (hldtoa).
This reverts:
hdtoa.c 1.12 (PR/56247: Greg A. Woods: printf("%La", LDBL_MIN) dumps core)
hdtoa.c 1.11 (fix tyop)
hdtoa.c 1.10 (Via enh at google dot com in tech-userlevel. Fix handling of
EXT_FRAC{H,L}BITS (although we don't need to since we don't have them).)

The underlying motivation for this change was that when ld128 is
decomposed into 4x32 words, this hldtoa logic is broken.

But we don't decompose ld128 into 4x32 words; we decompose it into
6x64 words.

And the change, which was supposed to be a noop in our case of 2x64
words (or similar for x87 80-bit floating-point), broke it to the
point of causing buffer overruns (PR 56247) which when worked around
led to just incorrect output output (PR 56937).
If we want to make the #ifdefs for 4x32 words work, that's fine, but
we absolutely must have automatic test cases to detect this kind of
regression because %La formatting is extremely important for
diagnosing details of floating-point data since it doesn't involve
rounding in binary formats. For now I've added some trivial tests;
there is a more extensive test suite inside gdtoa that we need to
wire up before anyone tries any other shenanigans in this code.

PR lib/56937: printf(3) long double %a formatting is broken
tests/lib/libc/stdio/t_printf: Fix another rounding error.
Noted by kre.

This doesn't break a passing test or fix a failed test, at least on
x86 -- our printf produces `0x1.533p+3' for the double case and
`0xa.99ap+0' for the long double case. But of the hexadecimal number
literals that that start with 0x5 having three hexadigits to the
right of the fractional point, 0x5.4cdp+1 closest to the IEEE 754
binary64, VAX D, x86 extended precision, and IEEE 754 binary128
floating-point numbers closest to 10.6.

The reason is that the number 10.6 (or the nearest floating-point
number in any format with enough precision) is:
101.0100 1100 1100|1100... * 2^1 = 0x5.4cc|c...p+1
If we round at the vertical bar to the _nearest_ output with three
hexadigits of precision, the result is:
101.0100 1100 1101 * 2^1 = 0x5.4cdp+1
tests/lib/libc/stdio/t_printf: Fix typo in ld128 case.
printf %La does not write the `L' suffix.
tests/lib/libc/stdio/t_printf: Fix sign error in ld128 case.

Also link back to where the test case came from.
 1.8.42.1 17-Apr-2023  martin Pull up following revision(s) (requested by he in ticket #138):

tests/lib/libc/stdio/t_printf.c: revision 1.9
tests/lib/libc/stdio/t_printf.c: revision 1.10

Add a test for PR/57250 from Havard Eidnes

Fix the test for "inf" output, also include newline in printf format...
 1.8.34.2 22-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1866):

tests/lib/libc/stdio/t_printf.c: revision 1.17
tests/lib/libc/stdio/t_printf.c: revision 1.18
tests/lib/libc/stdio/t_printf.c: revision 1.11
tests/lib/libc/stdio/t_printf.c: revision 1.12
tests/lib/libc/stdio/t_printf.c: revision 1.13
tests/lib/libc/stdio/t_printf.c: revision 1.14
tests/lib/libc/stdio/t_printf.c: revision 1.15
tests/lib/libc/stdio/t_printf.c: revision 1.16
(all via patch)

tests/lib/libc/stdio/t_printf: Add a couple simple %La tests.

PR lib/56937: printf(3) long double %a formatting is broken
tests/lib/libc/stdio/t_printf: Fix %La test.
0xa.99ap+0 is closer to (long double)10.6 in x86 ld80 and in
binary128 (and possibly more formats, haven't verified).
tests/lib/libc/stdio/t_printf: Fix %a test the same way.
tests/lib/libc/stdio/t_printf: Add another %La test.

This one was adapted from the screw case shown in
https://mail-index.netbsd.org/tech-userlevel/2020/04/11/msg012329.html
which wasn't broken in our libc, but which nevertheless prompted us
to commit a wrong and apparently untested patch that has rendered
printf %La broken for the last four years, which is a little
embarrassing. (The part of that patch that led to a buffer overrun
has been worked around, so now the output is just incorrect.)

PR lib/56937: printf(3) long double %a formatting is broken
tests/lib/libc/stdio/t_printf: Fix another rounding error.
Noted by kre.

This doesn't break a passing test or fix a failed test, at least on
x86 -- our printf produces `0x1.533p+3' for the double case and
`0xa.99ap+0' for the long double case. But of the hexadecimal number
literals that that start with 0x5 having three hexadigits to the
right of the fractional point, 0x5.4cdp+1 closest to the IEEE 754
binary64, VAX D, x86 extended precision, and IEEE 754 binary128
floating-point numbers closest to 10.6.

The reason is that the number 10.6 (or the nearest floating-point
number in any format with enough precision) is:
101.0100 1100 1100|1100... * 2^1 = 0x5.4cc|c...p+1

If we round at the vertical bar to the _nearest_ output with three
hexadigits of precision, the result is:
101.0100 1100 1101 * 2^1 = 0x5.4cdp+1

tests/lib/libc/stdio/t_printf: Fix typo in ld128 case.
printf %La does not write the `L' suffix.

tests/lib/libc/stdio/t_printf: Fix sign error in ld128 case.
Also link back to where the test case came from.
 1.8.34.1 22-Aug-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1865):

lib/libc/stdio/Makefile.inc: revision 1.48
tests/lib/libc/stdio/t_printf.c: revision 1.9
lib/libc/stdio/vfwprintf.c: revision 1.40
lib/libc/include/extern.h: revision 1.27
tests/lib/libc/stdio/t_printf.c: revision 1.10

PR/57250: Martin Husemann: dtoa mishandles infinite doubles on 32bit big
endian machines. When long double support was added, the old code was kept
for the regular double code. This code was never used because WIDE_DOUBLE
was always defined in the Makefile. Remove that old code, and conditionalize
the WIDE_DOUBLE code based on if long doubles are different than doubles on
the specific platform.

Add a test for PR/57250 from Havard Eidnes

Fix the test for "inf" output, also include newline in printf format...
 1.4 11-Sep-2021  rillig tests/stdio: normalize whitespace
 1.3 18-Mar-2012  jruoho Move the references to PRs from code comments to the test description. Once
ATF has the ability to output the metadata in the HTML reports, it should be
easy to traverse between releng and gnats -reports via links.
 1.2 15-Mar-2012  joerg Fix format strings to properly quote %.
 1.1 08-Jul-2011  jruoho branches: 1.1.2; 1.1.4;
Split out 't_printf' and 't_scanf' from 't_format' to gain the common
"functional scope" for the test files.
 1.1.4.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by joerg in ticket #119):
tests/lib/libc/stdio/t_printf.c: revision 1.5
tests/lib/libc/stdio/t_scanf.c: revision 1.2
tests/lib/libc/gen/t_humanize_number.c: revision 1.6
Mark w_printf as __printflike and fix a format string error.
Fix format strings to properly quote %.
 1.1.2.1 17-Apr-2012  yamt sync with head

RSS XML Feed