[windows] cannot run test-misra (binary not found) (#2441)
set PYTHONPATH=addons python -m pytest addons/test/test-misra.py
This commit is contained in:
parent
1c92170179
commit
40aefa1ba4
|
@ -1,9 +1,25 @@
|
||||||
# Helpers for pytest tests
|
# Helpers for pytest tests
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
def find_cppcheck_binary():
|
||||||
|
possible_locations = [
|
||||||
|
"./cppcheck",
|
||||||
|
r".\bin\cppcheck.exe",
|
||||||
|
]
|
||||||
|
for location in possible_locations:
|
||||||
|
if os.path.exists(location):
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise RuntimeError("Could not fine cppcheck binary")
|
||||||
|
|
||||||
|
return location
|
||||||
|
|
||||||
def dump_create(fpath, *argv):
|
def dump_create(fpath, *argv):
|
||||||
cmd = ["./cppcheck", "--dump", "--quiet", fpath] + list(argv)
|
cppcheck_binary = find_cppcheck_binary()
|
||||||
|
cmd = [cppcheck_binary, "--dump", "--quiet", fpath] + list(argv)
|
||||||
p = subprocess.Popen(cmd)
|
p = subprocess.Popen(cmd)
|
||||||
p.communicate()
|
p.communicate()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
|
|
Loading…
Reference in New Issue