2

I'm maintaining a couple of software repositories (C, C++ essentially) which I want to also run - or let's start with at least build - seamlessly on Windows.

Now, my desktop machine does not have Windows installed, nor does my laptop; and I don't have a spare computer right now, nor do I want to have my desktop or laptop run Windows (instead of GNU/Linux). I realize dual-booting might be an option, but I don't want to have to reboot back and forth either.

I've been considering setting up a Windows VM, but I'm wondering:

  • Is there a simpler/easier alternative to do relatively-simple, essentially-non-obtrusive testing and platform-specific debugging work in a Windows environment other than via a VM?
  • Is there some standard turn-key way to set up such a VM for my kind of work?

I know VMs are very much in vogue these days, with the cloud and everything, but I'm inexperienced with them, hence my question.

Notes:

  • It's FOSS software.
  • I already have the option of just having the build run (and fail), using appveyor's GitHub integration. I want a machine I could use to get it to work.
  • It isn't clear to me what exactly is the problem you're trying to solve. So the computers you have at the moment have GNU/Linux rather than Windows. You're looking to be also able to use a Windows computer for development/testing of the same project? Or to build and test Linux and Windows versions of your software in parallel? – Stewart Jan 30 '18 at 12:54
  • @Stewart: The first option. – einpoklum Jan 30 '18 at 14:48
  • @einpoklum so if the target is linux, why bothering with windows? However, there is some tooling bases on ruby that should run on windows too: throwtheswitch.org – Timothy Truckle Jan 30 '18 at 14:50
  • @TimothyTruckle: The target is also Windows. It's not my target of interest, but I need it to also run on Windows, for, well, reasons. – einpoklum Jan 30 '18 at 14:57
  • @einpoklum If your code is intended to run on windows too it should be possible to use the suggested ruby tools to compile the app on windows and run its automated tests... – Timothy Truckle Jan 30 '18 at 15:07
1

Since you are using AppVeyor, the next step is to set up and run a test harness as part of your build. Several libraries (like the C runtime library, Xerces, etc.) have a suite of tests they run against the library that was just built.

AppVeyor should be running the test as part of the build process. The test harnesses either use another tool like CUnit or they roll their own. Each test should be verifying that the results of any given function call are correct. More than likely, you will have multiple tests for each function as you ensure both valid and invalid inputs are handled appropriately. With sufficient code coverage, you may not need to actually use a debugger.

Your build would have some targets:

  • all -- should compile the application and run tests, depends on check
  • check -- runs the test harness and fails build if there is a non-zero return value. depends on build and build-check.
  • build -- builds the library or application (internal target)
  • build-check -- builds the test harness, depends on build, links test binary to the library being tested (internal target)

Set up AppVeyor to execute the make check or make all. Since tests can fail the build, you can ensure that your tests are executed in all environments you care about.

Beyond that, if you actually need to set up break points and step through the code you have no choice but to either dual-boot or set up a VM.

  • So, only the last sentence in your answer actually regards my situation... – einpoklum Jan 30 '18 at 17:41
  • 2
    If you are trying to debug a platform specific environment, you need access to that platform. Unfortunately, there is no other way. However, once you figure out what's going on, you can add unit tests to your test suite to make sure you don't regress. Or you can build tests to verify assumptions, and wait for AppVeyor to execute them. But that's a slower feedback loop. – Berin Loritsch Jan 30 '18 at 18:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.