[LNT] r308230 - "lnt profile upgrade" crashes when output points to an inexistent file

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 16:00:15 PDT 2017


Author: cmatthews
Date: Mon Jul 17 16:00:15 2017
New Revision: 308230

URL: http://llvm.org/viewvc/llvm-project?rev=308230&view=rev
Log:
"lnt profile upgrade" crashes when output points to an inexistent file

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.

This change:

 - prevents click to check the path beforehand
 - adds a test case to check "lnt profile upgrade" output to a new file

Patch by Leandro Nunes.

Modified:
    lnt/trunk/lnt/lnttool/main.py
    lnt/trunk/tests/lnttool/Profile.py

Modified: lnt/trunk/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=308230&r1=308229&r2=308230&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/main.py (original)
+++ lnt/trunk/lnt/lnttool/main.py Mon Jul 17 16:00:15 2017
@@ -370,7 +370,7 @@ def action_profile():
 
 @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

Modified: lnt/trunk/tests/lnttool/Profile.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/lnttool/Profile.py?rev=308230&r1=308229&r2=308230&view=diff
==============================================================================
--- lnt/trunk/tests/lnttool/Profile.py (original)
+++ lnt/trunk/tests/lnttool/Profile.py Mon Jul 17 16:00:15 2017
@@ -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




More information about the llvm-commits mailing list