Tries to run 64-bit tests on 32-bit windows

We run our unit tests as a post-build step in our assemblies. Now I am having a problem with this on our machines autobulls that automatically pull and build each revision in svn.

The auto-script object pulls in the revision, does some customization, and then calls the devenv.exe / build file on it. This in turn will build everything and then try to run the tests. The construct gets stuck and never finishes.

If you create the solution manually, what happens at the test launch point is a pop-up dialog box in which the test executable is not a valid Win32 application. My guess is that auto-objects somehow get this box too, but hide somewhere in a non-interactive session.

I had two ideas for a solution at the moment:

  • Check your tester application trying to run tests and detects a failure. This is undesirable as it would mean creating that extra kludge of code and adding it for use only on Windows assemblies, etc.

  • Be that as it may, check if windows are 32bit or 64bit in build scripts (we run cmake) and just don't run tests if they don't work. This is preferred, but requires checking to see if the window is 32-bit or 64-bit, preferably without having to check the other helper tool "test-windows-type".

Any further ideas or hints on how to implement proposal 2 would be much appreciated.

Update: Note. This is cross compilation running on a 32 bit machine, but compiling the 64 bit exe. If I could just check the properties of the compiler, there would be no problem. But I am after the assembly properties, not the assembly itself, which is clearly 64 bit.

+2


source to share


5 answers


Check your environment variable %PROCESSOR_ARCHITECTURE%

:



  • x86

    on a 32-bit machine.
  • AMD64

    on a 64-bit machine (see here ).
+1


source


You should be able to check the CMake generator which I think is different for windows with 32/64 bit.



0


source


You can check the CMAKE_SIZEOF_VOID_P variable in your build script to determine the type. See the documentation here . Then you can skip running tests if that variable is 32.

Update : Sorry, I was oblivious to your real problem. I believe the best approach might be to apply a try-run test and use RUN_RESULT_VAR to determine if the application has started successfully.

0


source


Not an answer to the specific question you asked, but you should consider building your application on an x64 machine that can run 32-bit tests as well as 64-bit tests ...

0


source


I found out one way to determine if the system is 64 bit or not, which should be accessible from cmake. This seems like a pretty ugly hack, although it can break any random version of windows, so I would rather find another way.

The environment variable% ProgramFiles (x86)% exists only in 64-bit OS versions.

0


source







All Articles