[PATCH] D83373: [analyzer][tests] Make test interruption safe
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 01:32:38 PDT 2020
vsavchenko created this revision.
vsavchenko added reviewers: NoQ, dcoughlin, xazax.hun.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, baloghadamsoftware.
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83373
Files:
clang/utils/analyzer/SATest.py
Index: clang/utils/analyzer/SATest.py
===================================================================
--- clang/utils/analyzer/SATest.py
+++ clang/utils/analyzer/SATest.py
@@ -132,27 +132,35 @@
pass
finally:
- print("Please wait for docker to clean up")
- call("docker stop satest", shell=True)
+ docker_cleanup()
def docker_run(args, command, docker_args=""):
- return call("docker run --rm --name satest "
- "-v {llvm}:/llvm-project "
- "-v {build}:/build "
- "-v {clang}:/analyzer "
- "-v {scripts}:/scripts "
- "-v {projects}:/projects "
- "{docker_args} "
- "satest-image:latest {command}"
- .format(llvm=args.llvm_project_dir,
- build=args.build_dir,
- clang=args.clang_dir,
- scripts=SCRIPTS_DIR,
- projects=PROJECTS_DIR,
- docker_args=docker_args,
- command=command),
- shell=True)
+ try:
+ return call("docker run --rm --name satest "
+ "-v {llvm}:/llvm-project "
+ "-v {build}:/build "
+ "-v {clang}:/analyzer "
+ "-v {scripts}:/scripts "
+ "-v {projects}:/projects "
+ "{docker_args} "
+ "satest-image:latest {command}"
+ .format(llvm=args.llvm_project_dir,
+ build=args.build_dir,
+ clang=args.clang_dir,
+ scripts=SCRIPTS_DIR,
+ projects=PROJECTS_DIR,
+ docker_args=docker_args,
+ command=command),
+ shell=True)
+
+ except KeyboardInterrupt:
+ docker_cleanup()
+
+
+def docker_cleanup():
+ print("Please wait for docker to clean up")
+ call("docker stop satest", shell=True)
def main():
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83373.276337.patch
Type: text/x-patch
Size: 2087 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/ad699511/attachment.bin>
More information about the cfe-commits
mailing list