diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-05-12 01:44:51 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-05-12 01:44:51 +0000 |
commit | 5750a3fa20614580c7c726817b87022f5c5ac18a (patch) | |
tree | 8b90f4eaec266453778c5b533be413bb3c0ec40c /libcxx/test/std | |
parent | 71086a87b1f464f11ab7c45b4964a95097ab29b8 (diff) | |
download | bcm5719-llvm-5750a3fa20614580c7c726817b87022f5c5ac18a.tar.gz bcm5719-llvm-5750a3fa20614580c7c726817b87022f5c5ac18a.zip |
Fix or move tests with non-standard assumptions
llvm-svn: 302862
Diffstat (limited to 'libcxx/test/std')
4 files changed, 42 insertions, 131 deletions
diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp deleted file mode 100644 index 891b084dd32..00000000000 --- a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp +++ /dev/null @@ -1,70 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// UNSUPPORTED: libcpp-has-no-threads - -// This test uses the POSIX header <sys/time.h> which Windows doesn't provide -// UNSUPPORTED: windows - -// This test depends on signal behaviour until r210210, so some system libs -// don't pass. -// -// XFAIL: with_system_cxx_lib=macosx10.11 -// XFAIL: with_system_cxx_lib=macosx10.10 -// XFAIL: with_system_cxx_lib=macosx10.9 -// XFAIL: with_system_cxx_lib=macosx10.8 -// XFAIL: with_system_cxx_lib=macosx10.7 - -// <thread> - -// template <class Rep, class Period> -// void sleep_for(const chrono::duration<Rep, Period>& rel_time); - -#include <thread> -#include <cstdlib> -#include <cassert> -#include <cstring> -#include <signal.h> -#include <sys/time.h> - -void sig_action(int) {} - -#include <iostream> -int main() -{ - int ec; - struct sigaction action; - action.sa_handler = &sig_action; - sigemptyset(&action.sa_mask); - action.sa_flags = 0; - - ec = sigaction(SIGALRM, &action, nullptr); - assert(!ec); - - struct itimerval it; - std::memset(&it, 0, sizeof(itimerval)); - it.it_value.tv_sec = 0; - it.it_value.tv_usec = 250000; - // This will result in a SIGALRM getting fired resulting in the nanosleep - // inside sleep_for getting EINTR. - ec = setitimer(ITIMER_REAL, &it, nullptr); - assert(!ec); - - typedef std::chrono::system_clock Clock; - typedef Clock::time_point time_point; - typedef Clock::duration duration; - std::chrono::milliseconds ms(500); - time_point t0 = Clock::now(); - std::this_thread::sleep_for(ms); - time_point t1 = Clock::now(); - std::chrono::nanoseconds ns = (t1 - t0) - ms; - std::chrono::nanoseconds err = 5 * ms / 100; - // The time slept is within 5% of 500ms - assert(std::abs(ns.count()) < err.count()); -} diff --git a/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp new file mode 100644 index 00000000000..3406fff7061 --- /dev/null +++ b/libcxx/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp @@ -0,0 +1,22 @@ +// -*- C++ -*- +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// <thread> + +// template <class Rep, class Period> +// void sleep_for(const chrono::duration<Rep, Period>& rel_time); + +// The std::this_thread::sleep_for test requires POSIX specific headers and +// is therefore non-standard. For this reason the test lives under the 'libcxx' +// subdirectory. + +int main() +{ +} diff --git a/libcxx/test/std/utilities/template.bitset/includes.pass.cpp b/libcxx/test/std/utilities/template.bitset/includes.pass.cpp index 2e3c2812e44..e640a1b5b7e 100644 --- a/libcxx/test/std/utilities/template.bitset/includes.pass.cpp +++ b/libcxx/test/std/utilities/template.bitset/includes.pass.cpp @@ -11,22 +11,27 @@ #include <bitset> -#ifndef _LIBCPP_CSTDDEF -#error <cstddef> has not been included -#endif - -#ifndef _LIBCPP_STRING -#error <string> has not been included -#endif - -#ifndef _LIBCPP_STDEXCEPT -#error <stdexcept> has not been included -#endif - -#ifndef _LIBCPP_IOSFWD -#error <iosfwd> has not been included -#endif +template <class> void test_typedef() {} int main() { + { // test for <cstddef> + std::ptrdiff_t p; ((void)p); + std::size_t s; ((void)s); + std::nullptr_t np; ((void)np); + } + { // test for <string> + std::string s; ((void)s); + } + { // test for <stdexcept> + std::logic_error le("blah"); ((void)le); + std::runtime_error re("blah"); ((void)re); + } + { // test for <iosfwd> + test_typedef<std::ios>(); + test_typedef<std::wios>(); + test_typedef<std::istream>(); + test_typedef<std::ostream>(); + test_typedef<std::iostream>(); + } } diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp deleted file mode 100644 index 1e7243b5f50..00000000000 --- a/libcxx/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// <tuple> - -// template <class... Types> class tuple; - -// UNSUPPORTED: c++98, c++03 - -// This is not a portable test - -#include <tuple> - -struct A {}; - -struct B {}; - -int main() -{ - { - typedef std::tuple<int, A> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, int> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, int, B> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<A, B, int> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } - { - typedef std::tuple<int, A, B> T; - static_assert((sizeof(T) == sizeof(int)), ""); - } -} |