You might try this. First, make all hidden files/folders visible by running the following command in Terminal.
defaults write com.apple.finder AppleShowAllFiles -bool true ; killall Finder
(To reverse this when you're done:
defaults write com.apple.finder AppleShowAllFiles -bool false ; killall Finder )
Next, insert the grey install disc that came with the computer. Note: if it came with 10.5, then you might have a second disc labelled "Additional Software & Apple Hardware Test." Or:
Macs That Shipped With OS X 10.5.5 (Fall 2008) to OS X 10.6.7 (Summer 2011)
OS X 10.5.5 (Leopard) was released in September of 2008. For Macs that were sold with OS X 10.5.5 and later versions of Leopard, or with any version of Snow Leopard, the AHT is located on the Application Install Disc 2 DVD that was included with the Mac.
http://macs.about.com/od/Troubleshooting/fl/Use-the-Apple-Hardware-Test-AHT-to-F ind-Problems-With-Your-Macs-Hardware.htm
Now, open the mounted disc (if it will mount) and drill down to a folder there .diagnostics and copy it to /System/Library/CoreServices on the Mac. Next, make sure the permissions on the copied disc are correct. To do this, get BatChmod http://www.lagentesoft.com/batchmod/index.html , drag the copied .diagnostics folder into the field and set everything this way (not shown below, but also check Apply to enclosed folders and files):
Now try D key booting.
If it still doesn't work, then, with the grey disc still mounted, you can try to put it on a flash drive:
Insert a flash drive (the .diagnostics folder on my Snow is ~95 MB, so a flash drive with a partition of 1.5 GB should be completely adequate for this--this allows a little extra for the formatting) which should first be partitioned: GUID partition map/MacOS Extended Journaled). Open Disc Utility, select the drive, the top level listing (not the volume) and go to Restore. Drag the .diagnostics folder into the source field, then drag the flash drive into the destination field and hit the Restore button.
When this is all done, and with the flash drive still mounted, go to Sys Prefs>Startup Disk and see if the new flash .diagnostics volume shows up as a bootable volume. Even if it doesn't show up, you can still try booting to it by holding down the Option key at the startup chime from a restart, or the C key from a restart.
You tried putting the AHT from GitHub on a flash drive and it still didn't work? That happened to me also, using the GitHub AHT for a MacMini.