SIGN IN SIGN UP

os: notify testlog from (*File).Chdir

os.Chdir notifies the testlog hook with the new working directory, but
(*File).Chdir does not, so cmd/go's test cache loses track of the cwd
when a test uses (*File).Chdir to restore the previous directory (as
testing.T.Chdir does in its cleanup). Subsequent relative paths from
later tests in the same package are then resolved against the wrong
directory in computeTestInputsID, and the cache fails to invalidate
when those files change.

Fix it by emitting the same testlog Chdir entry from (*File).Chdir
after a successful Fchdir, mirroring os.Chdir.

Fixes #79019.

Change-Id: I7099d3a1d2ce3e5f4882a0e93c4d642f23f7eca8
Reviewed-on: https://go-review.googlesource.com/c/go/+/771960
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
D
Daniel Martí committed
c7e6da5ca59645de42e5d28829ff37452fce16ca
Parent: 47d5295