[libcxx] r302862 - Fix or move tests with non-standard assumptions
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Thu May 11 18:44:52 PDT 2017
Author: ericwf
Date: Thu May 11 20:44:51 2017
New Revision: 302862
URL: http://llvm.org/viewvc/llvm-project?rev=302862&view=rev
Log:
Fix or move tests with non-standard assumptions
Added:
libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/
libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
- copied, changed from r302859, libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp
- copied, changed from r302859, libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp
libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp
- copied, changed from r302859, libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp
Removed:
libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp
Modified:
libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp
Copied: libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (from r302859, libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp?p2=libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp&p1=libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp&r1=302859&r2=302862&rev=302862&view=diff
==============================================================================
--- libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (original)
+++ libcxx/trunk/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp Thu May 11 20:44:51 2017
@@ -35,7 +35,6 @@
void sig_action(int) {}
-#include <iostream>
int main()
{
int ec;
Copied: libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp (from r302859, libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/template.bitset/includes.pass.cpp&p1=libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp&r1=302859&r2=302862&rev=302862&view=diff
==============================================================================
(empty)
Copied: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp (from r302859, libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp)
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp?p2=libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/empty_member.pass.cpp&p1=libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp&r1=302859&r2=302862&rev=302862&view=diff
==============================================================================
(empty)
Removed: libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp?rev=302861&view=auto
==============================================================================
--- libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (original)
+++ libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp (removed)
@@ -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());
-}
Added: libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp?rev=302862&view=auto
==============================================================================
--- libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp (added)
+++ libcxx/trunk/test/std/thread/thread.threads/thread.thread.this/sleep_for_tested_elsewhere.pass.cpp Thu May 11 20:44:51 2017
@@ -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()
+{
+}
Modified: libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp?rev=302862&r1=302861&r2=302862&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/template.bitset/includes.pass.cpp Thu May 11 20:44:51 2017
@@ -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>();
+ }
}
Removed: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp?rev=302861&view=auto
==============================================================================
--- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/empty_member.pass.cpp (removed)
@@ -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)), "");
- }
-}
More information about the cfe-commits
mailing list