[libcxx-commits] [libcxx] [libcxxabi] [runtimes] Add tests for installation properties for vanilla configurations (PR #98077)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 12 11:58:38 PDT 2024


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/98077

>From e31bb87de1a1b036e3b0c93d9368bae3f5e5efc1 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 8 Jul 2024 17:12:42 -0400
Subject: [PATCH 1/6] [runtimes] Add tests for installation properties for
 vanilla configurations

---
 .../llvm/system-install-properties.sh.cpp     | 26 +++++++++++++++++++
 .../llvm/system-install-properties.sh.cpp     | 25 ++++++++++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
 create mode 100644 libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp

diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
new file mode 100644
index 0000000000000..ba9878cae131b
--- /dev/null
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++ when built under
+// a vanilla upstream configuration.
+
+// Make sure we install the libc++ headers in the right location.
+//
+// RUN: stat "%{include-dir}/__config"
+
+// Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
+//
+// RUN: stat "%{lib-dir}/libc++.1.dylib"
+// RUN: stat "%{lib-dir}/libc++experimental.a"
+
+// Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
+//
+// RUN: stat "%{lib-dir}/libc++.dylib"
+// RUN: readlink "%{lib-dir}/libc++.dylib" | grep "libc++.1.dylib"
diff --git a/libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp b/libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp
new file mode 100644
index 0000000000000..b6d32a3d544a6
--- /dev/null
+++ b/libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++abi when built under
+// a vanilla upstream configuration.
+
+// Make sure we install the libc++abi headers in the right location.
+//
+// RUN: stat "%{include}/cxxabi.h"
+
+// Make sure we install libc++abi.1.dylib in the right location.
+//
+// RUN: stat "%{lib}/libc++abi.1.dylib"
+
+// Make sure we install a symlink from libc++abi.dylib to libc++abi.1.dylib.
+//
+// RUN: stat "%{lib-dir}/libc++abi.dylib"
+// RUN: readlink "%{lib-dir}/libc++abi.dylib" | grep "libc++abi.1.dylib"

>From 6a910ba7bb581c7b78b5b5f634110f6c9db6461e Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Jul 2024 10:30:04 -0400
Subject: [PATCH 2/6] Try fixing issues on Linux

---
 .../vendor/llvm/system-install-properties.sh.cpp      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
index ba9878cae131b..0347ebdfd230c 100644
--- a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
@@ -8,19 +8,24 @@
 
 // REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
 
+// DEFINE: %{shared-suffix}=%if target={{.+}}-apple-{{.+}} %{ dylib %} %else %{ so %}
+
 // This file checks various properties of the installation of libc++ when built under
 // a vanilla upstream configuration.
 
+// TODO: temporary to debug
+// RUN: ls %{lib-dir}
+
 // Make sure we install the libc++ headers in the right location.
 //
 // RUN: stat "%{include-dir}/__config"
 
 // Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
 //
-// RUN: stat "%{lib-dir}/libc++.1.dylib"
+// RUN: stat "%{lib-dir}/libc++.1.%{shared-suffix}"
 // RUN: stat "%{lib-dir}/libc++experimental.a"
 
 // Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
 //
-// RUN: stat "%{lib-dir}/libc++.dylib"
-// RUN: readlink "%{lib-dir}/libc++.dylib" | grep "libc++.1.dylib"
+// RUN: stat "%{lib-dir}/libc++.%{shared-suffix}"
+// RUN: readlink "%{lib-dir}/libc++.%{shared-suffix}" | grep "libc++.1.%{shared-suffix}"

>From ab64932ed3a86258a11423f9e7e77f559b307ec0 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Jul 2024 12:13:24 -0400
Subject: [PATCH 3/6] Try to make the test pass on Linux

---
 .../vendor/llvm/system-install-properties.sh.cpp     | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
index 0347ebdfd230c..8ca5abcf17983 100644
--- a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
@@ -8,24 +8,22 @@
 
 // REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
 
-// DEFINE: %{shared-suffix}=%if target={{.+}}-apple-{{.+}} %{ dylib %} %else %{ so %}
+// DEFINE: %{versioned-library-name}=%if target={{.+}}-apple-{{.+}} %{libc++.1.dylib%} %else %{libc++.so.1%}
+// DEFINE: %{library-name}=%if target={{.+}}-apple-{{.+}} %{libc++.dylib%} %else %{libc++.so%}
 
 // This file checks various properties of the installation of libc++ when built under
 // a vanilla upstream configuration.
 
-// TODO: temporary to debug
-// RUN: ls %{lib-dir}
-
 // Make sure we install the libc++ headers in the right location.
 //
 // RUN: stat "%{include-dir}/__config"
 
 // Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
 //
-// RUN: stat "%{lib-dir}/libc++.1.%{shared-suffix}"
+// RUN: stat "%{lib-dir}/%{versioned-library-name}"
 // RUN: stat "%{lib-dir}/libc++experimental.a"
 
 // Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
 //
-// RUN: stat "%{lib-dir}/libc++.%{shared-suffix}"
-// RUN: readlink "%{lib-dir}/libc++.%{shared-suffix}" | grep "libc++.1.%{shared-suffix}"
+// RUN: stat "%{lib-dir}/%{library-name}"
+// RUN: readlink "%{lib-dir}/%{library-name}" | grep "%{versioned-library-name}"

>From 30b180d1e27714595840b96b2829aa838f99f8d4 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Jul 2024 13:46:59 -0400
Subject: [PATCH 4/6] Split tests for each platform

---
 ...> system-install-properties-darwin.sh.cpp} | 12 ++++----
 .../system-install-properties-linux.sh.cpp    | 30 +++++++++++++++++++
 2 files changed, 35 insertions(+), 7 deletions(-)
 rename libcxx/test/libcxx/vendor/llvm/{system-install-properties.sh.cpp => system-install-properties-darwin.sh.cpp} (66%)
 create mode 100644 libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp

diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties-darwin.sh.cpp
similarity index 66%
rename from libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
rename to libcxx/test/libcxx/vendor/llvm/system-install-properties-darwin.sh.cpp
index 8ca5abcf17983..757bf89c17e9a 100644
--- a/libcxx/test/libcxx/vendor/llvm/system-install-properties.sh.cpp
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties-darwin.sh.cpp
@@ -6,13 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: darwin
 // REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
 
-// DEFINE: %{versioned-library-name}=%if target={{.+}}-apple-{{.+}} %{libc++.1.dylib%} %else %{libc++.so.1%}
-// DEFINE: %{library-name}=%if target={{.+}}-apple-{{.+}} %{libc++.dylib%} %else %{libc++.so%}
-
 // This file checks various properties of the installation of libc++ when built under
-// a vanilla upstream configuration.
+// a vanilla upstream configuration on Darwin platforms.
 
 // Make sure we install the libc++ headers in the right location.
 //
@@ -20,10 +18,10 @@
 
 // Make sure we install libc++.1.dylib and libc++experimental.a in the right location.
 //
-// RUN: stat "%{lib-dir}/%{versioned-library-name}"
+// RUN: stat "%{lib-dir}/libc++.1.dylib"
 // RUN: stat "%{lib-dir}/libc++experimental.a"
 
 // Make sure we install a symlink from libc++.dylib to libc++.1.dylib.
 //
-// RUN: stat "%{lib-dir}/%{library-name}"
-// RUN: readlink "%{lib-dir}/%{library-name}" | grep "%{versioned-library-name}"
+// RUN: stat "%{lib-dir}/libc++.dylib"
+// RUN: readlink "%{lib-dir}/libc++.dylib" | grep "libc++.1.dylib"
diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp
new file mode 100644
index 0000000000000..0a221046eadb8
--- /dev/null
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: linux
+// REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++ when built under
+// a vanilla upstream configuration on Linux platforms.
+
+// Make sure we install the libc++ headers in the right location.
+//
+// RUN: stat "%{include-dir}/__config"
+
+// Make sure we install libc++.so.1.0 and libc++experimental.a in the right location.
+//
+// RUN: stat "%{lib-dir}/libc++.so.1.0"
+// RUN: stat "%{lib-dir}/libc++experimental.a"
+
+// Make sure we install a symlink from libc++.so to libc++.so.1.0.
+//
+// RUN: stat "%{lib-dir}/libc++.so"
+// RUN: readlink "%{lib-dir}/libc++.so" | grep "libc++.so.1.0"
+//
+// RUN: stat "%{lib-dir}/libc++.so.1"
+// RUN: readlink "%{lib-dir}/libc++.so.1" | grep "libc++.so.1.0"

>From 7283920a21ac901db3a4db86c60e8da1e4bc26dd Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Jul 2024 14:52:16 -0400
Subject: [PATCH 5/6] Fix test on Linux with linker script

---
 .../vendor/llvm/system-install-properties-linux.sh.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp b/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp
index 0a221046eadb8..05ccae9881a85 100644
--- a/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp
+++ b/libcxx/test/libcxx/vendor/llvm/system-install-properties-linux.sh.cpp
@@ -21,10 +21,12 @@
 // RUN: stat "%{lib-dir}/libc++.so.1.0"
 // RUN: stat "%{lib-dir}/libc++experimental.a"
 
-// Make sure we install a symlink from libc++.so to libc++.so.1.0.
-//
-// RUN: stat "%{lib-dir}/libc++.so"
-// RUN: readlink "%{lib-dir}/libc++.so" | grep "libc++.so.1.0"
+// Make sure we install a symlink from libc++.so.1 to libc++.so.1.0.
 //
 // RUN: stat "%{lib-dir}/libc++.so.1"
 // RUN: readlink "%{lib-dir}/libc++.so.1" | grep "libc++.so.1.0"
+
+// Make sure we install libc++.so in the right location. That may be a symlink or
+// a linker script, so we don't check anything specific about that file.
+//
+// RUN: stat "%{lib-dir}/libc++.so"

>From a91e55dbd90838cddd01934a472771336176ac68 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 12 Jul 2024 14:58:25 -0400
Subject: [PATCH 6/6] Fix the same tests for libc++abi

---
 ...> system-install-properties-darwin.sh.cpp} |  3 +-
 .../system-install-properties-linux.sh.cpp    | 31 +++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)
 rename libcxxabi/test/vendor/llvm/{system-install-properties.sh.cpp => system-install-properties-darwin.sh.cpp} (92%)
 create mode 100644 libcxxabi/test/vendor/llvm/system-install-properties-linux.sh.cpp

diff --git a/libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp b/libcxxabi/test/vendor/llvm/system-install-properties-darwin.sh.cpp
similarity index 92%
rename from libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp
rename to libcxxabi/test/vendor/llvm/system-install-properties-darwin.sh.cpp
index b6d32a3d544a6..9c85aa907e594 100644
--- a/libcxxabi/test/vendor/llvm/system-install-properties.sh.cpp
+++ b/libcxxabi/test/vendor/llvm/system-install-properties-darwin.sh.cpp
@@ -6,10 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+// REQUIRES: darwin
 // REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
 
 // This file checks various properties of the installation of libc++abi when built under
-// a vanilla upstream configuration.
+// a vanilla upstream configuration on Darwin platforms.
 
 // Make sure we install the libc++abi headers in the right location.
 //
diff --git a/libcxxabi/test/vendor/llvm/system-install-properties-linux.sh.cpp b/libcxxabi/test/vendor/llvm/system-install-properties-linux.sh.cpp
new file mode 100644
index 0000000000000..f144b21462303
--- /dev/null
+++ b/libcxxabi/test/vendor/llvm/system-install-properties-linux.sh.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: linux
+// REQUIRES: stdlib=libc++ && !stdlib=apple-libc++
+
+// This file checks various properties of the installation of libc++abi when built under
+// a vanilla upstream configuration on Linux platforms.
+
+// Make sure we install the libc++abi headers in the right location.
+//
+// RUN: stat "%{include}/cxxabi.h"
+
+// Make sure we install libc++abi.so.1.0 in the right location.
+//
+// RUN: stat "%{lib}/libc++abi.so.1.0"
+
+// Make sure we install a symlink from libc++abi.so.1 to libc++abi.so.1.0.
+//
+// RUN: stat "%{lib}/libc++abi.so.1"
+// RUN: readlink "%{lib}/libc++abi.so.1" | grep "libc++abi.so.1.0"
+
+// Make sure we install a symlink from libc++abi.so to libc++abi.so.1.
+//
+// RUN: stat "%{lib}/libc++abi.so"
+// RUN: readlink "%{lib}/libc++abi.so" | grep "libc++abi.so.1"



More information about the libcxx-commits mailing list