0

Remove old traffic_annotation_auditor code

Fix remaining references to traffic_annotation_auditor and remove unused
code now that the new python implementation has been in production for
some time.

Bug: 1119417
Change-Id: I7f3f567b6adb61dab9e736933c3a4e4f3102bae1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3928694
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1070012}
This commit is contained in:
Henrique Ferreiro
2022-11-10 21:42:48 +00:00
committed by Chromium LUCI CQ
parent 40e12d01c2
commit d5df18b3a7
14 changed files with 17 additions and 175 deletions

@ -332,10 +332,6 @@ group("gn_all") {
]
}
if (is_win || is_linux) {
deps += [ "//tools/traffic_annotation/auditor:traffic_annotation_auditor" ]
}
if (is_mac) {
deps += [
"//chrome/installer/gcapi_mac:gcapi_example",
@ -466,7 +462,6 @@ group("gn_all") {
"//components/exo/wayland:wayland_client_compatibility_tests",
"//components/session_manager/core",
"//third_party/shell-encryption:shell_encryption_unittests",
"//tools/traffic_annotation/auditor:traffic_annotation_auditor",
"//ui/chromeos:ui_chromeos_unittests",
]
}

33
DEPS

@ -174,7 +174,6 @@ vars = {
# support for other platforms may be added in the future.
'checkout_openxr' : 'checkout_win',
'checkout_traffic_annotation_tools': 'checkout_configuration != "small"',
'checkout_instrumented_libraries': 'checkout_linux and checkout_configuration != "small"',
# By default bot checkouts the WPR archive files only when this
@ -4507,38 +4506,6 @@ hooks = [
],
},
# This is used to ensure that all network operations are properly
# annotated so we can document what they're for.
{
'name': 'tools_traffic_annotation_linux',
'pattern': '.',
'condition': 'host_os == "linux" and checkout_traffic_annotation_tools',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--num_threads=4',
'--bucket', 'chromium-tools-traffic_annotation',
'-d', 'src/tools/traffic_annotation/bin/linux64',
],
},
# This is used to ensure that all network operations are properly
# annotated so we can document what they're for.
{
'name': 'tools_traffic_annotation_windows',
'pattern': '.',
'condition': 'host_os == "win" and checkout_traffic_annotation_tools',
'action': [ 'python3',
'src/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--num_threads=4',
'--bucket', 'chromium-tools-traffic_annotation',
'-d', 'src/tools/traffic_annotation/bin/win32',
],
},
# Pull down Zucchini test data.
{
'name': 'zucchini_testdata',

@ -38,7 +38,6 @@ static_library("xml_reader") {
"//base/test:test_support",
"//components/policy/core/common:unit_tests",
"//services/data_decoder:*",
"//tools/traffic_annotation/auditor:auditor_sources",
]
sources = [
"chromium/xml_reader.cc",

@ -83,7 +83,6 @@ static_library("xml_reader") {
"//base/test:test_support",
"//components/policy/core/common:unit_tests",
"//services/data_decoder:*",
"//tools/traffic_annotation/auditor:auditor_sources",
]
if (is_win) {
visibility += [ "//components/wifi" ]

@ -6,23 +6,15 @@ This folder provides tools to ensure that every operation in the code base that
requires annotation, is annotated, and annotations are sound and complete.
# Traffic Annotation Auditor
This is the main executable for all the tests. It runs Traffic Annotation
Extractor python script to check the repository, extract annotations, and
perform required tests and maintenance. See more details in
`tools/traffic_annotation/auditor/README.md`.
This is a python script that checks the repository, extracts annotations, and
performs required tests and maintenance. See more details in
`tools/traffic_annotation/scripts/README.md`.
# Traffic Annotation Extractor
Traffic Annotation Auditor uses this python script (located in
`tools/traffic_annotation/scripts/extractor.py`) to parse the code and extract
required data for testing and maintenance.
# Building the Checkers
We do not want every developer to have to build the auditor, and so we store
pre-built binaries in a Google Cloud Storage bucket and retrieve them via
gclient hooks. The binaries are in `tools/traffic_annotation/bin/[platform]`
folder. To roll new versions of the binaries, please see
`tools/traffic_annotation/bin/README.md`.
# Automatic Annotation Tests
Network traffic annotations are tested in commit queue using
`tools/traffic_annotation/scripts/check_annotations.py`. This test is currently

@ -1,11 +0,0 @@
# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Works only on Windows and Linux.
assert(is_win || is_linux || is_chromeos)
executable("traffic_annotation_auditor") {
sources = [ "traffic_annotation_auditor_ui.cc" ]
deps = [ "//build:buildflag_header_h" ]
}

@ -1,14 +0,0 @@
# Network Traffic Annotation Auditor
THIS CODEBASE IS DEPRECATED. It will be removed soon(ish). The new
implementation can be found at `tools/traffic_annotation/scripts/auditor/auditor.py`. It
is a drop-in replacement for traffic_annotation_auditor, so you can run it with
the same command-line arguments, etc.
<!-- TODO(crbug.com/1119417): Remove t_a_auditor-related code after enough
time running auditor.py by default (to ensure it's relatively bug-free).
-->
See
[tools/traffic_annotation/scripts/auditor/README.md](/tools/traffic_annotation/scripts/auditor/README.md)
for more details.

@ -1,20 +0,0 @@
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stdio.h>
#include "build/build_config.h"
#if BUILDFLAG(IS_WIN)
int wmain(int argc, wchar_t* argv[]) {
#else
int main(int argc, char* argv[]) {
#endif
printf(
"traffic_annotation_auditor has been removed from the codebase. Please "
"use auditor.py instead.\n"
"See tools/traffic_annotation/scripts/auditor/README.md for "
"instructions.\n");
return 1;
}

@ -1,2 +0,0 @@
nicolaso@chromium.org
rhalavati@chromium.org

@ -1,63 +0,0 @@
## Building the annotation checker.
We do not want every developer to have to build the auditor, and so we store the
pre-built binary in a Google Cloud Storage bucket and retrieve it via gclient
hooks.
To roll new versions of the binaries, you need to have write access to the
chromium-tools-traffic_annotation bucket. If you don't, contact the OWNERS list
in this folder, otherwise run:
# On Linux:
```bash
git new-branch roll_traffic_annotation_tools
# These GN flags produce an optimized, stripped binary that has no dependency
# on glib.
gn gen --args='is_official_build=true use_ozone=true' out/Default
ninja -C out/Default traffic_annotation_auditor
cp -p out/Default/traffic_annotation_auditor \
tools/traffic_annotation/bin/linux64
strip tools/traffic_annotation/bin/linux64/traffic_annotation_auditor
third_party/depot_tools/upload_to_google_storage.py \
-b chromium-tools-traffic_annotation \
tools/traffic_annotation/bin/linux64/traffic_annotation_auditor
sed -i '/^LASTCHANGE=/d' tools/traffic_annotation/bin/README.md
cat build/util/LASTCHANGE >> tools/traffic_annotation/bin/README.md
git commit -a -m 'Roll traffic_annotation checkers'
git cl upload
```
# On Windows:
```bash
git new-branch roll_traffic_annotation_tools
# These GN flags produce an optimized, stripped binary that has no dependency
# on glib.
gn gen --args="is_official_build=true" out/Default
ninja -C out/Default traffic_annotation_auditor
cp -p out/Default/traffic_annotation_auditor.exe ^
tools/traffic_annotation/bin/win32
python third_party/depot_tools/upload_to_google_storage.py ^
-b chromium-tools-traffic_annotation ^
tools/traffic_annotation/bin/win32/traffic_annotation_auditor.exe
sed -i "/^LASTCHANGE=/d" tools/traffic_annotation/bin/README.md
cat build/util/LASTCHANGE >> tools/traffic_annotation/bin/README.md
dos2unix tools/traffic_annotation/bin/README.md
git commit -a -m 'Roll traffic_annotation checkers'
git cl upload
```
and land the resulting CL.
The following line will be updated by the above script, and the modified
README should be committed along with the updated .sha1 checksums.
LASTCHANGE=cdc4b63690632690274f67929ce0a49720eb1af3-refs/heads/main@{#913784}
LASTCHANGE_YEAR=2021

@ -1 +0,0 @@
d6f4d194a53be2fa152ad77642e1bb90e2cebe86

@ -1 +0,0 @@
6b6864f1c8afbcdae654582e5f3309d7b1d5a6ad

@ -3,9 +3,9 @@ This file describes the scripts in `tools/traffic_annotation/scripts`.
# auditor/auditor.py
The new implementation of `traffic_annotation_auditor`. It is meant as a
drop-in replacement, and it adds new annotations to the grouping xml file.
After the grouping xml file is generated, we'll decide if the new annotation
This is the python implementation of the Traffic Annotation Auditor, and it
adds new annotations to the grouping xml file.
After the grouping xml file is generated, we'll decide if the new annotation
should be in the report by adding hidden="false".
i.e. you can call it with the same command-line arguments
and it should give similar output.
@ -15,7 +15,7 @@ Runs traffic annotation tests on the changed files or all repository. The tests
are run in error resilient mode. Requires a compiled build directory to run.
# traffic_annotation_auditor_tests.py
Runs tests to ensure traffic_annotation_auditor is performing as expected. Tests
Runs tests to ensure auditor/auditor.py is performing as expected. Tests
include:
- Checking if auditor and underlying extractor run, and an expected minimum
number of outputs are returned.

@ -180,19 +180,21 @@ class AuditorError:
assert self._details
return (
"'tools/traffic_annotation/summary/annotations.xml' requires update. "
"It is recommended to run traffic_annotation_auditor locally to do "
"the updates automatically (please refer to tools/traffic_annotation/"
"auditor/README.md), but you can also apply the following edit(s) to "
"do it manually:\n{}".format(self._details[0]))
"It is recommended to run the Traffic Annotation Auditor locally to "
"do the updates automatically (please refer to tools/"
"traffic_annotation/scripts/auditor/README.md), but you can also "
"apply the following edit(s) to do it manually:\n{}".format(
self._details[0]))
if self.type == ErrorType.GROUPING_XML_UPDATE:
assert self._details
return (
"'tools/traffic_annotation/summary/grouping.xml' requires update. "
"It is recommended to run traffic_annotation_auditor locally to do "
"the updates automatically (please refer to tools/traffic_annotation/"
"auditor/README.md), but you can also apply the following edit(s) to "
"do it manually:\n{}".format(self._details[0]))
"It is recommended to run the Traffic Annotation Auditor locally to "
"do the updates automatically (please refer to tools/"
"traffic_annotation/scripts/auditor/README.md), but you can also "
"apply the following edit(s) to do it manually:\n{}".format(
self._details[0]))
raise NotImplementedError("Unimplemented ErrorType: {}".format(
self.type.name))