Simplify test file boilerplate.
Improve portability in tests/run file.

Removed the use of the date command, which is very poor at portability.
Made the $MAIN path work for other users.