Commit Graph

15 Commits

Author SHA1 Message Date
Alastair Houghton
0bc76dae80 [Backtracing] Add warning suppression option, enable it for tests.
The backtracing code will warn you if you attempt to forcibly enable
backtracing for a privileged executable.  This is apparently upsetting
the Driver/filelists.swift test.

Since we want to force it on for tests, so that we will definitely get
backtraces, add an option to suppress warning messages, and turn that
on for tests as well.

rdar://144497613
2025-02-24 12:55:16 +00:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Saleem Abdulrasool
f074995106 test: partially undo changes to PathSanitizingFileCheck
The regular expression engine escaped the strings differently across
python 2 and 3.  Using a raw string makes this simpler to understand
and obsoletes the comment.  This change also now properly allows the
replacement to occur in the same way on 2 and 3.
2020-07-09 16:29:58 -07:00
Saleem Abdulrasool
93df7f4276 PathSanitizingFileCheck: improve Python3 compatibility
Adjust the regex match to do a better job of sanitizing the paths.  This
improves the test coverage pass rate with Python 3.  Furthermore, handle
the unicode conversion properly that breaks with Python 3.  This further
improves the Python 3 test coverage pass rate.
2020-07-01 20:00:30 +00:00
Ryan Lovelett
041be040fc test: Explicitly work with binary data in PathSanitizingFileCheck
Python 3 uses the concepts of text and (binary) data instead of Unicode
strings and 8-bit strings. This change makes it explicit in Python 2 and
3 that this utility works with binary data instead of strings.

* print(bytes(r'(/|\\\\|\\\\\\\\)', encoding="ascii")) => b'(/|\\\\\\\\|\\\\\\\\\\\\\\\\)'
* print(bytes(r'(/|\\\\)', encoding="ascii"))          => b'(/|\\\\\\\\)'
* print(bytes(r'/', encoding="ascii"))                 => b'/'
* print(bytes(r'\\/', encoding="ascii"))               => b'\\\\/'
2020-04-16 22:47:28 -04:00
Sergej Jaskiewicz
9fbdfdec7d [utils] Fix PathSanitizingFileCheck to support paths with "weird" chars
When absolute paths that need to be substituted by PathSanitizingFileCheck contained characters that could be part of regexp syntax, substitution didn't actually take place.

For example, substitution like BUILD_DIR='/Users/johnsmith/swift-source/Ninja-RelWithDebInfoAssert+swift-DebugAssert' didn't result in anything because of the '+' in the path.

This is an attempt to fix it.

This commit also adds the --dry-run flag to PathSanitizingFileCheck which was used to detect and debug this issue, but why not let it stay.
2019-07-10 00:55:46 +03:00
Daniel Rodríguez Troitiño
46a173718a [windows] Use both directory separators in test patterns.
Admit defeat and realize that one simply cannot win against Windows. Use
the pattern with both separators in the tests and remove the hack in
PathSanitizingFileCheck because it created false positives, some of them
could not have been easily fixed.

Sadly lit substitutions or other tricks in lit.cfg will not work,
because CHECK lines are not processed by lit, but by FileCheck.
2019-06-18 18:51:01 -07:00
Daniel Rodríguez Troitiño
80cd48dfe6 [windows] Fix ParseableInterface tests.
There were several Unix specific things in the ParseableInterface tests:
the Bash subcommand was used, a Python tool was invoked without an
explicit interpreter, and Unix path separators are used in CHECK lines.

The Bash subcommand is replaced by a Lit substitution. Both swiftmodule
and swiftdoc had substitutions, so swiftinterface gets one which should
about the subcommand.

The Python tool is invoked with an explicit interpreter.

The Unix paths, instead of adding the ugly {{\\|/}} pattern everywhere
are fixed in the PathSanitizing tool instead, that gets a new capability
in Windows compatibility mode where all the Windows path found in the
input are transformed into Windows path with only forward slashes (Unix
slashes) in the output, which can be checked textually against the CHECK
lines.
2019-06-18 12:43:01 -07:00
Daniel Rodríguez Troitiño
267e0fc70e [utils][test] PathSanitizingFileCheck more compatible with Windows.
In pch-bridging-header-deps test, the PathSanitizingFileCheck is used to
check against YAML escaped paths. This works for Unix paths, since the
slash doesn't need to be escaped, but doesn't work for Windows paths,
because the path separator is escaped, and the replacement done by
PathSanitizingFileCheck only looks for exact matches.

To avoid changes in how Darwin/Linux execute the tests, this commit adds
two options in PathSanitizingFileCheck: Windows compatibility makes the
given paths match both forward and backward slashes; in the additional
YAML compatibility is enabled, escaped backward slashes will also be
matched.

The Windows compatibility is enabled for all the test in case the tests
are running on Windows (change done in lit.cfg), while the YAML
compatibility is only enabled for those tests that might need it (like
the PCH bridging header one). This is in order to not allow possible
empty path components in tests that do not deal with YAML escaped paths.
2019-04-05 18:48:33 -07:00
Saleem Abdulrasool
95678d9ab0 utils: be more flexible about path separators
The path separator on Windows is `\` and the path separator on Linux,
android, macOS is `/`.   Permit both sets of path separators.
2019-04-03 08:17:49 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
practicalswift
ee871c7938 [python] Bring code base in line with PEP-8 again 2016-09-16 19:33:04 +02:00
Dave Abrahams
77d4f41732 [testing] run FileCheck with complete path
Otherwise, unless you happen to have FileCheck in your PATH, when you
copy/paste a test invocation to reproduce it, it fails.
2016-09-12 19:48:45 -07:00
Dmitri Gribenko
7284caf82d test/lit.cfg: add a new substitution '%FileCheck'
'%FileCheck' removes absolute paths of the source and build directory
from the input.  Overwhelming majority of tests don't intend to match
these paths.

Also add a substitution '%raw-FileCheck' that does not sanitize the
input.
2016-08-10 23:50:57 -07:00