From 2089e762d00cbfdc8db55fd61f55e2f7efa46f67 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 27 Oct 2020 16:24:47 -0400 Subject: [PATCH] [libc++] Try to fix cross-loading of lit.local.cfg on Windows On windows, the previous path replacement using forward slashes wouldn't work, and so we'd end up including the same file again. We would do that until we'd hit the recursion limit of the Python interpreter. Instead, use `os.path` to properly replace without assuming a specific path separator. --- libcxx/test/libcxx/input.output/file.streams/lit.local.cfg | 4 +++- libcxx/test/libcxx/input.output/iostream.format/lit.local.cfg | 4 +++- libcxx/test/libcxx/input.output/iostream.objects/lit.local.cfg | 4 +++- libcxx/test/libcxx/input.output/iostreams.base/lit.local.cfg | 4 +++- libcxx/test/libcxx/input.output/stream.buffers/lit.local.cfg | 4 +++- libcxx/test/libcxx/input.output/string.streams/lit.local.cfg | 4 +++- libcxx/test/libcxx/localization/lit.local.cfg | 4 +++- 7 files changed, 21 insertions(+), 7 deletions(-) diff --git a/libcxx/test/libcxx/input.output/file.streams/lit.local.cfg b/libcxx/test/libcxx/input.output/file.streams/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/file.streams/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/file.streams/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/input.output/iostream.format/lit.local.cfg b/libcxx/test/libcxx/input.output/iostream.format/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/iostream.format/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/iostream.format/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/input.output/iostream.objects/lit.local.cfg b/libcxx/test/libcxx/input.output/iostream.objects/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/iostream.objects/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/iostream.objects/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/input.output/iostreams.base/lit.local.cfg b/libcxx/test/libcxx/input.output/iostreams.base/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/iostreams.base/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/iostreams.base/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/input.output/stream.buffers/lit.local.cfg b/libcxx/test/libcxx/input.output/stream.buffers/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/stream.buffers/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/stream.buffers/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/input.output/string.streams/lit.local.cfg b/libcxx/test/libcxx/input.output/string.streams/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/input.output/string.streams/lit.local.cfg +++ b/libcxx/test/libcxx/input.output/string.streams/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) diff --git a/libcxx/test/libcxx/localization/lit.local.cfg b/libcxx/test/libcxx/localization/lit.local.cfg index 1fc6b79..b89e35b 100644 --- a/libcxx/test/libcxx/localization/lit.local.cfg +++ b/libcxx/test/libcxx/localization/lit.local.cfg @@ -1,4 +1,6 @@ # Load the same local configuration as the corresponding one in libcxx/test/std import os -localConfig = os.path.realpath(__file__).replace('/test/libcxx/', '/test/std/') +inLibcxx = os.path.join('libcxx', 'test', 'libcxx') +inStd = os.path.join('libcxx', 'test', 'std') +localConfig = os.path.normpath(os.path.realpath(__file__)).replace(inLibcxx, inStd) config.load_from_path(localConfig, lit_config) -- 2.7.4