[libcxx-commits] [PATCH] D156550: [libc++][test] Fixes using modules in the test suite.
Mark de Wever via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 28 08:44:47 PDT 2023
Mordante created this revision.
Herald added a subscriber: arichardson.
Herald added a project: All.
Mordante requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Importing modules in the test suite failed due to linker errors. This
fixes the issue and adds a minimal test to validate importing the std
module works.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D156550
Files:
libcxx/test/std/modules/std.pass.cpp
libcxx/utils/libcxx/test/dsl.py
Index: libcxx/utils/libcxx/test/dsl.py
===================================================================
--- libcxx/utils/libcxx/test/dsl.py
+++ libcxx/utils/libcxx/test/dsl.py
@@ -456,8 +456,11 @@
flags = _getSubstitution('%{flags}', config)
cmake = _getSubstitution('%{cmake}', config)
- subprocess.check_call([cmake, "-DCMAKE_CXX_STANDARD=" + std, f"-DCMAKE_CXX_FLAGS={flags}", build], env={})
- subprocess.check_call([cmake, "--build", build], env={})
+ subprocess.check_call([cmake, f"-DCMAKE_CXX_STANDARD={std}", f"-DCMAKE_CXX_FLAGS={flags}", build], env={})
+ subprocess.check_call([cmake, "--build", build, "--", "-v"], env={})
+ config.substitutions = _appendToSubstitution(
+ config.substitutions, "%{link_flags}", os.path.join(build, "libc++std.a")
+ )
def pretty(self, config, litParams):
return "building std module with flags {}".format(_getSubstitution('%{flags}', config))
Index: libcxx/test/std/modules/std.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/modules/std.pass.cpp
@@ -0,0 +1,21 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTEd: c++03, c++11, c++14, c++17, c++20
+// XFAIL: c++26
+
+// REQUIRES: use_module_std
+
+// A minimal test to validate import works.
+
+import std;
+
+int main(int, char**) {
+ std::println("Hello modular world");
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156550.545180.patch
Type: text/x-patch
Size: 1744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230728/8d775afb/attachment.bin>
More information about the libcxx-commits
mailing list