mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #10976 from ethereum/fix-boost-filesystem-bug
Tests: Do not remove filename from boost filesystem path for corner cases
This commit is contained in:
commit
02b27bdc64
@ -137,7 +137,11 @@ string solidity::util::absolutePath(string const& _path, string const& _referenc
|
|||||||
if (p.begin() == p.end() || (*p.begin() != "." && *p.begin() != ".."))
|
if (p.begin() == p.end() || (*p.begin() != "." && *p.begin() != ".."))
|
||||||
return _path;
|
return _path;
|
||||||
boost::filesystem::path result(_reference);
|
boost::filesystem::path result(_reference);
|
||||||
result.remove_filename();
|
|
||||||
|
// If filename is "/", then remove_filename() throws.
|
||||||
|
// See: https://github.com/boostorg/filesystem/issues/176
|
||||||
|
if (result.filename() != boost::filesystem::path("/"))
|
||||||
|
result.remove_filename();
|
||||||
for (boost::filesystem::path::iterator it = p.begin(); it != p.end(); ++it)
|
for (boost::filesystem::path::iterator it = p.begin(); it != p.end(); ++it)
|
||||||
if (*it == "..")
|
if (*it == "..")
|
||||||
result = result.parent_path();
|
result = result.parent_path();
|
||||||
|
@ -84,7 +84,10 @@ echo "Looking at $NSOURCES .sol files..."
|
|||||||
WORKINGDIR=$PWD
|
WORKINGDIR=$PWD
|
||||||
|
|
||||||
# for solfile in $(find $DEV_DIR -name *.sol)
|
# for solfile in $(find $DEV_DIR -name *.sol)
|
||||||
for solfile in $(find "$SYNTAXTESTS_DIR" "$ASTJSONTESTS_DIR" -name *.sol)
|
# boost_filesystem_bug specifically tests a local fix for a boost::filesystem
|
||||||
|
# bug. Since the test involves a malformed path, there is no point in running
|
||||||
|
# AST tests on it. See https://github.com/boostorg/filesystem/issues/176
|
||||||
|
for solfile in $(find "$SYNTAXTESTS_DIR" "$ASTJSONTESTS_DIR" -name *.sol -and -not -name "boost_filesystem_bug.sol")
|
||||||
do
|
do
|
||||||
echo -n "."
|
echo -n "."
|
||||||
# create a temporary sub-directory
|
# create a temporary sub-directory
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
==== Source://// ====
|
||||||
|
// This test used to throw due to a bug in boost::filesystem.
|
||||||
|
// See https://github.com/boostorg/filesystem/issues/176
|
||||||
|
import ".";
|
@ -70,5 +70,5 @@ while read -r file; do
|
|||||||
echo "$file"
|
echo "$file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done < <(find "${REPO_ROOT}/test" -iname "*.sol" -and -not -name "documentation.sol")
|
done < <(find "${REPO_ROOT}/test" -iname "*.sol" -and -not -name "documentation.sol" -and -not -name "boost_filesystem_bug.sol")
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user