Hi,

I am having difficulty getting a python script to run a C++ subprocess
on Window 7 using VS2013. On Linux, the following code works fine, but
on Windows, from the command line I get the following output:

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Running tests...
Test project C:/work/s/sandbox/ctestpy/b
    Start 1: sample_test
1/1 Test #1: sample_test ......................***Not Run   0.00 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.06 sec

The following tests FAILED:
          1 - sample_test (BAD_COMMAND)
Errors while running CTest
NMAKE : fatal error U1077: 'echo' : return code '0x8'
Stop.

No matter what options I supply to ctest, I can't seem to get any
additional insight. I am assuming that for some reason the
WORKING_DIRECTORY isn't being obeyed on Windows?

If I run the python script manually from the command prompt, it works
fine. The python executable is in my $PATH.On Linux I am using CMake
3.3.1, and on Windows I have CMake 3.2.3.

----

sample.cpp

int main()
{
  return 0;
}

--------------

sample_test.py

#!/usr/bin/env python
import sys
import subprocess

sample = subprocess.Popen("./sample")
sample.wait()
if sample.returncode != 0:
    sys.exit(1)
else:
    sys.exit(0)
~
------------------------

CMakeLists.txt

cmake_minimum_required(VERSION 3.0)
project(sampleprg)

enable_testing()

add_executable( sample sample.cpp )

add_test(NAME sample_test
         COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/sample_test.py
         WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} )




-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to