-
Notifications
You must be signed in to change notification settings - Fork 347
Fix the following CAS related tests for Windows #11355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Conversation
@swift-ci please test llvm |
Existing failures (eg. https://ci.swift.org/job/pr-apple-llvm-project-llvm-linux/987/consoleText)
|
@swift-ci please test llvm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the complexity of paths is making developers who do not have access to a windows machine really hard to write tests.
Maybe we can even look into deleting some of the implementations from the branch before we found better ways to support them on windows.
llvm/include/llvm/CAS/TreePath.h
Outdated
#include "llvm/Support/Path.h" | ||
#include <string> | ||
|
||
namespace llvm { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use namespace llvm::cas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
#include "llvm/Config/config.h" | ||
#include "llvm/Support/FileSystem.h" | ||
#include <mutex> | ||
|
||
using namespace llvm; | ||
using namespace llvm::cas; | ||
using llvm::cas::getTreePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see we use this file scope overwrite in LLVM. I will just use the correct namespace when calling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
std::stable_sort(Mappings.begin(), Mappings.end(), | ||
[](const MappedPrefix &LHS, const MappedPrefix &RHS) { | ||
if (llvm::sys::path::is_style_windows(getPathStyle())) | ||
std::stable_sort(Mappings.begin(), Mappings.end(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how much conversion we have in the sort function.
We should canonicalize the path style before creating PrefixMapper. Maybe during option parsing? Or make MappedPrefix canonicalize.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that there are extra canonicalization when getTreePath
, so it doesn't matter the form of the MappedPrefix
is, so PrefixMapper should contain canonicalize MappedPrefix from the beginning, not to convert them when need to sort them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point. I think this, current way feels overall better to me because of the following: sorting here also requires case-insensitivity in addition to slash canonicalization (we want to sort C:\...
and c:\...
case-insensitively).
This is the original, to-be-erased comment on sort()
// FIXME: Only works for posix right now since it doesn't handle case- and
// separator-insensitivity.
I think it'd be simpler to handler slash and case together in one location. We could have a slash canonicalization and change cases when PrefixMapper
is populated but it would be problematic because a) whatever is put into PrefixMapper
will be passed down as the -fdepscan-prefix-map
flags to subinvocations and it'd be visible and surprising to the users, and b) there aren't nice ways to make lit tests matching case-insensitive (not even PathSanitizingFileCheck
doesn't do). I think this way fits better with the current general way that Clang doesn't modify flag value input paths (mostly if not always) and yet being able to do the longer prefix-first prefix mapping as I think this intends. I think canonicalization here is done once, not per each comparator call and isn't too bad.
llvm/utils/lit/lit/TestRunner.py
Outdated
# yaml. The t suffix stands for tree path. Those with | ||
# suffixes need to use {} because lit macro names aren't | ||
# based on longest matches and cannot be a prefix of | ||
# another macro. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really hope we can cut down the number of root representation here.
Can we make tree path working the same way as normal path using \\
on Windows as separator?
I am even ok with throwing out CachingOnDiskFileSystem and TreePathPrefixMapper from Windows for now since we don't really use that for clang/swift caching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cut down to the two that are currently used. It's good to know we have that option of throwing those out.
Clang :: ClangScanDeps/cas-fs-prefix-mapping.c Clang :: ClangScanDeps/include-tree-prefix-mapping-pch-remap.c Clang :: ClangScanDeps/include-tree-prefix-mapping.c Clang :: ClangScanDeps/modules-cas-fs-prefix-mapping-caching.c Clang :: ClangScanDeps/modules-cas-fs-prefix-mapping.c Clang :: ClangScanDeps/modules-include-tree-prefix-map.c Clang :: ClangScanDeps/modules-pch-cas-fs-prefix-mapping-caching.c Clang :: ClangScanDeps/modules-pch-cas-fs-prefix-mapping.c
@swift-ci please test llvm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly fine. Hope we can simply further.
Fix the following CAS related tests for Windows
Clang :: ClangScanDeps/cas-fs-prefix-mapping.c
Clang :: ClangScanDeps/include-tree-prefix-mapping-pch-remap.c
Clang :: ClangScanDeps/include-tree-prefix-mapping.c
Clang :: ClangScanDeps/modules-cas-fs-prefix-mapping-caching.c
Clang :: ClangScanDeps/modules-cas-fs-prefix-mapping.c
Clang :: ClangScanDeps/modules-include-tree-prefix-map.c
Clang :: ClangScanDeps/modules-pch-cas-fs-prefix-mapping-caching.c
Clang :: ClangScanDeps/modules-pch-cas-fs-prefix-mapping.c