View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0014766CMake(No Category)public2014-02-20 05:322014-10-06 10:32
ReporterMathieu Malaterre 
Assigned ToMathieu Malaterre 
PriorityhighSeveritymajorReproducibilityhave not tried
StatusclosedResolutionno change required 
PlatformOSOS Version
Product VersionCMake 2.8.12.2 
Target VersionFixed in Version 
Summary0014766: CTest does not handle executable extension properly
DescriptionHere is a simple scenarion, toolchain target mingw32 compiler on a linux host.

Steps:

$ more CMakeLists.txt toolchain.cmake zurg.c
::::::::::::::
CMakeLists.txt
::::::::::::::
cmake_minimum_required(VERSION 2.8)
project(wine_test C)

add_executable(zurg zurg.c)

enable_testing()

add_test(zurg zurg)
::::::::::::::
toolchain.cmake
::::::::::::::
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
set(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
set(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
::::::::::::::
zurg.c
::::::::::::::
int main()
{
  return 0;
}


Now build:

$ mkdir bin32
$ cd bin32
$ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain.cmake ..
$ make
$ make test
Running tests...
Test project /tmp/c/bin32
    Start 1: zurg
Could not find executable zurg
Looked in the following places:
zurg
zurg
Release/zurg
Release/zurg
Debug/zurg
Debug/zurg
MinSizeRel/zurg
MinSizeRel/zurg
RelWithDebInfo/zurg
RelWithDebInfo/zurg
Deployment/zurg
Deployment/zurg
Development/zurg
Development/zurg
Unable to find executable: zurg
1/1 Test #1: zurg .............................***Not Run 0.00 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 0.00 sec

The following tests FAILED:
      1 - zurg (Not Run)
Errors while running CTest
make: *** [test] Error 8
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0035157)
Nils Gladitz (developer)
2014-02-20 05:42

Does the following work?

  add_test(NAME zurg COMMAND zurg)
(0035158)
Mathieu Malaterre (developer)
2014-02-20 05:48

Obviously not, see http://whathaveyoutried.com [^]

The following hack does solve the symptoms:

add_test(zurg zurg.exe)
(0035159)
Nils Gladitz (developer)
2014-02-20 05:57

I assume you haven't actually tried it then since it does seem to work for me.

The NAME/COMMAND signature allows executable target names and resolves them to the actual output file while the plain signature does not.
(0035160)
Brad King (manager)
2014-02-20 08:03

Using the NAME/COMMAND mode of add_test is the way to solve this. The plain signature just runs the command-line given with no transformation. The NAME/COMMAND signature recognizes target names in argv[0] and does the right thing.
(0035161)
Mathieu Malaterre (developer)
2014-02-20 08:22

I admit that I did not know that and i did not even tried even when suggested. appologies for that. However the documentation could be improved in particular this sentence:

[...]
 add_test(testname Exename arg1 arg2 ... )
   [...] Exename can be
       either an executable built by this project or an arbitrary executable
       on the system (like tclsh).
   [...]

thanks and sorry for the noise
(0035162)
Brad King (manager)
2014-02-20 08:58

Actually the documentation of add_test needed some cleanup anyway. Done:

 Help: Revise and format add_test() command documentation
 http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8afa5fe8 [^]
(0036912)
Robert Maynard (manager)
2014-10-06 10:32

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

 Issue History
Date Modified Username Field Change
2014-02-20 05:32 Mathieu Malaterre New Issue
2014-02-20 05:42 Nils Gladitz Note Added: 0035157
2014-02-20 05:48 Mathieu Malaterre Note Added: 0035158
2014-02-20 05:57 Nils Gladitz Note Added: 0035159
2014-02-20 08:03 Brad King Note Added: 0035160
2014-02-20 08:03 Brad King Status new => resolved
2014-02-20 08:03 Brad King Resolution open => no change required
2014-02-20 08:22 Mathieu Malaterre Assigned To => Mathieu Malaterre
2014-02-20 08:22 Mathieu Malaterre Note Added: 0035161
2014-02-20 08:22 Mathieu Malaterre Status resolved => feedback
2014-02-20 08:22 Mathieu Malaterre Resolution no change required => reopened
2014-02-20 08:58 Brad King Note Added: 0035162
2014-02-20 08:58 Brad King Status feedback => resolved
2014-02-20 08:58 Brad King Resolution reopened => no change required
2014-10-06 10:32 Robert Maynard Note Added: 0036912
2014-10-06 10:32 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team