[lld] Support target names with dots in more utilities (PR #65812)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 27 15:27:05 PDT 2023
================
@@ -1696,6 +1696,40 @@ TEST(Support, ReplacePathPrefix) {
EXPECT_EQ(Path, "C:\\old/foo\\bar");
}
+TEST(Support, FindProgramName) {
+ StringRef WindowsProgName =
+ path::program_name("C:\\Test\\foo.exe", path::Style::windows);
+ EXPECT_EQ(WindowsProgName, "foo");
+
+ StringRef WindowsProgNameManyDots = path::program_name(
+ "C:\\Test.7\\x86_64-freebsd14.0-clang.exe", path::Style::windows);
+ EXPECT_EQ(WindowsProgNameManyDots, "x86_64-freebsd14.0-clang");
+
+ StringRef PosixProgName =
+ path::program_name("/var/empty/clang.exe", path::Style::posix);
+ EXPECT_EQ(PosixProgName, "clang");
+
+ StringRef PosixProgNameManyDotsExe = path::program_name(
+ "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.exe",
+ path::Style::posix);
+ EXPECT_EQ(PosixProgNameManyDotsExe, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+ StringRef PosixProgNameManyDots = path::program_name(
+ "/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar", path::Style::posix);
+ EXPECT_EQ(PosixProgNameManyDots, "x86_64-portbld-freebsd13.2-llvm-ar");
+
+ StringRef PosixProgNameSh =
+ path::program_name("/llvm-test16.4/x86_64-portbld-freebsd13.2-llvm-ar.sh",
+ path::Style::posix);
+ EXPECT_EQ(PosixProgNameSh, "x86_64-portbld-freebsd13.2-llvm-ar.sh");
+
+ // TODO: determine if this is correct. What happens on windows with an executable
+ // named ".exe"?
----------------
dankm wrote:
Makes sense, I'll do that in a subsequent commit.. hopefully that keeps the review intact.. still getting used to github.
https://github.com/llvm/llvm-project/pull/65812
More information about the llvm-commits
mailing list