Use a more regular mechanism to name sources during driver tests and
recognize the naming during fetching to avoid saving the test profiles
into $HOME/pprof.
Also move the https+insecure testing into fetch_test, to focus it on
fetching the profile.
This fixes #107
In changeset f90721db3d, fetch.go was changed to handle
the correct home directory environment variable on Plan 9
and Windows, but the tests were still using the $HOME
environment variable.
We change the tests to use the homeEnv function instead
of the $HOME environment variable.
Fixes #100.
Allow binary override for profiles with no mappings (#89)
The go runtime generates profiles in profile.proto format
without symbols or mappings. The expectation is that these
can be symbolized by passing the binary name to pprof.
The mechanism pprof uses relies to override the binary relies
on there being a mapping, and previously we moved the creation
of fake mappings to the legacy profile handlers, so profiles
parsed from profile.proto with no mappings can no longer be
symbolized.
Special case this situation to create a fake mapping and associate
all locations to it if there is a command line override but no
mappings.
Reset mapping file to empty string if it was patched to be the source URL.
When the source is remote and a mapping doesn't have either build ID or
file field set, the file field is set to the source URL so that the
proper source from the source mapping is used during symbolz processing.
Before this change, the file field would continue to point to the URL
producing the URL in pprof output which confuses users.
With the change it resets the file field back to the empty string. It
also now skips the URL-like paths during local symbolization as
reading at that path is not going to succeed.
We discussed switching to generating more unique IDs. On the second
thought, I propose leaving these to be URLs as that seems unique enough
and in case this field leaks into the tool or log output seeing the URL
seems still friendlier than some arbitrarily prefixed string.