Improve testing of sdk snapshot generation
Adds TestHelper to provide general test helper functionality for use by any test. Adds testSdkResult, composed with TestHelper that encapsulates the result of processing and sdk {..} definition and provides specialized support for testing the build rules. Dedups the analysis of the sdk build rules, and improves it to extract more information, and in different forms. That is represented by the snapshotBuildInfo struct. Adds a CheckSnapshot() method which checks the snapshot for a specified sdk version. It takes a list of functions that can each perform a check on a specific facet of the supplied snapshotBuildInfo. Methods are provided for tests to use to check the following facets: * Generated Android.bp contents. * Copy rules * Merge zip inputs This approach makes it possible for each test to customize what is being checked without either duplicating functionality, causing a proliferation of specialized forms of the CheckSnapshot method for different types of tests or adding arguments for every possible check that any test would need which would lead to lots of churn to existing tests when new arguments are added. The main testing improvement is for CheckSnapshot() to actually try and load the Android.bp that is generated. In order to do that it was necessary to create a mock filesystem populated with information from the build rules, i.e. the destination files from every Cp command as well as the destination directory from every repackage zip command. That helps detect a number of sources of errors: * Failing to copy a file/directory that is mentioned in the generated Android.bp file. * Invalid properties. * Invalid format of the .bp file. * Integrity issues within the .bp file. Bug: 143678475 Test: m conscrypt-module-sdk Change-Id: I4d3fe18f86698186d18e7e8b32d2e319183f7f0c
Loading
Please register or sign in to comment