summaryrefslogtreecommitdiffstats
path: root/libcxx/test/std/localization
Commit message (Collapse)AuthorAgeFilesLines
* [libcxx] [test] Include missing headers. (NFC)Stephan T. Lavavej2019-12-139-0/+9
| | | | | | | | libcxx/test/std/containers/sequences/array/at.pass.cpp Need to include <stdexcept> for std::out_of_range. libcxx/test/std/localization/locale.categories/category.time/* Need to include <ios> for std::ios.
* libcxx: Rename .hpp files in libcxx/test/support to .hNico Weber2019-08-2114-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | LLVM uses .h as its extension for header files. Files renamed using: for f in libcxx/test/support/*.hpp; do git mv $f ${f%.hpp}.h; done References to the files updated using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do a=$(basename $f); echo $a; rg -l $a libcxx | xargs sed -i '' "s/$a/${a%.hpp}.h/"; done HPP include guards updated manually using: for f in $(git diff master | grep 'rename from' | cut -f 3 -d ' '); do echo ${f%.hpp}.h ; done | xargs mvim Differential Revision: https://reviews.llvm.org/D66104 llvm-svn: 369481
* [libcxx] Add XFAIL for facet test when back-deploying to older macOSLouis Dionne2019-06-141-0/+10
| | | | llvm-svn: 363405
* No longer reject inputs when using a locale that has grouping information ↵Marshall Clow2019-06-041-2/+2
| | | | | | _and_ the input has no grouping characters at all. We continue to reject cases when the input has grouping characters in the wrong place. Fixes PR#28704 llvm-svn: 362508
* Add include for 'test_macros.h' to all the tests that were missing them. ↵Marshall Clow2019-05-31264-0/+435
| | | | | | Thanks to Zoe for the (big, but simple) patch. NFC intended. llvm-svn: 362252
* [libc++][test] Update some wstring_convert tests for MSVC quirksCasey Carter2019-04-223-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to MSVC's decision to encode `wchar_t` as UTF-16, it rejects wide character/string literals that expect a character value greater than `\xffff`. UTF-16 `wchar_t` is clearly non-conforming, given that the standard requires wchar_t to be capable of representing all characters in the supported wide character execution sets, but rejecting e.g. `\x40003` is a reasonably sane compromise given that encoding choice: there's an expectation that `\xFOO` produces a single character in the resulting literal. Consequently `L'\x40003'`/`L"\x40003"` are ill-formed literals on MSVC. `L'\U00040003'` is a high surrogate (and produces a warning about ignoring the "second character" in a multi-character literal), and `L"\U00040003"` is a perfectly-valid `const wchar_t[3]`. This change updates these tests to use universal-character-names instead of raw values for the intended character values, which technically makes them portable even to implementations that don't use a unicode transformation format encoding for their wide character execution character set. The two-character literal `L"\u1005e"` is awkward - the `e` looks like part of the UCN's hex encoding - but necessary to compile in '03 mode since '03 didn't allow UCNs to be used for members of the basic execution character set even in character/string literals. I've also eliminated the extraneous `\x00` "bonus null-terminator" in some of the string literals which doesn't affect the tested behavior. I'm sorry about using `*L"\U00040003"` in `conversions.string/to_bytes.pass.cpp`, but it's correct for platforms with 32-bit wchar_t, *and* doesn't trigger narrowing warnings as did the prior `CharT(0x40003)`. Differential Revision: https://reviews.llvm.org/D60950 llvm-svn: 358908
* [libc++] Remove unnecessary <iostream> #includes in testsLouis Dionne2019-03-282-2/+0
| | | | | | | Some tests #include <iostream> but they don't use anything from the header. Those are probably artifacts of when the tests were developped. llvm-svn: 357181
* Support tests in freestandingJF Bastien2019-02-04308-308/+924
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Freestanding is *weird*. The standard allows it to differ in a bunch of odd manners from regular C++, and the committee would like to improve that situation. I'd like to make libc++ behave better with what freestanding should be, so that it can be a tool we use in improving the standard. To do that we need to try stuff out, both with "freestanding the language mode" and "freestanding the library subset". Let's start with the super basic: run the libc++ tests in freestanding, using clang as the compiler, and see what works. The easiest hack to do this: In utils/libcxx/test/config.py add: self.cxx.compile_flags += ['-ffreestanding'] Run the tests and they all fail. Why? Because in freestanding `main` isn't special. This "not special" property has two effects: main doesn't get mangled, and main isn't allowed to omit its `return` statement. The first means main gets mangled and the linker can't create a valid executable for us to test. The second means we spew out warnings (ew) and the compiler doesn't insert the `return` we omitted, and main just falls of the end and does whatever undefined behavior (if you're luck, ud2 leading to non-zero return code). Let's start my work with the basics. This patch changes all libc++ tests to declare `main` as `int main(int, char**` so it mangles consistently (enabling us to declare another `extern "C"` main for freestanding which calls the mangled one), and adds `return 0;` to all places where it was missing. This touches 6124 files, and I apologize. The former was done with The Magic Of Sed. The later was done with a (not quite correct but decent) clang tool: https://gist.github.com/jfbastien/793819ff360baa845483dde81170feed This works for most tests, though I did have to adjust a few places when e.g. the test runs with `-x c`, macros are used for main (such as for the filesystem tests), etc. Once this is in we can create a freestanding bot which will prevent further regressions. After that, we can start the real work of supporting C++ freestanding fairly well in libc++. <rdar://problem/47754795> Reviewers: ldionne, mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, arphaman, miyuki, libcxx-commits Differential Revision: https://reviews.llvm.org/D57624 llvm-svn: 353086
* [libc++] Use runtime rather then compile-time glibc version checkPetr Hosek2019-01-281-10/+24
| | | | | | | | | | | | | | | glibc supports versioning, so it's possible to build against older version and run against newer version. This is sometimes relied on in practice, e.g. in Fuchsia build we build against older sysroot (equivalent to Ubuntu Trusty) to cover the broadest possible range of host systems, but that doesn't necessarily match the system that binary is going to run on which may have newer version, in which case the compile test used in curr_symbol is going to fail. Using runtime check is more reliable. Differential Revision: https://reviews.llvm.org/D56702 llvm-svn: 352425
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-19308-1232/+924
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* [NFC] Normalize some test 'main' signaturesJF Bastien2019-01-092-2/+2
| | | | | | There were 3 tests with 'int main(void)', and 6 with the return type on a different line. I'm about to send a patch for main in tests, and this NFC change is unrelated. llvm-svn: 350770
* Portability fix: add missing includes and static_casts. Reviewed as ↵Marshall Clow2018-12-183-4/+8
| | | | | | https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch. llvm-svn: 349566
* [test] Add target_info for NetBSD, and XFAIL some of locale testsMichal Gorny2018-12-1720-0/+60
| | | | | | | | | | | | | | | | | | | | Add a target_info definition for NetBSD. The definition is based on the one used by FreeBSD, with libcxxrt replaced by libc++abi, and using llvm-libunwind since we need to use its unwinder implementation to build anyway. Additionally, XFAIL the 30 tests that fail because of non-implemented locale features. According to the manual, NetBSD implements only LC_CTYPE part of locale handling. However, there is a locale database in the system and locale specifications are validated against it, so it makes sense to list the common locales as supported. If I'm counting correctly, this change enables additional 43 passing tests. Differential Revision: https://reviews.llvm.org/D55767 llvm-svn: 349379
* [libcxx] Remove the availability_markup LIT featureLouis Dionne2018-12-073-6/+6
| | | | | | | It is now equivalent to the 'availability' LIT feature, so there's no reason to keep both. llvm-svn: 348653
* [libcxx] [test] Use TEST_IGNORE_NODISCARD.Stephan T. Lavavej2018-04-131-3/+3
| | | | | | Fixes D45595. llvm-svn: 329979
* [libcxx] [test] Use TEST_COMPILER_C1XX.Stephan T. Lavavej2018-04-121-1/+2
| | | | | | Also TEST_COMPILER_CLANG in one place. (More could be changed.) llvm-svn: 329977
* [libcxx] [test] Silence MSVC warning C4146.Stephan T. Lavavej2018-04-121-0/+4
| | | | | | | | | | | | | This test code triggers the MSVC warning: "unary minus operator applied to unsigned type, result still unsigned" Although it would be possible to change the test code to avoid this warning, I have chosen to simply silence it. Fixes D45594. llvm-svn: 329976
* [libcxx] [test] Fix nodiscard warnings.Stephan T. Lavavej2018-04-121-3/+3
| | | | | | | | MSVC's STL has marked to_bytes/from_bytes as nodiscard. Fixes D45595. llvm-svn: 329975
* Fix undefined macro issue in locale tests; Try 2Eric Fiselier2018-04-043-9/+15
| | | | llvm-svn: 329149
* Fix undefined macro issue in locale testsEric Fiselier2018-04-042-1/+7
| | | | llvm-svn: 329148
* Fix locale test data for GLIBC 2.27 and newer.Eric Fiselier2018-04-045-38/+100
| | | | | | | | GLIBC 2.27 changed the locale data for fr_FR and ru_RU. In particular they change the decimal and thousands separators used. This patch makes the locale tests tolerate the updated locales. llvm-svn: 329143
* Fix PR36914 - num_get::get(unsigned) incorrectly handles negative numbers.Eric Fiselier2018-03-292-10/+172
| | | | | | | | | This patch corrects num_get for unsigned types to support strings with a leading `-` character. According to the standard the number should be parsed as an unsigned integer and then negated. llvm-svn: 328751
* Add temporary printouts to test to help debug failures.Eric Fiselier2018-03-222-0/+12
| | | | | | | | | | | Some debian libc++ bots started having failures in the locale tests due to what I assume is a change in the locale data for fr_FR in glibc. This change prints the actual value from the test to help debugging. It should be reverted once the bots cycle. llvm-svn: 328268
* Make the ctype_byname::widen test cases pass on FreeBSD.Dimitry Andric2018-02-132-2/+2
| | | | llvm-svn: 325028
* [libcxx] [test] Fix line endings, avoid unnecessary non-ASCII.Stephan T. Lavavej2017-12-131-14/+14
| | | | | | | | | | | | | | | benchmarks/util_smartptr.bench.cpp Change CRLF to LF. test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_fr_FR.pass.cpp Consistently comment "\u20ac" as EURO SIGN, its Unicode name, instead of the actual Unicode character. test/std/utilities/allocator.adaptor/allocator.adaptor.members/construct_type.pass.cpp Avoid non-ASCII dash. Fixes D40991. llvm-svn: 320536
* [libcxx] [test] Rename _Tp to T. NFCI.Stephan T. Lavavej2017-08-113-6/+6
| | | | | | | This improves readability and (theoretically) improves portability, as _Ugly names are reserved. llvm-svn: 310758
* [libcxx] [test] Fix MSVC warning C4067 "unexpected tokens following ↵Stephan T. Lavavej2017-07-191-2/+8
| | | | | | | | | | preprocessor directive - expected a newline". Also fixes Clang/LLVM 4.0 (for Windows) error "function-like macro 'TEST_GLIBC_PREREQ' is not defined". Fixes D34535. llvm-svn: 308533
* [libcxx] [test] Update locale names for Windows.Stephan T. Lavavej2017-06-081-4/+6
| | | | | | | | | | | | | | | | | locale.codecvt.byname/ctor_char.pass.cpp: This test used to use "en_US" as a plain string instead of using platform_support. Need to fix this because MS STL expects "en-US" instead. platform_support.h: These are the legacy Windows locale names. Should use IETF tags instead. I've also added en_US, since a test was using that as a locale string as well. msvc_stdlib_force_include.hpp: Remove _MSVC_STL_VER. The libraries will directly define _MSVC_STL_VERSION in the future. Fixes D29351. llvm-svn: 305000
* Fix C++03 test failures caused by static_assert emulationEric Fiselier2017-05-123-6/+6
| | | | llvm-svn: 302871
* Cleanup test issues reported by STL @ Microsoft.Eric Fiselier2017-05-127-1454/+1211
| | | | | | | | | | | This patch cleans up a number of issues reported by STL, including: 1) Fix duplicate is_convertible test. 2) Move non-standard reference_wrapper tests under test/libcxx 3) Fix assumption that sizeof(wchar_t) == 32 in the codecvt and wstring_convert tests. llvm-svn: 302870
* Add markup for libc++ dylib availabilityMehdi Amini2017-05-0415-22/+56
| | | | | | | | | | | | | | | Libc++ is used as a system library on macOS and iOS (amongst others). In order for users to be able to compile a binary that is intended to be deployed to an older version of the platform, clang provides the availability attribute <https://clang.llvm.org/docs/AttributeReference.html#availability>_ that can be placed on declarations to describe the lifecycle of a symbol in the library. See docs/DesignDocs/AvailabilityMarkup.rst for more information. Differential Revision: https://reviews.llvm.org/D31739 llvm-svn: 302172
* Add deployment knobs to tests (for Apple platforms)Mehdi Amini2017-03-158-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests for libc++ specify -target on the command-line to the compiler, but this is problematic for a few reasons. Firstly, the -target option isn't supported on Apple platforms. Parts of the triple get dropped and ignored. Instead, software should be compiled with a combination of the -arch and -m<name>-version-min options. Secondly, the generic "darwin" target references a kernel version instead of a platform version. Each platform has its own independent versions (with different versions of libc++.1.dylib), independent of the version of the Darwin kernel. This commit adds support to the LIT infrastructure for testing against Apple platforms using -arch and -platform options. If the host is not on OS X, or the compiler type is not clang or apple-clang, then this commit has NFC. If the host is on OS X and --param=target_triple=... is specified, then a warning is emitted to use arch and platform instead. Besides the warning, there's NFC. If the host is on OS X and *no* target-triple is specified, then use the new deployment target logic. This uses two new lit parameters, --param=arch=<arch> and --param=platform=<platform>. <platform> has the form <name>[<version>]. By default, arch is auto-detected from clang -dumpmachine, and platform is "macosx". If the platform doesn't have a version: For "macosx", the version is auto-detected from the host system using sw_vers. This may give a different version than the SDK, since new SDKs can be installed on older hosts. Otherwise, the version is auto-detected from the SDK version using xcrun --show-sdk-path. -arch <arch> -m<name>-version-min=<version> is added to the compiler flags. The target triple is computed as <arch>-apple-<platform>. It is *not* passed to clang, but it is available for XFAIL and UNSUPPORTED (as is with_system_cxx_lib=<target>). For convenience, apple-darwin and <arch>-apple-darwin are added to the set of available features. There were a number of tests marked to XFAIL on x86_64-apple-darwin11 and x86_64-apple-darwin12. I updated these to x86_64-apple-macosx10.7 and x86_64-apple-macosx10.8. llvm-svn: 297798
* test: use char32_t rather than wchar_tSaleem Abdulrasool2017-02-122-29/+29
| | | | | | | | | wchar_t is not as portable as char32_t. On Windows, wchar_t is 16-bytes and on Linux 32-bits. The conversion to utf8 causes the characters to exceed the limits on char16_t, resulting in tautological comparisons. llvm-svn: 294917
* Avoid implementation defined behavior in a test.Dan Albert2017-02-021-1/+7
| | | | | | | | | | | | | | | | | Summary: num_put::put uses %p for pointer types, but the exact format of %p is implementation defined behavior for the C library. Compare output to snprintf for portability. Reviewers: EricWF, mclow.lists Reviewed By: EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D29197 llvm-svn: 293926
* [libcxx] [test] Fix comment typos, strip trailing whitespace.Stephan T. Lavavej2017-01-183-3/+3
| | | | | | No functional change, no code review. llvm-svn: 292434
* Get ctype_byname tests passing on Linux.Eric Fiselier2016-12-306-75/+96
| | | | llvm-svn: 290746
* fix warnings only produced by apple-clangEric Fiselier2016-12-241-7/+7
| | | | llvm-svn: 290474
* Fix unused parameters and variablesEric Fiselier2016-12-234-4/+4
| | | | llvm-svn: 290459
* Enable the -Wsign-compare warning to better support MSVCEric Fiselier2016-12-113-3/+4
| | | | llvm-svn: 289363
* [libc++] Fix support for multibyte thousands_sep and decimal_point in ↵Eric Fiselier2016-12-114-28/+49
| | | | | | | | | | | | | | | | | | moneypunct_byname and numpunct_byname. Summary: The underlying C locales provide the `thousands_sep` and `decimal_point` as strings, possible with more than one character. We currently don't handle this case even for `wchar_t`. This patch properly converts the mbs -> wide character for `moneypunct_byname<wchar_t>`. For the `moneypunct_byname<char>` case we attempt to narrow the WC and if that fails we also attempt to translate it to some reasonable value. For example we translate U00A0 (non-breaking space) into U0020 (regular space). If none of these conversions succeed then we simply allow the base class to provide a fallback value. Reviewers: mclow.lists, EricWF Subscribers: vangyzen, george.burgess.iv, cfe-commits Differential Revision: https://reviews.llvm.org/D24218 llvm-svn: 289347
* [libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", ↵Stephan T. Lavavej2016-12-062-9/+11
| | | | | | | | | | part 9/12. Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. llvm-svn: 288746
* Protect locale tests under noexceptionsRoger Ferrer Ibanez2016-11-294-4/+16
| | | | | | | | Skip tests that expect exceptions be thrown. Differential Revision: https://reviews.llvm.org/D27096 llvm-svn: 288156
* [libcxx] [test] D27026: Fix copy-paste silliness; ULL can't ever be 32-bit.Stephan T. Lavavej2016-11-231-1/+1
| | | | llvm-svn: 287828
* [libcxx] [test] D27019: Fix MSVC warning C4245 "conversion from 'X' to 'Y', ↵Stephan T. Lavavej2016-11-236-14/+14
| | | | | | | | signed/unsigned mismatch", part 6/12. Add static_cast when initializing unsigned integers with negative numbers (in order to obtain big values). llvm-svn: 287826
* [libcxx] [test] D26314: Fix MSVC warning C4189 "local variable is ↵Stephan T. Lavavej2016-11-1410-54/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialized but not referenced". test/std/depr/depr.c.headers/inttypes_h.pass.cpp test/std/input.output/file.streams/c.files/cinttypes.pass.cpp test/std/input.output/iostream.forward/iosfwd.pass.cpp Add test() to avoid a bunch of void-casts, although we still need a few. test/std/input.output/iostream.format/quoted.manip/quoted.pass.cpp skippingws was unused (it's unclear to me whether this was mistakenly copy-pasted from round_trip() below). test/std/localization/locale.categories/category.collate/locale.collate/types.pass.cpp test/std/localization/locale.categories/category.ctype/facet.ctype.special/types.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_char.pass.cpp test/std/localization/locale.categories/category.ctype/locale.codecvt/types_wchar_t.pass.cpp test/std/localization/locale.categories/category.ctype/locale.ctype/types.pass.cpp test/std/localization/locale.categories/facet.numpunct/locale.numpunct/types.pass.cpp test/std/localization/locales/locale.global.templates/use_facet.pass.cpp When retrieving facets, the references are unused. test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_long.pass.cpp test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_unsigned_long.pass.cpp "std::ios_base::iostate err = ios.goodbit;" was completely unused here. test/std/localization/locale.categories/category.time/locale.time.get/time_base.pass.cpp test/std/numerics/c.math/ctgmath.pass.cpp test/std/numerics/rand/rand.device/entropy.pass.cpp test/std/numerics/rand/rand.device/eval.pass.cpp test/std/strings/basic.string/string.modifiers/string_copy/copy.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eof.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eof.pass.cpp test/std/thread/futures/futures.promise/dtor.pass.cpp test/std/thread/futures/futures.task/futures.task.members/dtor.pass.cpp test/std/thread/thread.condition/thread.condition.condvar/wait_for_pred.pass.cpp These variables are verifying types but are otherwise unused. test/std/strings/basic.string/string.capacity/reserve.pass.cpp old_cap was unused (it's unclear to me whether it was intended to be used). test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char16_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.char32_t/lt.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/eq.pass.cpp test/std/strings/char.traits/char.traits.specializations/char.traits.specializations.wchar.t/lt.pass.cpp These tests contained unused characters. llvm-svn: 286847
* [libcxx] [test] Replace _LIBCPP_STD_VER with TEST_STD_VER.Stephan T. Lavavej2016-11-043-3/+8
| | | | | | | | | | | This replaces every occurrence of _LIBCPP_STD_VER in the tests with TEST_STD_VER. Additionally, for every affected file, #include "test_macros.h" is being added explicitly if it wasn't already there. https://reviews.llvm.org/D26294 llvm-svn: 286007
* Apply curr_symbol.pass.cpp test fix to missed test caseEric Fiselier2016-09-041-1/+6
| | | | llvm-svn: 280612
* Fix bad locale test data when using the newest glibcEric Fiselier2016-09-041-0/+8
| | | | llvm-svn: 280608
* Remove locale tests that depend on enviroment variables.Eric Fiselier2016-07-181-17/+0
| | | | | | | | | | | | | | Constructing a std::locale object from an empty string selects the language from the current environment variables. If the environment variables name a locale that doesn't exist, or isn't installed, then the construction of facets using that locale may throw. This patch removes tests that use 'std::locale l("")'. The optimal solution would be to manually set the environment variables in the test. Unfortunately there is no portable way to do this. llvm-svn: 275772
* Add checkpoint diagnostics to help diagnose buildbot failures.Eric Fiselier2016-07-181-0/+4
| | | | llvm-svn: 275754
OpenPOWER on IntegriCloud