[libc++] Add a Buildkite job that tests back-deployment on Apple
authorLouis Dionne <ldionne@apple.com>
Thu, 5 Nov 2020 15:47:06 +0000 (10:47 -0500)
committerLouis Dionne <ldionne@apple.com>
Thu, 5 Nov 2020 23:26:08 +0000 (18:26 -0500)
The current way we test this is pretty cheap, i.e. we download previously
released macOS dylibs and run against that. Ideally, we would require a
full host running the appropriate version of macOS, and we'd execute the
tests using SSH on that host. But since we don't have such hosts available
easily for now, this is better than nothing.

At the same time, also fix some tests that were failing when back
deploying.

Differential Revision: https://reviews.llvm.org/D90869

12 files changed:
libcxx/include/variant
libcxx/test/libcxx/thread/thread.condition/PR30202_notify_from_pthread_created_thread.pass.cpp
libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.pass.cpp
libcxx/test/libcxx/thread/thread.threads/thread.thread.this/sleep_for.signals.pass.cpp
libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
libcxx/test/std/utilities/variant/variant.relops/relops.pass.cpp
libcxx/test/std/utilities/variant/variant.relops/relops_bool_conv.fail.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.dtor/dtor.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp
libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp
libcxx/utils/ci/buildkite-pipeline.yml
libcxx/utils/ci/run-buildbot.sh

index 0830d3d..16ab033 100644 (file)
@@ -521,7 +521,7 @@ struct __indices {
 };
 
 template <size_t... _Ns, class _Fp, class _Rp, class... _Args>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
 static constexpr auto __make_vtable_impl(_Fp __f, _Rp (*)(_Args...)) {
   array<_Rp (*)(_Args...), (1 * ... * _Ns) + 1> __result = {
       [](_Args...) -> _Rp { __throw_bad_variant_access(); }
@@ -552,7 +552,7 @@ struct __base {
   };
 
   template <class _Vis, class _Vp, class _Wp>
-  inline _LIBCPP_INLINE_VISIBILITY
+  inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
   static constexpr decltype(auto)
   __visit_alt_at(size_t __index, _Vis&& __vis, _Vp&& __v, _Wp&& __w) {
     constexpr size_t __size = __uncvref_t<_Vp>::__size();
@@ -598,7 +598,7 @@ struct __base {
   }
 
   template <size_t... _Is, class _Vis, class... _Vs>
-  inline _LIBCPP_INLINE_VISIBILITY
+  inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
   static constexpr decltype(auto)
   __visit_alt_impl(index_sequence<_Is...>, _Vis&& __vis, _Vs&&... __vs) {
     using __multi = __multi<__uncvref_t<_Vs>::__size()...>;
index 824daba..9c7879c 100644 (file)
 // unique_lock.
 // UNSUPPORTED: c++03
 
+// PR30202 was fixed starting in macosx10.13.
+// UNSUPPORTED: with_system_cxx_lib=macosx10.12
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
+
 // <condition_variable>
 
-// void
-//   notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
+// void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
 
 // Test that this function works with threads that were not created by
-// std::thread. See: https://bugs.llvm.org/show_bug.cgi?id=30202
+// std::thread. See https://llvm.org/PR30202
 
 
 #include <condition_variable>
index 593d9a4..0f7c48e 100644 (file)
@@ -8,12 +8,12 @@
 
 // UNSUPPORTED: libcpp-has-no-threads
 
-// Until 58a0a70fb2f1, this_thread::sleep_for could get interrupted by
-// signals and this test would fail. Disable the test on the corresponding
-// system libraries.
-// XFAIL: with_system_cxx_lib=macosx10.11
-// XFAIL: with_system_cxx_lib=macosx10.10
-// XFAIL: with_system_cxx_lib=macosx10.9
+// Until 58a0a70fb2f1, this_thread::sleep_for could sometimes get interrupted
+// by signals and this test would fail spuriously. Disable the test on the
+// corresponding system libraries.
+// UNSUPPORTED: with_system_cxx_lib=macosx10.11
+// UNSUPPORTED: with_system_cxx_lib=macosx10.10
+// UNSUPPORTED: with_system_cxx_lib=macosx10.9
 
 // <thread>
 
index 469dfc4..9d6f995 100644 (file)
@@ -11,9 +11,9 @@
 // This test uses the POSIX header <sys/time.h> which Windows doesn't provide
 // UNSUPPORTED: windows
 
-// Until 58a0a70fb2f1, this_thread::sleep_for could get interrupted by
-// signals and this test would fail. Disable the test on the corresponding
-// system libraries.
+// Until 58a0a70fb2f1, this_thread::sleep_for misbehaves when interrupted by
+// a signal, as tested here. Disable the test on the corresponding system
+// libraries.
 // XFAIL: with_system_cxx_lib=macosx10.11
 // XFAIL: with_system_cxx_lib=macosx10.10
 // XFAIL: with_system_cxx_lib=macosx10.9
index 7e4740b..cdadd6e 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class... Types> struct hash<variant<Types...>>;
index d5dd7cf..fa68161 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class ...Types>
index eab6cc1..9c4726a 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class ...Types>
index 9ba593c..3c0eff5 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class ...Types> class variant;
index 51656d7..2abb124 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class ...Types> class variant;
index 9843f57..521683b 100644 (file)
@@ -9,6 +9,12 @@
 
 // UNSUPPORTED: c++03, c++11, c++14
 
+// Throwing bad_variant_access is supported starting in macosx10.13
+// XFAIL: with_system_cxx_lib=macosx10.12 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.11 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.10 && !no-exceptions
+// XFAIL: with_system_cxx_lib=macosx10.9 && !no-exceptions
+
 // <variant>
 
 // template <class ...Types> class variant;
index faa1081..9d560f6 100644 (file)
@@ -257,3 +257,15 @@ steps:
       automatic:
         - exit_status: -1  # Agent was lost
           limit: 2
+
+  # Test back-deployment to older Apple platforms
+  - label: "Apple back-deployment macosx10.9"
+    command: "libcxx/utils/ci/run-buildbot.sh x86_64-apple-system-backdeployment-10.9"
+    artifact_paths:
+      - "**/test-results.xml"
+    agents:
+      queue: "libcxx-macos-builders"
+    retry:
+      automatic:
+        - exit_status: -1  # Agent was lost
+          limit: 2
index 5502cde..f22d2a6 100755 (executable)
@@ -25,7 +25,14 @@ function generate-cmake() {
           -DLLVM_ENABLE_PROJECTS="libcxx;libunwind;libcxxabi" \
           -DLLVM_LIT_ARGS="-sv --show-unsupported --xunit-xml-output test-results.xml" \
           -DLIBCXX_CXX_ABI=libcxxabi \
-          ${@}
+          "${@}"
+}
+
+function download-osx-roots() {
+  echo "--- Downloading previous macOS dylibs"
+  PREVIOUS_DYLIBS_URL="http://lab.llvm.org:8080/roots/libcxx-roots.tar.gz"
+  mkdir -p "${BUILD_DIR}/macos-roots"
+  curl "${PREVIOUS_DYLIBS_URL}" | tar -xz --strip-components=1 -C "${BUILD_DIR}/macos-roots"
 }
 
 function check-cxx-cxxabi() {
@@ -163,6 +170,28 @@ x86_64-apple-system-noexceptions)
                    -DLIBCXXABI_ENABLE_EXCEPTIONS=OFF
     check-cxx-cxxabi
 ;;
+x86_64-apple-system-backdeployment-*)
+  DEPLOYMENT_TARGET="${BUILDER#x86_64-apple-system-backdeployment-}"
+  PARAMS="target_triple=x86_64-apple-macosx${DEPLOYMENT_TARGET}"
+  PARAMS+=";cxx_runtime_root=${BUILD_DIR}/macos-roots/macOS/libc++/${DEPLOYMENT_TARGET}"
+  PARAMS+=";abi_library_path=${BUILD_DIR}/macos-roots/macOS/libc++abi/${DEPLOYMENT_TARGET}"
+  PARAMS+=";use_system_cxx_lib=True"
+  # Filesystem is supported on Apple platforms starting with macosx10.15.
+  if [[ ${DEPLOYMENT_TARGET} =~ ^10.9|10.10|10.11|10.12|10.13|10.14$ ]]; then
+      PARAMS+=";enable_filesystem=False"
+  fi
+
+  export CC=clang
+  export CXX=clang++
+  generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Apple.cmake" \
+                 -DLIBCXX_TEST_PARAMS="${PARAMS}" \
+                 -DLIBCXXABI_TEST_PARAMS="${PARAMS}"
+  download-osx-roots
+
+  # TODO: Also run the libc++abi tests
+  echo "+++ Running the libc++ tests"
+  ninja -C "${BUILD_DIR}" check-cxx
+;;
 benchmarks)
     export CC=clang
     export CXX=clang++