Prevent testing from leaving extra files around

The number of files left over in the temp directory after running tests has been bothering me for a while. In many cases this results from having a temporary file created as part of a test that also has a corresponding index file. The latter are not always deleted. This is fixed here.

I also did a few other things for the sake of consistency:

1. Some tribble test temp files were being written in the test data directory rather than the system temp directory. I fixed this.
2. In a few cases, the file names used for a test were very non-descriptive (things like `test32132131.bin`), so I renamed them so that they could be better identified if for some reason they were left hanging around.

I can of course squash if all of this is OK.