Fix environment, link libraries and link riak_test_server