Files
style_checker/testsuite/lib/utils.py
Joel Brobecker 7212c8d93c First cut at the new AdaCore Style Checker (ASC)
It should support most kinds of files, except those we no longer
need to check (KP, features), and Java (to be implemented separately,
and hopefully soon).

This includes a testsuite, with coverage measurement. Coverage is
not complete yet (95%, or 24 lines still not covered), but the aim
is to have full coverage.

For NA17-007.
2017-04-18 15:35:50 -07:00

33 lines
952 B
Python

"""A module providing some generally useful stuff.
"""
import sys
def abort(exit_code=0):
"""Abort the execution of the current process. Any cleanup that
might be needed before aborting is guaranteed to be performed.
PARAMETERS
exit_code: The process exit code sent to the parent process.
REMARKS
This function is meant to be a routine that knows what to do
depending on whether we're inside the main-loop process, or
if we're inside a testcase process. As of the time of this writing,
it is sufficient for either process to just call sys.exit. But
there might come a day when we might need to do different things
depending on the process.
"""
sys.exit(exit_code)
def fatal_error(msg):
"""Print the given message on standard output and then exit immediately.
PARAMETERS
msg: The error message to print.
"""
print "*** Error: " + msg
abort(1)