Skip to content
Snippets Groups Projects
  • Kir Kolyshkin's avatar
    79ca434a
    testing: add Chdir · 79ca434a
    Kir Kolyshkin authored
    Some tests need to use os.Chdir, but the use is complicated because
     - they must change back to the old working directory;
     - they must not use t.Parallel.
    
    Add Chdir that covers these cases, and sets PWD environment variable
    to the new directory for the duration of the test for Unix platforms.
    Unify the panic message when t.Parallel is used together with t.Setenv
    or t.Chdir.
    
    Add some tests.
    
    For #62516.
    
    Change-Id: Ib050d173b26eb28a27dba5a206b2d0d877d761c1
    Reviewed-on: https://go-review.googlesource.com/c/go/+/529895
    
    
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: default avatarCarlos Amedee <carlos@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    79ca434a
    History
    testing: add Chdir
    Kir Kolyshkin authored
    Some tests need to use os.Chdir, but the use is complicated because
     - they must change back to the old working directory;
     - they must not use t.Parallel.
    
    Add Chdir that covers these cases, and sets PWD environment variable
    to the new directory for the duration of the test for Unix platforms.
    Unify the panic message when t.Parallel is used together with t.Setenv
    or t.Chdir.
    
    Add some tests.
    
    For #62516.
    
    Change-Id: Ib050d173b26eb28a27dba5a206b2d0d877d761c1
    Reviewed-on: https://go-review.googlesource.com/c/go/+/529895
    
    
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: default avatarCarlos Amedee <carlos@golang.org>
    Reviewed-by: default avatarIan Lance Taylor <iant@google.com>
    Auto-Submit: Ian Lance Taylor <iant@google.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.