View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013887CMakeCTestpublic2013-02-02 17:512013-12-02 08:51
Reporterdon bright 
Assigned ToRolf Eike Beer 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product VersionCMake 2.8.10.2 
Target VersionCMake 2.8.12Fixed in VersionCMake 2.8.12 
Summary0013887: CTEST_CUSTOM_POST_TEST doesn't allow command line arguments anymore
DescriptionCTEST_CUSTOM_POST_TEST used to allow the user to run a command with arguments passed to it.

It doesn't allow command line arguments anymore.

Steps To ReproduceWrite a CTestCustom.cmake file that does this:

set(CTEST_CUSTOM_POST_TEST "echo hello")


It should actually print 'hello' after the tests are run.

If you use an older version of ctest, this will be fine.
If you use a newer version, you will get an error when you run ctest.

We are having issues with this with OpenSCAD:

https://github.com/openscad/openscad/issues/260 [^]

And a recent patch to cmake seems to be the cause

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6187876dea89618044e200808bcae75a18bd4043 [^]

Thanks

TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0032187)
don bright (reporter)
2013-02-02 18:12

Actually now that I think about it is probably breaks CTEST_CUSTOM_PRE_TEST as well, although I haven't tested.
(0032188)
Rolf Eike Beer (developer)
2013-02-03 03:58

I'm pretty sure it will.

Until now it would have not worked if the program passed was something like "c:/program files/...". As a workaround I would say use a script as post-command, although that may not really work if the command is composed from variables.
(0032189)
don bright (reporter)
2013-02-03 07:28

my question is can a script be made executable on all platforms?

a .py file for example... will it 'execute' under windows, linux, and mac, just by itself when passed to CTEST_CUSTOM_POST_TEST('posttest.py') ? how does it know which python executable it will be using?

we were using something like this '${PYTHON_EXECUTABLE} posttest.py ${CMAKE_CURRENT_BIN_DIR}'... but that is using an argument.
(0033546)
Baptist BENOIST (reporter)
2013-07-16 07:22
edited on: 2013-07-16 07:22

@Rolf Eike Beer:
I must understand correctly the reasons you made such a commit before pushing a reversal of it 6187876dea89618044e200808bcae75a18bd40 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6187876dea89618044e200808bcae75a18bd40 [^]

What exactly was the problem which forced you to make such a commit?

I think that a command such as C:/Dir with spaces/any.exe (per example) worked before your commit if quoted properly in its definition:
set (CTEST_CUSTOM_POST_TEST "\"C:/Dir with spaces/any.exe\" one arg")

As the documentation states http://cmake.org/Wiki/CMake/Testing_With_CTest#Customizing_CTest, [^] the properties CTEST_CUSTOM_POST_TEST, CTEST_CUSTOM_PRE_TEST, CTEST_CUSTOM_POST_MEMCHECK and CTEST_CUSTOM_PRE_MEMCHECK can be used to execute a complete command, not simply the path of an executable.
Considering this, the commit that I would like to revert should not have been coded and merged to the official repository because the functionality is no more working as expected.

@don bright:
Your workaround may be useful to me if I am wrong in my commit reversal attempt; thank you for this.

(0033548)
Baptist BENOIST (reporter)
2013-07-16 08:14

For more information about my motivations on this problem, here is the related issue for the distribution on which I am working on: https://github.com/NixOS/nixpkgs/issues/762 [^]
(0033552)
Mathias Gaunard (reporter)
2013-07-16 09:19

I think the commit in question tried to change the code so that the following code:
SET(CTEST_CUSTOM_POST_TEST "/path\\ with\\ spaces/lapack_testing.py -s -d TESTING")

Should be written like so instead:
SET(CTEST_CUSTOM_POST_TEST "/path with spaces/lapack_testing.py" -s -d TESTING)

Obviously this was done wrong, as even that doesn't work.
The suggested change, if implemented correctly, would also prevent from having several commands in CTEST_CUSTOM_POST_TEST. I think the person who did the change didn't fully understand how this property was supposed to be used.

Reverting to the old behaviour is the correct fix IMHO. For this property, the responsibility of escaping slashes lies with the user. To change this, we'd have to introduce COMMAND prefixes like execute_process.
(0033558)
Baptist BENOIST (reporter)
2013-07-16 12:09

@Mathias Gaunard: It's clearer now. This comfort my opinion on a reversal of the problematic commit.
Also, I totally agree with you about the COMMAND prefix already used in execute_process. To my mind, CTEST_CUSTOM_POST_TEST and similar properties should have been macros having the same behavior than execute_command.
(0033578)
Rolf Eike Beer (developer)
2013-07-23 02:25

Would a list (separated by ";") work for you? So you would set the property to be "/some path/program;arg;other arg"?
(0033579)
Mathias Gaunard (reporter)
2013-07-23 07:57

Isn't
"/some path/program;arg;other arg"
just another way to write
"/some path/program" arg "other arg"
?

This still has the obvious issue that you cannot have multiple commands.
(0033580)
Robert Maynard (manager)
2013-07-23 09:13

I believe the original behavior of being able to run a single command like "python pretty_print.py --color" should be valid. I think treating the full string as a single path is undesired behavior.
(0033599)
Baptist BENOIST (reporter)
2013-07-25 05:03

@Rolf: I do not agree with your proposal of using "/some path/program;arg;other arg" as it prevents from executing multiple commands.

Ultimately, and that how CMake worked before, such a command string should work:
"echo hello world>/path\\ with\\ spaces/file;echo done"
or on Windows (under the responsibility of the end-developer)
"echo hello world>\"C:/path with spaces/file\";echo done"
the following one should also be acceptable:
"echo hello world>/path\\ with\\ spaces/file" "echo done"

As previously said, the most convenient solution for me would be to have the exact same behavior than the execute_process macro which combines the best of both needs. Until such a change is not being released, I would prefer to keep the previous one by reverting the commit 6187876dea89618044e200808bcae75a18bd40.

@Mathias:
> Isn't
> "/some path/program;arg;other arg"
> just another way to write
> "/some path/program" arg "other arg"
> ?
Accordingly to the CMake syntax guidelines, yes it is : http://www.cmake.org/cmake/help/syntax.html [^]
(0033621)
Rolf Eike Beer (developer)
2013-07-27 16:12

Fix merged to next:

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c0756b6dd67b7f2e113dafde398cec597537068c [^]

This also fixes a testcase that would fail on a path with spaces now, so exactly your use case is tested now as I also added command line args to that pre and post commands.
(0034660)
Robert Maynard (manager)
2013-12-02 08:51

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2013-02-02 17:51 don bright New Issue
2013-02-02 18:12 don bright Note Added: 0032187
2013-02-03 03:58 Rolf Eike Beer Note Added: 0032188
2013-02-03 07:28 don bright Note Added: 0032189
2013-07-16 07:22 Baptist BENOIST Note Added: 0033546
2013-07-16 07:22 Baptist BENOIST Note Edited: 0033546
2013-07-16 08:14 Baptist BENOIST Note Added: 0033548
2013-07-16 09:19 Mathias Gaunard Note Added: 0033552
2013-07-16 12:09 Baptist BENOIST Note Added: 0033558
2013-07-23 02:25 Rolf Eike Beer Note Added: 0033578
2013-07-23 07:57 Mathias Gaunard Note Added: 0033579
2013-07-23 09:13 Robert Maynard Note Added: 0033580
2013-07-25 05:03 Baptist BENOIST Note Added: 0033599
2013-07-27 16:12 Rolf Eike Beer Note Added: 0033621
2013-07-27 16:12 Rolf Eike Beer Assigned To => Rolf Eike Beer
2013-07-27 16:12 Rolf Eike Beer Status new => resolved
2013-07-27 16:12 Rolf Eike Beer Resolution open => fixed
2013-07-27 16:12 Rolf Eike Beer Fixed in Version => CMake 2.8.12
2013-07-27 16:12 Rolf Eike Beer Target Version => CMake 2.8.12
2013-12-02 08:51 Robert Maynard Note Added: 0034660
2013-12-02 08:51 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team