autoninja: Replace ninjalog_uploader_wrapper.py and reclient_metrics.py with build_telemetry.py

This CL unifies the opt-in/opt-out handling for build telemetry collections about Reclient and Ninjalog.

The user consent message will be displayed only once at the beginning of a build.

```
❯ autoninja -C out/deterministic-andorid-dbg base
*** NOTICE ***
Google-internal telemetry (including build logs, username, and hostname) is collected on corp machines to diagnose performance and fix build issues. This reminder will be shown 9 more times. See http://go/chrome-build-telemetry for details. Hide this notice or opt out by running: build_telemetry [opt-in] [opt-out]
*** END NOTICE ***

Proxy started successfully.
...
```

Bug: 345113094
Change-Id: Ie5886287c4bd20262be0ff247508ac3869441eb1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5669094
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Michael Savigny <msavigny@google.com>
Commit-Queue: Junji Watanabe <jwata@google.com>
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
This commit is contained in:
Junji Watanabe
2024-07-22 01:32:29 +00:00
committed by LUCI CQ
parent 397bf12548
commit b12257963c
16 changed files with 66 additions and 794 deletions

View File

@@ -16,25 +16,6 @@ import ninjalog_uploader
class NinjalogUploaderTest(unittest.TestCase):
def test_IsGoogler(self):
with unittest.mock.patch('subprocess.run') as run_mock:
run_mock.return_value.returncode = 0
run_mock.return_value.stdout = 'Logged in as foo@google.com.\n'
self.assertTrue(ninjalog_uploader.IsGoogler())
with unittest.mock.patch('subprocess.run') as run_mock:
run_mock.return_value.returncode = 1
self.assertFalse(ninjalog_uploader.IsGoogler())
with unittest.mock.patch('subprocess.run') as run_mock:
run_mock.return_value.returncode = 0
run_mock.return_value.stdout = ''
self.assertFalse(ninjalog_uploader.IsGoogler())
with unittest.mock.patch('subprocess.run') as run_mock:
run_mock.return_value.returncode = 0
run_mock.return_value.stdout = 'Logged in as foo@example.com.\n'
self.assertFalse(ninjalog_uploader.IsGoogler())
def test_parse_gn_args(self):
self.assertEqual(ninjalog_uploader.ParseGNArgs(json.dumps([])), {})