Add 3 new type of tests for travis:

- tests_cli: tests some of the cli flags
- test_pritners: call all the printers
- test_slither_config: test the --config flag

Additionally:
- "all" can be selected for printers (all the printers are then run)
- 'ignore_return_value' can be set in the config file
pull/208/head
Josselin 6 years ago
parent 12cdcc2e87
commit 97b4f5cc7c
  1. 3
      .travis.yml
  2. 24
      scripts/travis_test_cli.sh
  3. 11
      scripts/travis_test_printers.sh
  4. 11
      scripts/travis_test_slither_config.sh
  5. 9
      slither/__main__.py
  6. 6
      tests/config/slither.config.json

@ -15,6 +15,9 @@ env:
- TEST_SUITE=scripts/travis_test_etherscan.sh
- TEST_SUITE=scripts/travis_test_dapp.sh
- TEST_SUITE=scripts/travis_test_etherlime.sh
- TEST_SUITE=scripts/travis_test_cli.sh
- TEST_SUITE=scripts/travis_test_printers.sh
- TEST_SUITE=scripts/travis_test_slither_config.sh
branches:
only:
- master

@ -0,0 +1,24 @@
#!/usr/bin/env bash
### Test
slither "tests/*.json" --solc-ast --ignore-return-value
if [ $? -ne 0 ]; then
echo "--solc-ast failed"
exit 1
fi
slither "tests/*.sol" --solc-disable-warnings --ignore-return-value
if [ $? -ne 0 ]; then
echo "--solc-ast failed"
exit 1
fi
slither "tests/*.sol" --disable-color --ignore-return-value
if [ $? -ne 0 ]; then
echo "--disable-color failed"
exit 1
fi

@ -0,0 +1,11 @@
#!/usr/bin/env bash
### Test printer
slither "tests/*.json" --print all
if [ $? -ne 0 ]; then
echo "Printer tests failed"
exit 1
fi

@ -0,0 +1,11 @@
#!/usr/bin/env bash
### Test
slither "tests/*.json" --config "tests/config/slither.config.json"
if [ $? -ne 0 ]; then
echo "Config failed"
exit 1
fi

@ -205,6 +205,9 @@ def choose_printers(args, all_printer_classes):
if args.printers_to_run is None:
return []
if args.printers_to_run == 'all':
return all_printer_classes
printers = {p.ARGUMENT: p for p in all_printer_classes}
for p in args.printers_to_run.split(','):
if p in printers:
@ -245,7 +248,9 @@ defaults_flag_in_config = {
'truffle_build_directory': 'build/contracts',
'embark_ignore_compile': False,
'embark_overwrite_config': False,
'legacy_ast': False
# debug command
'legacy_ast': False,
'ignore_return_value': False
}
def parse_args(detector_classes, printer_classes):
@ -391,7 +396,7 @@ def parse_args(detector_classes, printer_classes):
parser.add_argument('--ignore-return-value',
help=argparse.SUPPRESS,
action='store_true',
default=False)
default=defaults_flag_in_config['ignore_return_value'])
# if the json is splitted in different files
parser.add_argument('--splitted',

@ -0,0 +1,6 @@
{
"detectors_to_run": "all",
"exclude_informational": true,
"exclude_low": true,
"ignore_return_value": true
}
Loading…
Cancel
Save