summaryrefslogtreecommitdiffstats
path: root/tests/stdio_test.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Document a known test issue in stdio_test.cpp.Calin Juravle2014-05-151-3/+5
| | | | | Bug: 13077905 Change-Id: Iab7fc7be0737c732e26cc07ecd7884b3087b51bb
* Add tests for fprintf behavior when the underlying fd is bad.Elliott Hughes2014-05-141-0/+23
| | | | | Bug: 7229520 Change-Id: Ie878e0c13fdcda7b9131fa56208b84ed88125be7
* Add a unit test for already-fixed printf -0.0 formatting.Elliott Hughes2014-05-141-0/+7
| | | | | | | This was fixed by the upgrade to upstream head. Bug: 5084292 Change-Id: Ia3bda1c0bbe38f428e22213b8bdbdf1a16caccf2
* Consistently use #if defined(__BIONIC__) in tests.Elliott Hughes2014-05-131-7/+7
| | | | | | | | I've also switched some tests to be positive rather than negative, because !defined is slightly harder to reason about and there are only two cases: bionic and glibc. Change-Id: I8d3ac40420ca5aead3e88c69cf293f267273c8ef
* Add fpos_t tests.Calin Juravle2014-05-131-0/+127
| | | | | | Bug: 13077905 Change-Id: I86bb0ee95660f69f9971231c6f828a3a067d1ac8
* Fix use-after-free errors in stdio_test.Elliott Hughes2014-05-121-10/+6
| | | | | | | | | fclose(3) frees the passed-in FILE*. We should close(2) the underlying fd, not fclose(3) the stream, if we want to test what happens with a stream we can't read from. Bug: 14466691 Change-Id: I99fed5904b0266b9c6ae05d0b9cf2e926446c064
* Merge "Disable %n in printf and vfwprintf."Elliott Hughes2014-05-051-4/+9
|\
| * Disable %n in printf and vfwprintf.Elliott Hughes2014-05-051-4/+9
| | | | | | | | | | Bug: 14492135 Change-Id: If190bede29e5f68a65043ddbe8e878c660933d03
* | Switch to current upstream OpenBSD wsetup.c.Elliott Hughes2014-05-051-0/+42
|/ | | | Change-Id: I2c1123f3e1d3c4af7fd7bf354e763934a39b78c0
* Upgrade to current vfprintf.Elliott Hughes2014-04-171-10/+31
| | | | | | | This gets us various bug fixes and missing C99 functionality. Bug: https://code.google.com/p/android/issues/detail?id=64886 Change-Id: Ie9f8ac569e9b5eec1e4a1faacfe2c21662eaf895
* Switch to gdtoa.Elliott Hughes2014-04-161-4/+14
| | | | | | | | This gives us a real strtold for LP64 and fixes various LP64 bugs. Bug: 13563801 Change-Id: I277858d718ee746e136b6b6308a495ba50dfa488
* Extra tests for printf of NaN and Inf.Elliott Hughes2014-04-141-0/+19
| | | | Change-Id: I61fc655d9777a03aabf38f6ebd047fe275386f05
* Fix the printf issue for 64 bits. The following case:Alexander Ivchenko2014-04-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | printf("%1$s %1$s\n", "test"); would print garbage instead of the second "test". The problem is __find_arguments and the patch is a backport of two patches from OpenBSD that fix the issue: Author: tedu <tedu@cvs.openbsd.org> Date: Sat Apr 29 23:00:24 2006 +0000 check mmap for failure. the helper functions using it return -1, but callers do not yet check since printf() for example is not documented to return an error. some formatting cleanups. mostly ok deraadt millert Author: millert <millert@cvs.openbsd.org> Date: Fri May 16 14:28:54 2008 +0000 C99 says that for each va_copy() there must be a matching va_end(). Replace the non-portable hackery in __find_arguments() with a union. From FreeBSD. Change-Id: I6ea392ce6fcf4a319ae6a67ec58cc52fe7cbe534 Signed-off-by: Alexander Ivchenko <alexander.ivchenko@intel.com>
* Use the float/double assert macros.Christopher Ferris2014-03-171-1/+1
| | | | | | | | The normal ASSERT_EQ macros don't work quite right for float/double values, and result in false failures. Use the correct macros instead. Bug: 13511379 Change-Id: Ic2feee7f3d3569f57b6453b8fa95222846c625cd
* Upgrade to current upstream scanf implementation.Elliott Hughes2014-03-121-0/+11
| | | | | | Also add a basic test. Change-Id: Icc0e68a5716b9579244f6eb8bac1ab5a24eda85a
* Make sure that the same tests are on all platforms.Christopher Ferris2014-02-061-6/+8
| | | | | | | | | | | | | | | | In order to be able to generate a list of tests for cts, the same set of tests must exist across all platforms. This CL adds empty tests where a test was conditionally compiled out. This CL creates a single library libBionicTests that includes all of the tests found in bionic-unit-tests-static. Also fix a few missing include files in some test files. Tested by running and compiling the tests for every platform and verifying the same number of tests are on each platform. Change-Id: I9989d4bfebb0f9c409a0ce7e87169299eac605a2
* Don't abort in stdio.getdelim_invalid and stdio.getline_invalid.Elliott Hughes2013-12-191-0/+2
| | | | Change-Id: Ie1aefed732f4bea77887bddd1be9a0578e247aa3
* Modify tests for another glibc difference.Christopher Ferris2013-11-151-0/+6
| | | | | | | | It turns out that when passing a closed file to getdelim or getline, the functions in glibc will properly return a failure, but errno might not be set. Skip the errno check except on bionic. Change-Id: I8d625f15303d4c2d42e8d28491ea8a368aea4d32
* Fix up failing glibc tests.Christopher Ferris2013-10-291-0/+4
| | | | | | | | | | | | | | | | There is a known bug running clone with the CLONE_VM flag, so for host create an empty test. Change the expected output of the stdio test for a glibc difference. Change the pause test to use ScopedSignalHandler to setup/restore the SIGALRM handler. After this, running bionic-unit-tests-glibc passes for all tests. Bug: 11389824 Change-Id: Ib304eae4164115835a54991dfdca5821ecc3db5e
* Fix some test assumptions that are wrong for __LP64__.Elliott Hughes2013-10-181-0/+8
| | | | Change-Id: Ic79cd5858ceb611640a76bd03f3da4925d3150d9
* Fix clang warnings in bionic.Stephen Hines2013-10-111-3/+3
| | | | | | | | | | | | | | This fixes a few diverse issues that clang warns on in bionic. First, it specifies the appropriate converted types for format specifiers. The "h" and "hh" modifiers specify that the user is passing a short or char respectively. We were passing int deliberately in both cases and relying on the compiler to implicitly downcast to the smaller type. We also remove the non-standard "d" suffix from our double-precision floating point constant. This is an extension for gcc that clang does not implement. The third fix is to mark the c1 variable as unused, since it truly is neither read nor written. Change-Id: I4793352b9d3e58f1f4cac9e7581ef4b2a70b43c7
* Add a unit test for %n.Elliott Hughes2013-09-241-0/+12
| | | | Change-Id: I9335e089d66c98d34577f5e1d1a54b8f507b94f6
* Fix %hhd formats in the printf family.Elliott Hughes2013-09-231-0/+127
| | | | | | | | Found by adapting the simple unit tests for libc logging to test snprintf too. Fix taken from upstream OpenBSD without updating the rest of stdio. Change-Id: Ie339a8e9393a36080147aae4d6665118e5d93647
* Start moving to current FreeBSD stdio.Elliott Hughes2013-04-111-0/+18
| | | | | | This only touches the easy stuff. Change-Id: Iecee57f1681dba5c56bff59f0e9a89811a71f0ca
* Let bionic use the correct definition of ssize_t.Elliott Hughes2013-03-081-6/+2
| | | | | Bug: 8253769 Change-Id: I50c7cc20828fc089b83580e039ce9153a6c5a8cc
* Upgrade to current NetBSD popen/pclose.Elliott Hughes2013-03-061-0/+12
| | | | | | | | This gets us back to using vfork now our ARM vfork assembler stub is fixed, and adds the missing thread safety for the 'pidlist'. Bug: 5335385 Change-Id: Ib08bfa65b2cb9fa695717aae629ea14816bf988d
* Avoid changing the C++ ABI with ssize_t.Elliott Hughes2013-02-281-1/+8
| | | | | Bug: 8253769 Change-Id: Ia325003ed6e59da553e2bdde7c43515bc191b8ba
* use architecture-specific ssize_t definitionThorsten Glaser2013-02-191-0/+9
| | | | | | | | | | | | after change 32822 was rejected, this is the more light-weight version of the fix: libc/include/sys/types.h already - via libc/kernel/common/linux/posix_types.h - includes a definition of __kernel_ssize_t from libc/kernel/arch-*/asm/posix_types.h which is architecture-specific, toolchain-agnostic and also gets rid of the gcc -Wformat warning (which it issues correctly, since this i̲s̲ indeed a bug in bionic) Change-Id: Ie4503ab16628bc25815a836d07556f665e9795c7
* Fix __pthread_clone on ARM to set errno on failure.Elliott Hughes2013-02-111-8/+8
| | | | | | | | | | MIPS and x86 appear to have been correct already. (Also fix unit tests that ASSERT_EQ with errno so that the arguments are in the retarded junit order.) Bug: 3461078 Change-Id: I2418ea98927b56e15b4ba9cfec97f5e7094c6291
* Add getdelim(3) and getline(3) to bionicIrina Tirdea2012-09-271-0/+123
| | | | | | | | | | | | | | Some userspace programs (e.g. perf) need getline. Changes: () add getdelim.c, getline.c from NetBSD (http://netbsd.org/) under the NetBSD Foundation's (TNF) license ("2 clause" Berkeley-style license). () add stub for reentrant.h header that is needed by getdelim.c () add tests for getdelim(3) and getline(3). () update NOTICE file. Change-Id: I22ed82dd5904b9d7a3695535c04f502be3c27c5d Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
* Fix tmpfile(3).Elliott Hughes2012-09-261-0/+48
This could be better, but at least now it works. Change-Id: I88b7cf3f7ce8e5fa0b3fe678b7d1679a68ffffc9