Skip to content

Commit

Permalink
Merge pull request #4212 from noraz31/missing_report_dir_alert
Browse files Browse the repository at this point in the history
Do not allow parse if the <report dir> does not exist
  • Loading branch information
Szelethus authored Apr 30, 2024
2 parents 56fe901 + 932a25c commit 2afffe6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions analyzer/codechecker_analyzer/cmd/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ def main(args):
LOG.error(fnerr)
sys.exit(1)

incorrect_input_paths = [input_path for input_path in args.input
if not os.path.exists(input_path)]

if incorrect_input_paths:
for input_path in incorrect_input_paths:
LOG.error(f"Input path {input_path} does not exist!")
sys.exit(1)

export = args.export if 'export' in args else None
if export == 'html' and 'output_path' not in args:
LOG.error("Argument --export not allowed without argument --output "
Expand Down
11 changes: 11 additions & 0 deletions analyzer/tests/functional/cmdline/test_cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ def test_analyzer_config(self):
self.assertTrue(desc)
self.assertFalse(desc[0].islower())

def test_parse_incorrect_file_path(self):
"""
This test checks whether the parse command stops running if a
non-existent path is specified.
"""

parse_cmd = [env.codechecker_cmd(), 'parse', '/asd/123/qwe']

self.assertIn('Input path /asd/123/qwe does not exist!',
run_cmd(parse_cmd)[1])

def test_analyze_incorrect_checker_analyzer(self):
"""
This test checks whether the analyze command stops running if a
Expand Down

0 comments on commit 2afffe6

Please sign in to comment.