After replacing --logtostderr to --log="{file-defaults: {dir: tmp/dir/to/log}, sinks: {stderr: {filter: NONE}}}" , the "cockroach" command does not generate the listen-url file in the tmp directory when running tests from testserver_test.go. But the same command works well in local CLI.
Demo of tests with original --logtostderr running in debugger: check here
Demo of tests with --log running in debugger and local CLI: check here
Demos are based on these code changes.