Fix problems with make test target

- Should be PWD instead of CURDIR
- pushd and popd used to preserve directory
- Double dollar signs removed from file var in for loop