Commit Graph

31 Commits

Author SHA1 Message Date
Hsin-Yi Chen
e1aa9ebe32 Remove CPU variant from ABI reference dump paths
This commit removes CPU variant from the paths under prebuilts/abi-dumps
so that the build system can find dumps generated from non-generic
products.

Bug: 140359871
Test: ./create_reference_dumps.py -product aosp_cf_arm64_phone \
      -libs libvndksupport

Change-Id: Ib022bbfd484e327e345b554cdfd41a48692a3c68
2019-10-08 07:05:03 +00:00
Hsin-Yi Chen
9dc5608f5f Choose ABI dump directory according to the tag on the lsdump
Android build system and create_reference_dumps.py support:
- Creating dumps in vndk/ for the libraries that are LLNDK but not NDK.
- Creating dumps in platform/ for opt-in libraries.

Test: ./create_reference_dumps.py -libs libc -libs libcgrouprc
Bug: 133176785
Bug: 138219814
Change-Id: I827d8bfae2c4b6aff7e6cb835d0bf05ce1483ddf
2019-08-06 17:39:58 +08:00
Logan Chien
575f2bf31e Find make goals from lsdump_paths.txt
This commmit finds the make goals by reading lsdump_paths.txt.  This
fixes following problems:

1. Cannot build libraries that has been replaced by APEX stubs
   (e.g.  "libc" has been renamed to "libc.bootstrap")

2. Cannot lsdump with sanitizer variation suffixes (e.g. "_cfi")

Bug: 124829578
Test: create_reference_dumps.py --llndk -l libc
Test: create_reference_dumps.py --llndk -l libmediandk
Change-Id: I56d4f852f2e0dfe490e55f572bf3878f50464681
2019-03-05 14:32:46 +08:00
Logan Chien
5428fe5f1e Always collect lsdump paths from lsdump_paths.txt
This commit removes the code path that searches lsdump files by
traversing the directory.  Instead, always read the lsdump paths from
lsdump_paths.txt so that `create_reference_dumps.py` won't copy stale
lsdump files.

Bug: 121986692
Test: create_reference_dumps.py --llndk -lib libvulkan
Change-Id: I8c81dc1fd51d146da19a894c32e0df35907ba604
2019-03-05 10:45:25 +08:00
Logan Chien
cc68d180cc Copy lsdump files from non-apex variant
This commit refines the logic to pick the lsdump files for reference ABI
dumps.  Before this commit, `findlsdump()` simply use `str_a in str_b`
to check whether module variant name (e.g.
`android_arm_armv7-a-neon_core_shared`) is in the path.  However, this
check also matches the variant for apex modules (e.g.
`android_arm_armv7-a-neon_core_shared_apex.name`).

This commit fixes the problem by splitting each path into path
components and check whether a path component matches with the module
variant name.

Bug: 121986692
Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py
Change-Id: I98f78f460ddeb076f4ca35b7a0d9dcac4a479ae8
2018-12-27 14:33:17 +08:00
Logan Chien
d796b6ba89 Remove remove_absolute_paths argument
This commit removes the `remove_absolute_paths` argument from
`run_header_abi_dumper` because all usages pass `True`.

Test: ./tests/test.py
Test: ./tests/gen_all.py
Change-Id: Ibf5e7ff72d0c2c76ed3db1d8d272de1d3886c2c4
2018-12-27 11:47:50 +08:00
Hsin-Yi Chen
e249e48f29 Add --build-variant to create_reference_dumps.py
create_reference_dumps.py supports --build-variant which defaults to
userdebug. When the script builds libraries, it sets
TARGET_BUILD_VARIANT instead of inheriting from current environment.

Bug: 121017205
Test: ./create_reference_dumps.py --build-variant eng --llndk -libs libbinder_ndk
Change-Id: Ibe5458c2bb62ebb44755e4bb90566d39a0bd52f2
2018-12-26 17:36:04 +08:00
Hsin-Yi Chen
b8ec3d49de Do not call build/envsetup.sh in create_reference_dumps
This commit makes get_build_vars_for_product get variables by
soong_ui.bash without envsetup.sh.

Bug: 120819347
Test: ./create_reference_dumps.py --llndk -libs libbinder_ndk
Change-Id: I66d1245d277d3c5459c6027ccdb88288aaf4d802
2018-12-25 17:52:58 +08:00
Hsin-Yi Chen
e89977ad7e Refactor header-checker tests
- Rename the unit test class to HeaderCheckerTest.
- Create/delete temporary directory in setUp/tearDown.
- Move make_and_copy_reference_dumps from gen_all.py to test.py.
- Remove duplicate constant paths.
- Add default arguments to LsdumpModule.
- Fix coding style.

Bug: 117582158
Test: ./gen_all.py
Test: ./test.py
Change-Id: I6345a10da5431e8057e4a9321ecce4168b7d5292
2018-12-21 16:02:30 +08:00
dimitry
5f600aa39d Slightly improve error handling
Test: ./development/vndk/tools/header-checker/utils/create_reference_dumps.py -l libGLESv1_CM
Test: now fails with error message
Change-Id: Idd9aa84d8da6d4f6016f41438571ac1f0808be7e
2018-12-18 12:18:55 +01:00
Hsin-Yi Chen
07f3dd52a8 Add unit tests for header-abi-dumper -suppress-errors
- Add undeclared_types.h and known_issues.h.
- Classify modules into LsdumpModule and SdumpModule.

Test: ./test.py
Bug: 117582158
Change-Id: Ia8d56d28e6bf37f6d8f746fa9505b51c44772294
2018-11-20 18:39:12 +08:00
Hsin-Yi Chen
376b57580e Merge "Update unit tests for -dump-function-declarations" 2018-11-09 08:22:50 +00:00
Hsin-Yi Chen
b7565950ef Update unit tests for -dump-function-declarations
- Apply -dump-function-declarations to input/*.h.
- Add an explicitly deleted function to input/example1.h.
- Remove gen_expected_output.py and input/func_decl_*.h.

Bug: 71485848
Bug: 117582158
Test: ./test.py
Change-Id: Ic81448a3607c23bfb10781b4df097578814b7118
2018-11-08 18:07:27 +08:00
Logan Chien
ce6ea7999f header-checker: Fix unit test include directories
This commit fixes the built-in include directories for header-abi-dumper
unit test cases. Remove the reference to
`prebuilts/sdk/renderscript/clang-include` because we don't check out
`prebuilts/sdk` in `aosp-clang-tools` branch.

Test: PATH=out/soong/dist/bin:$PATH \
development/vndk/tools/header-checker/tests/test.py

Change-Id: Ieb24b0a53b719f4569149251efcdaa3722c0b88c
2018-11-08 14:48:47 +08:00
Logan Chien
f120783abd header-checker: Code cleanup
This commit cleans up several whitespaces nits, re-indent the code,
remove unnecessary data member initializers, and add missing header
guards.

Test: ./tests/test.py
Change-Id: Ibc355441aaa110280b263c5c3d8fc766941b08af
2018-10-17 09:46:24 +08:00
Logan Chien
6dbbe7bf8d header-checker: Cleanup create_reference_dumps.py
This commit refactors the `main()` function, cleans up several
indentation or spacing errors, and rewrites some code in Pythonic way.

Test: ./tests/test.py
Test: ./utils/create_reference_dumps.py
Change-Id: Ie654187bff5b5c49b421814efab0e8f308c93fa8
2018-10-09 11:31:09 +08:00
Logan Chien
f58bb5f1fe header-checker: Generate ABI dumps w/o gzip
This commit adds an option to generate ABI dumps without compressing
them with gzip.

Bug: 111376916
Test: ./create_reference_dumps.py
Test: ./create_reference_dumps.py --compress
Change-Id: I1ad0781744a9ba6ff34ffed9418576986daeb67d
2018-10-08 16:33:18 +08:00
Hsin-Yi Chen
86bcedcd0c Change default dump format to JSON
Bug: 112877706
Test: ./test.py
Change-Id: I5fd00e75b804a33c982008bc95ea017b480b67cc
2018-10-03 18:05:34 +08:00
Hsin-Yi Chen
4b9b242efe Add test for loading JSON dump
- Add a test that compares protobuf and JSON dumps.
- Add input-format=Json to header-abi-linker and diff.

Bug: 112877706
Test: ./test.py
Change-Id: Ic9be304b565a2ac58ed76e1a0fcc96530395b750
2018-09-21 11:50:26 +08:00
Hsin-Yi Chen
299acf20e3 Add test for lsdump in JSON format
- Add a test case and data for lsdump in JSON format
- Rename command line option -text-format to -output-format
- Add option -input-format to header-abi-linker

Bug: 112877706
Test: ./test.py
Change-Id: Ia94f7ffffbcaf55f336932029883ea3635c547e9
2018-08-27 07:01:18 +00:00
Jayant Chowdhary
b2144fb977 Unify command for creation of llndk, vndk abi references.
Bug: 64267858

Test: utils/create_reference_dumps.py creates llndk + vndk abi
      references

Test: utils/create_reference_dumps.py -l libjpeg

Merged-In: I72ae13fb9c48f23a62b959195dbd5fa6fe4c14b0
Change-Id: I72ae13fb9c48f23a62b959195dbd5fa6fe4c14b0
(cherry picked from commit a038b56c7d)
2018-04-12 09:07:39 -07:00
Jayant Chowdhary
3dc4ff3ef0 Make utils/create_reference_dumps.py slightly less slower when -l is specified.
Bug: 64267858

Test: Without this change:
          rm -rf $ANDROID_BUILD_TOP/out; utils/create_reference_dumps.py
	  -l libjpeg -> > 30 minutes
      With this change:
          rm -rf $ANDROID_BUILD_TOP/out; utils/create_reference_dumps.py
	  -l libjpeg -> approx 11.5 minutes

Change-Id: I9c145ed5d8c9a9cc2cb1dc7db9ab9b83843a291e
2018-03-29 22:43:04 +00:00
Jayant Chowdhary
1ebd366d52 Use target 'vndk' instead of 'vndk_package' while creating abi references.
Using 'vndk_package' will miss out on vndk libraries not being used by the
lunch target

Bug: 64267858

Test: utils/create_reference_dumps.py

Change-Id: Ifaa61aae715af7f2010aadbfa9864da7c74ca14f
2018-03-27 15:50:19 -07:00
Jayant Chowdhary
cd0e8aff22 Add --llndk to create_reference_dumps.py for llndk libraries.
Currently, we do abi checks on the system variants of llndk libraries.
Therefore, add an 'llndk' flag to specify that the system variant should be
built.

Bug: 77101345

Test: utils/create_reference_dumps.py --llndk -l libdl produces
      libdl references.

Change-Id: Id4c607674f096daf041520d4a1ca43199d4451da
2018-03-27 12:45:20 -07:00
Jayant Chowdhary
76183b7a83 Shenanigans to make create_reference_dumps.py more usable.
- pick up lsdump paths from
  $(OUT_DIR)/lsdump_paths/$(TARGET_PRODUCT)/paths.txt instead of
  searching through out/soong/.intermediates.

- llndk lsdumps also get picked up and copied to ref dump dir root now

- creation of references are more fine grained to take into account
  target arch variant and cpu variant as well.

- references for vndk libs and llndk libs for all target archs and
  variants can be generated with one invocation of the script now.

Test: utils/create_reference_dumps.py -l libjpeg -l libc++ -l libc

Test: utils/create_reference_dumps.py -l libjpeg -l libc++ -l libc
      --no-make-lib

Test: utils/create_reference_dumps.py

Change-Id: I9105900b70c62c01f8282e1782cb38a42f4d4356
2018-03-01 15:11:32 -08:00
Jayant Chowdhary
d1f8fc226b gzip reference dumps while copying to ref-dump-dir.
Remove the additional step of gzipping reference dumps manually.

Test: utils/create_reference_dumps.py --version current -ref-dump-dir
      $ANDROID_BUILD_TOP/prebuilts/abi-dumps/vndk; mm -j64 in
      external/libexif.

Change-Id: Ib22a3b4fa90e4f849529efc4b03ab43d87996458
2018-02-09 10:29:57 -08:00
Jayant Chowdhary
7cc00996e5 Fix map key in header-abi-diff while extracting user defined types.
The key being added to respective maps which facilitate diffing of
unreferenced user defined types was earlier the linker set key. The
unique id should be used instead. This is because linker set keys for C
and C++ types can be the same, but their unique id's cannot. Thus,
having linker set keys as a key leaves open the possibility of false
type aliasing, whereas the unique id does not.

Test: python3 tests/test.py

Test: python3 tests/test.py \
      MyTest.test_libc_and_cpp_with_unused_struct_and_libc_and_cpp_with_unused_cstruct;
      before this change, this test fails; after this change, the test
      passes.

Change-Id: I91816167a48308a8c812d01e0a09e9bb70c60b50
2018-02-07 13:04:30 -08:00
Jayant Chowdhary
c18ded4bb0 Make create_reference_dumps.py faster.
Since we now build and install all vndk libraries,regardless of
dependencies, we may just look for all files with the extension '.lsdump' for
TARGET_ARCH and TARGET_2ND_ARCH, and copy them to the given reference dump
directory.

Test: utils/create_reference_dumps.py --version current -ref-dump-dir
      <dir> creates reference dumps at <dir>

Change-Id: Ic9db57b00614b3e8dc18d8e56eab4bd87df1723c
2017-12-07 12:46:18 -08:00
Jayant Chowdhary
29092604b2 Fix how header-checker tests run.
Previously, the tests mainly exercised header-abi-diff.
After this change, checked-in reference dumps are compared with
generated dumps. This allows us to:
  - get header-abi-dumper and header-abi-linker involved in testing
    better.
  - Know about any incompatbile message format changes made
    inadvertently.

Test: tests/test.py; all tests pass.

Change-Id: I7c7ba0811e6c08c6194a0a11616680279e7a0e1d
2017-12-07 12:46:10 -08:00
Dan Willemsen
d3fc8faff6 Switch to new soong_ui dumpvar-mode
Stop using make directly.

Test: manual tests
Test: development/scripts/symbol.py
Change-Id: I9f75776251b693dbe979989942d2db49768224d2
2017-10-17 14:10:51 -07:00
Jayant Chowdhary
860b41407e Add more comprehensive tests for abi diffing.
1) We do not involve the build system to create test reference dumps. Symbols
in tests, are faked through version scripts to avoid checking in prebuilt .so
test files.

2) Also add a script to create reference abi dumps.

3) Fix a comment in ast_processing.cpp

Test: Run tests/test.py, all tests run and pass on generic arm64, mips64
and x86_64 builds.

Change-Id: Id3a420c1ae093a05a79da4c29e85071f28d714d1
2017-08-24 23:41:01 -07:00