mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
checksum enhancement for -d option (#1579)
* Added input file SHA1 info being printed on screen when running a trick sim with -d option (basically verifying the input) * Added additional checks to exclude trace info printout for file in /opt or .trick/ or not a real file such as <xxx> as the filename.
This commit is contained in:
parent
d38dcf00d9
commit
73cc7aabfa
@ -140,6 +140,11 @@ int Trick::IPPython::init() {
|
||||
}
|
||||
|
||||
if ( verify_input ) {
|
||||
std::stringstream ss ;
|
||||
ss << "import hashlib" << std::endl ;
|
||||
ss << "input_file = " << "'" << input_file.c_str() << "'" << std::endl;
|
||||
ss << "print('{0} SHA1: {1}'.format(input_file,hashlib.sha1(open(input_file, 'rb').read()).hexdigest()))" << std::endl ;
|
||||
PyRun_SimpleString(ss.str().c_str()) ;
|
||||
exec_terminate_with_return(ret , __FILE__ , __LINE__ , "Input file verification complete\n" ) ;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ def traceit(frame, event, arg):
|
||||
if event == "line":
|
||||
lineno = frame.f_lineno
|
||||
filename = frame.f_code.co_filename
|
||||
if ( not filename.startswith(exclude_dir) and not filename.startswith("/usr")):
|
||||
if ( not filename.startswith(exclude_dir) and not filename.startswith("/usr") and not filename.startswith("/opt") and not filename.startswith("<") and not filename.startswith(".trick/") ):
|
||||
if (filename.endswith(".pyc") or
|
||||
filename.endswith(".pyo")):
|
||||
filename = filename[:-1]
|
||||
|
Loading…
Reference in New Issue
Block a user