I’m testing an application in a stress test.
That’s why I need it to restart if an error occurs (an error window opens) or it hangs or crashes. At the same time I need to collect all the useful information about the problem which lead to a restart: make a dump file and copy the error text from the error window (and/or take its screenshot).
With bash it’s easy: Restarting program automatically on crash in OSX (without screenshots or dumps, but the error window stays on MacOS, so they are practically not needed there). However, I need this functionality to run on Win (XP/Vista/7).
I can use special monitoring tools for restart, but that way I would rely on non-standard programs. I can use User Mode Process Dumper on XP, but it doesn’t work for Vista.
Is there any elegant and universal way (batch file or perl script would be great) to implement described functionality for all versions of Windows?
Regarding the 1st part of your question, you can test if a process is running using
tasklist.This will run
myapp.exe, restarting it if necessary:Regarding the 2nd part of your question, you can collect a user mode core dump using AutoDumpPlus.
For instance:
This will run ADPlus, monitoring all processes named
myapp.exe, and producing a core dump in the output directoryC:\temp(of course, this can be changed) if a crash is detected.I haven’t tested this setup as a whole, but I hope it works for you!