Esempio n. 1
0
model_config = json.load(open('model_config.json'))
# assumes a single lib_package_paths
for directory in model_config.get("lib_package_paths"):
    libraries = [os.getcwd()+'\\']
    for file in os.listdir(directory):
        file = os.path.join(directory, file)
        print 'file: '+file
        # not file.startswith(".") used to be the first clause here, but not 
        # possible with the relateive path from the 
        if (file.endswith(".mo") or (os.path.isdir(file) and os.path.isfile(os.path.join(file, "package.mo")))):
            libraries.append(file)

model_name = model_config.get('verification_model_name')
print 'libraries'
print libraries
jsonfile = PARC_QRM_Toolkit.do_envisionment_from_modelica(model_name, libraries, "../scripts/rewrite_rules.txt",CyPhy_output=True)
json_filename = os.path.join("..", model_config.get("result_file")) + ".qrm.json"
open(json_filename, "w").write(open(jsonfile).read())
print "json output file: "
print jsonfile
#os.unlink(jsonfile)

# update summary.testresults.json file
qrm_results = {}
with open(json_filename, 'r') as f_p_qrm_results:
    qrm_results = json.load(f_p_qrm_results)

results_filename = os.path.join('..', 'testbench_manifest.json')
results = {}
with open(results_filename, 'r') as f_p_results:
    results = json.load(f_p_results)
   
    tools = query_analysis_tools()
    # add QR.exe location to the path
    
    os.environ['PATH'] += str(os.pathsep + os.path.join(tools['QR']['InstallLocation'], 'bin'))

model_config = json.load(open('model_config.json'))
for directory in model_config.get("lib_package_paths"):
    libraries = [os.getcwd()+'\\']
    for file in os.listdir(directory):
        if not file.startswith(".") and (file.endswith(".mo") or (os.path.isdir(file) and os.path.isdir(os.path.join(file, "package.mo")))):
            libraries.append(os.path.join(directory, file))

model_name = model_config.get('verification_model_name')
print libraries
jsonfile = PARC_QRM_Toolkit.do_envisionment_from_modelica(model_name, libraries,CyPhy_output=True)
json_filename = os.path.join("..", model_config.get("result_file")) + ".qrm.json"
open(json_filename, "w").write(open(jsonfile).read())
os.unlink(jsonfile)

# update summary.testresults.json file
qrm_results = {}
with open(json_filename, 'r') as f_p_qrm_results:
    qrm_results = json.load(f_p_qrm_results)

results_filename = os.path.join('..', 'testbench_manifest.json')
results = {}
with open(results_filename, 'r') as f_p_results:
    results = json.load(f_p_results)
    
results.update(qrm_results)
Esempio n. 3
0
for directory in model_config.get("lib_package_paths"):
    libraries = [os.getcwd() + '\\']
    for file in os.listdir(directory):
        file = os.path.join(directory, file)
        print 'file: ' + file
        # not file.startswith(".") used to be the first clause here, but not
        # possible with the relateive path from the
        if (file.endswith(".mo")
                or (os.path.isdir(file)
                    and os.path.isfile(os.path.join(file, "package.mo")))):
            libraries.append(file)

model_name = model_config.get('verification_model_name')
print 'libraries'
print libraries
jsonfile = PARC_QRM_Toolkit.do_envisionment_from_modelica(
    model_name, libraries, "../scripts/rewrite_rules.txt", CyPhy_output=True)
json_filename = os.path.join("..",
                             model_config.get("result_file")) + ".qrm.json"
open(json_filename, "w").write(open(jsonfile).read())
print "json output file: "
print jsonfile
#os.unlink(jsonfile)

# update summary.testresults.json file
qrm_results = {}
with open(json_filename, 'r') as f_p_qrm_results:
    qrm_results = json.load(f_p_qrm_results)

results_filename = os.path.join('..', 'testbench_manifest.json')
results = {}
with open(results_filename, 'r') as f_p_results: