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.
source to share
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.
source to share
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.
source to share