There are really no tests you can run BEFORE installing the CPU to make sure it works correctly.
After installation you can run Realbench. If it passes maybe an hour or two of stress testing with approximately half your RAM selected in the memory to use field, then it is most likely ok. If however there is something wrong with the CPU, once you've installed it and powered on the system it's too late to worry about it anyway as any damage that might happen if there IS a problem with it will already most likely be done.
I'd just be sure to purchase from somebody with a VERY HIGH approval rating if buying from Ebay and if they are willing to run it before you buy it, in the event you buy locally and CAN test it first, then I'd run Realbench for a half hour or so, or Prime95 version 26.6 on the Small FFT option, for 15 minutes. That will at least give you a fair idea of whether it's ok or not. If you see errors within that timeframe then it's either not stable in the system it is being tested on due to configuration problems, or something is wrong with it.