mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use correct solcjs binary for testing.
This commit is contained in:
parent
97d3b88f65
commit
aba879f39f
@ -44,15 +44,26 @@ function test_truffle
|
|||||||
echo "Running $name tests..."
|
echo "Running $name tests..."
|
||||||
DIR=$(mktemp -d)
|
DIR=$(mktemp -d)
|
||||||
(
|
(
|
||||||
|
cd "$DIR"
|
||||||
|
git clone --depth 1 -b v0.5.0 https://github.com/ethereum/solc-js.git solc
|
||||||
|
SOLCVERSION="UNDEFINED"
|
||||||
|
|
||||||
|
cd solc
|
||||||
|
npm install
|
||||||
|
cp "$SOLJSON" soljson.js
|
||||||
|
SOLCVERSION=$(./solcjs --version)
|
||||||
|
cd ..
|
||||||
|
echo "Using solcjs version $SOLCVERSION"
|
||||||
|
|
||||||
if [ -n "$branch" ]
|
if [ -n "$branch" ]
|
||||||
then
|
then
|
||||||
echo "Cloning $branch of $repo..."
|
echo "Cloning $branch of $repo..."
|
||||||
git clone --depth 1 "$repo" -b "$branch" "$DIR"
|
git clone --depth 1 "$repo" -b "$branch" "$DIR/ext"
|
||||||
else
|
else
|
||||||
echo "Cloning $repo..."
|
echo "Cloning $repo..."
|
||||||
git clone --depth 1 "$repo" "$DIR"
|
git clone --depth 1 "$repo" "$DIR/ext"
|
||||||
fi
|
fi
|
||||||
cd "$DIR"
|
cd ext
|
||||||
echo "Current commit hash: `git rev-parse HEAD`"
|
echo "Current commit hash: `git rev-parse HEAD`"
|
||||||
npm install
|
npm install
|
||||||
# Replace solc package by v0.5.0
|
# Replace solc package by v0.5.0
|
||||||
@ -64,7 +75,7 @@ function test_truffle
|
|||||||
cd $d
|
cd $d
|
||||||
rm -rf solc
|
rm -rf solc
|
||||||
git clone --depth 1 -b v0.5.0 https://github.com/ethereum/solc-js.git solc
|
git clone --depth 1 -b v0.5.0 https://github.com/ethereum/solc-js.git solc
|
||||||
cp "$SOLJSON" solc/
|
cp "$SOLJSON" solc/soljson.js
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
@ -73,16 +84,16 @@ function test_truffle
|
|||||||
# Replace fixed-version pragmas in Gnosis (part of Consensys best practice)
|
# Replace fixed-version pragmas in Gnosis (part of Consensys best practice)
|
||||||
find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity [\^0-9\.]*/pragma solidity >=0.0/'
|
find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity [\^0-9\.]*/pragma solidity >=0.0/'
|
||||||
fi
|
fi
|
||||||
assertsol="node_modules/truffle/build/Assert.sol"
|
# Change "compileStandard" to "compile" (needed for pre-5.x Truffle)
|
||||||
if [ -f "$assertsol" ]
|
|
||||||
then
|
|
||||||
echo "Replace Truffle's Assert.sol with a known good version"
|
|
||||||
rm "$assertsol"
|
|
||||||
wget https://raw.githubusercontent.com/trufflesuite/truffle-core/ef31bcaa15dbd9bd0f6a0070a5c63f271cde2dbc/lib/testing/Assert.sol -o "$assertsol"
|
|
||||||
fi
|
|
||||||
# Change "compileStandard" to "compile"
|
|
||||||
sed -i s/solc.compileStandard/solc.compile/ "node_modules/truffle/build/cli.bundled.js"
|
sed -i s/solc.compileStandard/solc.compile/ "node_modules/truffle/build/cli.bundled.js"
|
||||||
|
# Force usage of correct solidity binary (only works with Truffle 5.x)
|
||||||
|
cat >> truffle*.js <<EOF
|
||||||
|
module.exports['compilers'] = {solc: {version: "$DIR/solc"} };
|
||||||
|
EOF
|
||||||
|
|
||||||
npx truffle compile
|
npx truffle compile
|
||||||
|
echo "Verify that the correct version ($SOLCVERSION) of the compiler was used to compile the contracts..."
|
||||||
|
grep -e "$SOLCVERSION" -r build/contracts > /dev/null
|
||||||
npm run test
|
npm run test
|
||||||
)
|
)
|
||||||
rm -rf "$DIR"
|
rm -rf "$DIR"
|
||||||
|
Loading…
Reference in New Issue
Block a user