Add tests for verify_overlaps script

Refactor verify_overlaps to make it testable and add tests for the
comparison. It does make one significant change in behavior which is to
read each of the files produced by a bootclasspath_fragment into a dict
before comparison, rather than reading and comparing them a row at a
time. That allows it to reuse the code to read a CSV into a dict.

Bug: 194063708
Test: atest --host verify_overlaps_test
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - manually change files to cause difference in flags to check
        that it detects the differences.
Change-Id: Ib70ac87fe089fc25e3bef18f367d4939bfc0cb8d
This commit is contained in:
Paul Duffin
2021-07-21 15:33:22 +01:00
parent bf49705608
commit 428c65156b
3 changed files with 228 additions and 38 deletions

View File

@@ -83,3 +83,24 @@ python_binary_host {
},
},
}
python_test_host {
name: "verify_overlaps_test",
main: "verify_overlaps_test.py",
srcs: [
"verify_overlaps.py",
"verify_overlaps_test.py",
],
version: {
py2: {
enabled: false,
},
py3: {
enabled: true,
embedded_launcher: true,
},
},
test_options: {
unit_test: true,
},
}