coverage.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Executes cleanup function at script exit.
  3. trap cleanup EXIT
  4. cleanup() {
  5. # Kill the testrpc instance that we started (if we started one).
  6. if [ -n "$testrpc_pid" ]; then
  7. kill -9 $testrpc_pid
  8. fi
  9. }
  10. testrpc_running() {
  11. nc -z localhost 8555
  12. }
  13. if testrpc_running; then
  14. echo "Using existing testrpc-sc instance"
  15. else
  16. echo "Starting testrpc-sc to generate coverage"
  17. # We define 10 accounts with balance 1M ether, needed for high-value tests.
  18. ./node_modules/ethereumjs-testrpc-sc/bin/testrpc --gasLimit 0xfffffffffff --port 8555 \
  19. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501200,1000000000000000000000000" \
  20. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501201,1000000000000000000000000" \
  21. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501202,1000000000000000000000000" \
  22. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501203,1000000000000000000000000" \
  23. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501204,1000000000000000000000000" \
  24. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501205,1000000000000000000000000" \
  25. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501206,1000000000000000000000000" \
  26. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501207,1000000000000000000000000" \
  27. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501208,1000000000000000000000000" \
  28. --account="0x2bdd21761a483f71054e14f5b827213567971c676928d9a1808cbfa4b7501209,1000000000000000000000000" \
  29. > /dev/null &
  30. testrpc_pid=$!
  31. fi
  32. SOLIDITY_COVERAGE=true ./node_modules/.bin/solidity-coverage