| commit | 04c6954d9e9a23b9e9ec87472d083d94bb52fa6e | [log] [tgz] |
|---|---|---|
| author | Marc-Antoine Ruel <maruel@fuchsia.infra.roller.google.com> | Thu Nov 26 15:54:11 2020 +0000 |
| committer | Copybara-Service <copybara-worker@google.com> | Thu Nov 26 07:55:10 2020 -0800 |
| tree | bdde1f429cd7ac57907f1e004b5037e7a5145934 | |
| parent | bacc6d3c4fc281f87986ac6fed32b838eb15a29a [diff] |
[roll] Roll fuchsia [go] Use testing.T.TempDir and other cleanup in garnet and src
- TempDir() is new in Go 1.15.
- Reduce the risk of junk being left around. Some tests didn't clean up properly
or the temporary file/dir lifetime was hard to understand.
- This uses consistent naming for temporary directories, so we know what leaks.
- Use consistent temporary directory ACL 0o700.
- Use consistent temporary file ACL 0o600.
- Use 0o octal naming convention. This is supported since Go 1.13.
- Don't use ioutil.TempFile() when filepath.Join() does the job.
- Reduce the risk of file locking issue if this code is ever used on Windows by
closing before sharing.
- Replace many temporary files by bytes.Buffer{} or strings.NewReader().
- Replace panic() calls with t.Fatal() everywhere possible.
- Inline panic() calls at the remaining places. Using a function caused the bad
habit of calling it from unit tests, oops.
- Improve documentation by adding comments. Comments 💡.
- Improve test writing style. There was a lot of t.Fatalf("blah blah") that was
better replaced as t.Fatal(err).
- Have test-only functions accept a *testing.T instead of returning an error.
- This removes 340 lines of test code!
Do not fix build.TestConfig() yet, since it'll require a new package and
BUILD.gn updates. It's the last major cause of random defer os.RemoveAll() in
the test cases.
Started with:
vi $(git grep --name-only ioutil.Temp -- "*_test.go")
and went from there.
Test only change.
Original-Bug: 58804
Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/452895
Original-Revision: 824d259b6078d585223e31e20e2f0ad58a4309b0
GitOrigin-RevId: 4d18ec526cc7d61f55eb867f1fca3bd71ed09fb9
Change-Id: Ia49e88bab41102a483ae9bb145611d2c21dc0b97
This repository contains Fuchsia's Global Integration manifest files.
All changes should be made to the internal version of this repository. Our infrastructure automatically updates this version when the internal one changes.
Currently all changes must be made by a Google employee. Non-Google employees wishing to make a change can ask for assistance via the IRC channel #fuchsia on Freenode.
First install Jiri.
Next run:
$ jiri init $ jiri import minimal https://fuchsia.googlesource.com/integration $ jiri update
Third party projects should have their own subdirectory in ./third_party.