Skip to content
This repository has been archived by the owner on Nov 11, 2019. It is now read-only.

Commit

Permalink
staticanalysis/bot: Coverity catch all exceptions during the runtime …
Browse files Browse the repository at this point in the history
…of this Analyzer. (#1880)
  • Loading branch information
abpostelnicu authored Feb 13, 2019
1 parent 3b3e640 commit ae0252c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/staticanalysis/bot/static_analysis_bot/coverity/coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import json
import os
import shutil
import subprocess

import click

from cli_common.command import run_check
from cli_common.log import get_logger
Expand Down Expand Up @@ -119,15 +120,15 @@ def run(self, revision):
logger.info('Running Coverity Setup', cmd=cmd)
try:
run_check(cmd, cwd=self.cov_path)
except subprocess.CalledProcessError as e:
raise AnalysisException('coverity', 'Coverity Setup failed: {}'.format(e.output))
except click.ClickException:
raise AnalysisException('coverity', 'Coverity Setup failed!')

cmd = ['gecko-env', self.cov_configure, '--clang']
logger.info('Running Coverity Configure', cmd=cmd)
try:
run_check(cmd, cwd=self.cov_path)
except subprocess.CalledProcessError as e:
raise AnalysisException('coverity', 'Coverity Configure failed: {}'.format(e.output))
except click.ClickException:
raise AnalysisException('coverity', 'Coverity Configure failed!')

# For each element in commands_list run `cov-translate`
for element in commands_list:
Expand All @@ -138,8 +139,8 @@ def run(self, revision):
logger.info('Running Coverity Tranlate', cmd=cmd)
try:
run_check(cmd, cwd=element['directory'])
except subprocess.CalledProcessError as e:
raise AnalysisException('coverity', 'Coverity Translate failed: {}'.format(e.output))
except click.ClickException:
raise AnalysisException('coverity', 'Coverity Translate failed!')

# Once the capture is performed we need to do the actual Coverity Desktop analysis
cmd = [
Expand All @@ -150,8 +151,8 @@ def run(self, revision):
logger.info('Running Coverity Analysis', cmd=cmd)
try:
run_check(cmd, cwd=self.cov_state_path)
except subprocess.CalledProcessError as e:
raise AnalysisException('coverity', 'Coverity Analysis failed: {}'.format(e.output))
except click.ClickException:
raise AnalysisException('coverity', 'Coverity Analysis failed!')

# Write the results.json to the artifact directory to have it later on for debug
coverity_results_path = os.path.join(self.cov_state_path, 'cov-results.json')
Expand Down

0 comments on commit ae0252c

Please sign in to comment.