[libcxx-commits] [libcxx] 4e52944 - [libc++] Make sure we include %{flags} when building with the new format
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Apr 6 08:24:19 PDT 2020
Author: Louis Dionne
Date: 2020-04-06T11:24:04-04:00
New Revision: 4e52944ef11987efe09681df53700e54222373b8
URL: https://github.com/llvm/llvm-project/commit/4e52944ef11987efe09681df53700e54222373b8
DIFF: https://github.com/llvm/llvm-project/commit/4e52944ef11987efe09681df53700e54222373b8.diff
LOG: [libc++] Make sure we include %{flags} when building with the new format
Otherwise, we're missing some flags like the flags that are used by
sanitizer builds and the 32-bit builds. In the long term, I think it
would be better to have only %{compile_flags} and %{link_flags}, but
for the benefit of adopting the new format by default, I think it's OK
to add %{flags} to it.
Added:
Modified:
libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp
libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
libcxx/utils/libcxx/test/newformat.py
Removed:
################################################################################
diff --git a/libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp b/libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp
index 40e48c6f3ac7..ffa8323d3d39 100644
--- a/libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/sh.cpp/remote-substitutions.sh.cpp
@@ -16,7 +16,7 @@
// appear first in the command-line or not.
// FILE_DEPENDENCIES: %t.exe
-// RUN: %{cxx} %{compile_flags} %{link_flags} -o %t.exe %s
+// RUN: %{cxx} %{flags} %{compile_flags} %{link_flags} -o %t.exe %s
// RUN: %{exec} %t.exe 0
// RUN: %{exec} ! %t.exe 1
diff --git a/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp b/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
index 45ff9643bc66..c1856fa0cada 100644
--- a/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
+++ b/libcxx/test/libcxx/selftest/newformat/sh.cpp/substitutions.sh.cpp
@@ -8,12 +8,13 @@
// Make sure we have access to the following substitutions at all times:
// - %{cxx}
+// - %{flags}
// - %{compile_flags}
// - %{link_flags}
// - %{exec}
// FILE_DEPENDENCIES: %t.exe
-// RUN: %{cxx} %{compile_flags} %{link_flags} -o %t.exe %s
+// RUN: %{cxx} %{flags} %{compile_flags} %{link_flags} -o %t.exe %s
// RUN: %{exec} %t.exe "HELLO"
#include <cassert>
diff --git a/libcxx/utils/libcxx/test/newformat.py b/libcxx/utils/libcxx/test/newformat.py
index 649259b2f87a..d75dc6a64915 100644
--- a/libcxx/utils/libcxx/test/newformat.py
+++ b/libcxx/utils/libcxx/test/newformat.py
@@ -41,12 +41,13 @@ class CxxStandardLibraryTest(lit.formats.TestFormat):
%{cxx} - A command that can be used to invoke the compiler
%{compile_flags} - Flags to use when compiling a test case
%{link_flags} - Flags to use when linking a test case
+ %{flags} - Flags to use either when compiling or linking a test case
%{exec} - A command to prefix the execution of executables
Note that when building an executable (as opposed to only compiling a source
- file), both %{compile_flags} and %{link_flags} will be used in the same
- command line. In other words, the test format doesn't perform separate
- compilation and linking steps in this case.
+ file), all three of ${flags}, %{compile_flags} and %{link_flags} will be used
+ in the same command line. In other words, the test format doesn't perform
+ separate compilation and linking steps in this case.
In addition to everything that's supported in Lit ShTests, this test format
@@ -103,7 +104,7 @@ def getTestsInDirectory(self, testSuite, pathInSuite, litConfig, localConfig):
def _checkSubstitutions(self, substitutions):
substitutions = [s for (s, _) in substitutions]
- for s in ['%{cxx}', '%{compile_flags}', '%{link_flags}', '%{exec}']:
+ for s in ['%{cxx}', '%{compile_flags}', '%{link_flags}', '%{flags}', '%{exec}']:
assert s in substitutions, "Required substitution {} was not provided".format(s)
# Determine whether -verify should be used for a given test. We use -verify
@@ -135,28 +136,28 @@ def execute(self, test, litConfig):
return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.compile.pass.cpp'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} -fsyntax-only"
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only"
]
return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.compile.fail.cpp'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} -fsyntax-only " + VERIFY_FLAGS
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only " + VERIFY_FLAGS
]
return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.link.pass.cpp'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} %{link_flags} -o %t.exe"
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe"
]
return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.link.fail.cpp'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} -c -o %t.o",
- "%dbg(LINKED WITH) ! %{cxx} %t.o %{link_flags} -o %t.exe"
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -c -o %t.o",
+ "%dbg(LINKED WITH) ! %{cxx} %t.o %{flags} %{link_flags} -o %t.exe"
]
return self._executeShTest(test, litConfig, steps)
elif filename.endswith('.run.fail.cpp'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} %{link_flags} -o %t.exe",
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%dbg(EXECUTED AS) %{exec} ! %t.exe"
]
return self._executeShTest(test, litConfig, steps, fileDependencies=['%t.exe'])
@@ -164,7 +165,7 @@ def execute(self, test, litConfig):
# suffixes above too.
elif filename.endswith('.pass.cpp') or filename.endswith('.pass.mm'):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} %{link_flags} -o %t.exe",
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} %{link_flags} -o %t.exe",
"%dbg(EXECUTED AS) %{exec} %t.exe"
]
return self._executeShTest(test, litConfig, steps, fileDependencies=['%t.exe'])
@@ -173,11 +174,11 @@ def execute(self, test, litConfig):
elif filename.endswith('.fail.cpp') or filename.endswith('.fail.mm'):
if self._useVerify(test, litConfig):
steps = [
- "%dbg(COMPILED WITH) %{cxx} %s %{compile_flags} -fsyntax-only " + VERIFY_FLAGS
+ "%dbg(COMPILED WITH) %{cxx} %s %{flags} %{compile_flags} -fsyntax-only " + VERIFY_FLAGS
]
else:
steps = [
- "%dbg(COMPILED WITH) ! %{cxx} %s %{compile_flags} -fsyntax-only"
+ "%dbg(COMPILED WITH) ! %{cxx} %s %{flags} %{compile_flags} -fsyntax-only"
]
return self._executeShTest(test, litConfig, steps)
else:
More information about the libcxx-commits
mailing list