[PATCH] D35415: [LNT] "lnt profile upgrade" crashes when output points to an inexistent file
Leandro Nunes via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 14 06:17:46 PDT 2017
leandron created this revision.
Regression when moving to "click" for command line parsing. "lnt profile upgrade" crashes when output points to an inexistent file. Also adds a test case.
So, this change:
- prevents click to check the path beforehand
- adds a test case to check "lnt profile upgrade" output to a new file
https://reviews.llvm.org/D35415
Files:
lnt/lnttool/main.py
tests/lnttool/Profile.py
Index: tests/lnttool/Profile.py
===================================================================
--- tests/lnttool/Profile.py
+++ tests/lnttool/Profile.py
@@ -9,3 +9,8 @@
# RUN: lnt profile getCodeForFunction %S/Inputs/test.lntprof fn1 | FileCheck --check-prefix=CHECK-GETFN1 %s
# CHECK-GETFN1: [{}, 1048576, "add r0, r0, r0"], [{"cycles": 100.0}, 1048580, "sub r1, r0, r0"]]
+
+# RUN: mkdir -p %t
+# RUN: rm -rf %t/non_existing_output.lnt
+# RUN: lnt profile upgrade %S/Inputs/test.lntprof %t/non_existing_output.lnt
+# RUN: cat %t/non_existing_output.lnt
Index: lnt/lnttool/main.py
===================================================================
--- lnt/lnttool/main.py
+++ lnt/lnttool/main.py
@@ -370,7 +370,7 @@
@action_profile.command("upgrade")
@click.argument("input", type=click.Path(exists=True))
- at click.argument("output", type=click.Path(exists=True))
+ at click.argument("output", type=click.Path())
def command_update(input, output):
"""upgrade a profile to the latest version"""
import lnt.testing.profile.profile as profile
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35415.106636.patch
Type: text/x-patch
Size: 1062 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170714/750e7e38/attachment.bin>
More information about the llvm-commits
mailing list