diff --git a/test/FilesystemUtils.cpp b/test/FilesystemUtils.cpp index c016f7fd1..159568c62 100644 --- a/test/FilesystemUtils.cpp +++ b/test/FilesystemUtils.cpp @@ -53,13 +53,17 @@ void solidity::test::createFileWithContent(boost::filesystem::path const& _path, } bool solidity::test::createSymlinkIfSupportedByFilesystem( - boost::filesystem::path const& _targetPath, + boost::filesystem::path _targetPath, boost::filesystem::path const& _linkName, bool _directorySymlink ) { boost::system::error_code symlinkCreationError; + // NOTE: On Windows / works as a separator in a symlink target only if the target is absolute. + // Convert path separators to native ones to avoid this problem. + _targetPath.make_preferred(); + if (_directorySymlink) boost::filesystem::create_directory_symlink(_targetPath, _linkName, symlinkCreationError); else diff --git a/test/FilesystemUtils.h b/test/FilesystemUtils.h index f993ce03d..731260505 100644 --- a/test/FilesystemUtils.h +++ b/test/FilesystemUtils.h @@ -46,7 +46,7 @@ void createFileWithContent(boost::filesystem::path const& _path, std::string con /// support symlinks. /// Throws an exception of the operation fails for a different reason. bool createSymlinkIfSupportedByFilesystem( - boost::filesystem::path const& _targetPath, + boost::filesystem::path _targetPath, boost::filesystem::path const& _linkName, bool _directorySymlink ); diff --git a/test/solc/CommandLineInterface.cpp b/test/solc/CommandLineInterface.cpp index 0023e9f57..b76d86ee8 100644 --- a/test/solc/CommandLineInterface.cpp +++ b/test/solc/CommandLineInterface.cpp @@ -786,12 +786,7 @@ BOOST_AUTO_TEST_CASE(cli_paths_to_source_unit_names_symlinks) TemporaryWorkingDirectory tempWorkDir(tempDir.path() / "r"); if ( -#if !defined(_WIN32) !createSymlinkIfSupportedByFilesystem("../x/y", tempDir.path() / "r/sym", true) || -#else - // NOTE: On Windows / works as a separator in a symlink target only if the target is absolute - !createSymlinkIfSupportedByFilesystem("..\\x\\y", tempDir.path() / "r/sym", true) || -#endif !createSymlinkIfSupportedByFilesystem("contract.sol", tempDir.path() / "x/y/z/contract_symlink.sol", false) ) return;