summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* CompatibilityMatrix::combine() combines everything correctlyYifan Hong2018-10-151-1/+4
| | | | | | | | | | | | | | | | | | | | | * Combines <kernel> correctly in order to make assemble_vintf add <kernel> in any order. That is, we now allow: assemble_vintf -i base_matrix.xml -i kernel_config_base.xml -i kernel_config_x86.xml ... and <kernel>'s will be added in the correct order even when the order of kernel_config_base.xml and kernel_config_x86.xml is swapped. * Combine <sepolicy> and <avb> correctly. They can only be defined once per level. Test: libvintf_test Test: vintf_object_test Test: build framework compatibility matrix and inspect output manually Bug: 78943004 Change-Id: I6c90849b8bef0b690fb292bcc5fa8c514f323d96
* Add test for HalManifest::getHalNamesAndVersionsYifan Hong2018-10-041-0/+6
| | | | | | Change-Id: I1f1c287d3b30f4e158b515e3794293da8a263594 Fixes: 116259705 Test: libvintf_test
* Add test for multiple device matricesYifan Hong2018-09-201-0/+64
| | | | | | Test: libvintf_test Bug: 116062715 Change-Id: Id3aa32511111bf58d0c847b9683526825c9793a7
* DisabledChecks -> CheckFlags namespaceYifan Hong2018-08-081-1/+1
| | | | | | | | | | Switch from negative flags to positive flags using the dedicated CheckFlags::Type class. Bug: 110711640 Test: libvintf_test Test: vintf_object_test Change-Id: I13f741b64520bd58349dbbf6c874dd1559d79ad8
* SerializeFlags: Remove legacy APIsYifan Hong2018-08-081-6/+4
| | | | | | | | | | Remove legacy bitwise operators and boolean conversions that are meant to be compatible with the old negative flags usage. Also fix all such usages. Bug: 110711640 Test: libvintf_test Change-Id: Ic69a7066dd3ae320aeb0a1848eb7719f67da29d3
* SerializeFlag => SerializeFlagsYifan Hong2018-08-081-20/+20
| | | | | | | | | | | | This is a straightforward refactoring to remove the SerializeFlag enum. They are combined into one class because SerializeFlag is the old negative bitfields and is confusing. SerializeFlags will contain positive bitfields. Bug: 110711640 Test: libvintf_test Change-Id: I46070db674955add4971b0dc5736a43436f54ddf
* update kernel config suffix to .configSteve Muckle2018-07-242-6/+6
| | | | | | | | | The kernel configs are changing their naming scheme to use a suffix of ".config" rather than ".cfg". Test: build and boot Bug: 111762107 Change-Id: I590bccb6150d07795d84b12b588faa5e51138605
* VintfObject now provides instance methods.Yifan Hong2018-07-134-140/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VintfObject used to only contain static methods. It now contains instance methods, and the static methods are delegates to the instance methods. For example: GetDeviceHalManifest calls GetInstance()->getDeviceHalManifest() getDeviceHalManifest does the actual job. The static dependencies (FileSystem, PropertyFetcher, PartitionMounter, ObjectFactory<RuntimeInfo> are also moved from utils.cpp to the static VintfObject instance. Tests are updated to create a test VintfObject instance with the mocked dependencies, and run test on the test object. As a result, utils.cpp is now empty and removed, and libvintf_common is the same as libvintf. Hence libvintf_common is also removed. This allows: - Allows better mocking in tests. Tests are now independent of each other because a new VintfObject is created for every test. (Previously this is done very badly by clearing the global states, which is error prone) - A bug in VintfObjectTest.FrameworkCompatibilityMatrixCombine is discovered because it depends on setting global states in previous test cases. This is also fixed in this CL. - In recovery, two VintfObject is required; one for XMLs in the recovery image (under /) and one for XMLs in system/vendor image (under /mnt). HIDL HAL getService in recovery depends on the former, and OTA depends on the latter. This CL prepares recovery to work. (A follow-up CL is needed to update VintfObjectRecovery to use /mnt for getService). Some other notable changes in the CL: - CompatibilityMatrix/HalManifest fetchAllInformation now takes a FileSystem argument to fetch files correctly, because the global FileSystem object is removed. - Globals in utils.cpp / utils-fake.cpp is removed - DevicePropertyFetcher is moved from utils.cpp to PropertyFetcher.cpp and is always built (for both host and target); but host VintfObject uses dummy PropertyFetcher by default. (See createDefaultPropertyFetcher in VintfObject.cpp). Bug: 110855270 Bug: 80132328 Bug: 111372832 Test: vintf_object_test Test: livintf_test Change-Id: I24320662191b977c0e562129e49b33e80de727cc
* Allow to get <vendor-ndk><version> from matrixYifan Hong2018-05-221-0/+2
| | | | | | | Test: vts_treble_vintf_vendor_test Test: libvintf_test Bug: 78117402 Change-Id: I4da7d23a354a59aaa27d0b61f8fd98a54f0fb1ec
* Hide HalGroup::getHalsandroid-p-preview-3android-p-preview-2Yifan Hong2018-05-071-9/+15
| | | | | | | Test: builds Test: libvintf_test Fixes: 74247301 Change-Id: Ie3b58ab42e66fab2f9d2e5d490461476d5c84d5d
* Add HalManifest::insertInstanceYifan Hong2018-05-021-1/+1
| | | | | | | | | | This is an API to add the new <fqname> tags. This helps, for example, lshal. Bug:74247301 Test: libvintf_test Change-Id: Iae3f9bae7120e430b376171c4e23b7d1d0798c06
* CompatibilityMatrix::combine add <kernel> from new matricesYifan Hong2018-04-301-8/+86
| | | | | | | | | | | | | | | Just as <hal> and <xmlfile> are added from new matrices to old matrices as optional, so are <kernel> tags as well. This avoids the hack that new <kernel> versions are added retroactively. Specifically, we don't want to add 4.14 to every matrix, but rather let libvintf do this automagically. Bug: 78576469 Test: vintf_object_test Test: libvintf_test Test: manually inspect built matrices Change-Id: Ia779c5e25c7c3db218007d23e4c887e8cd44e730 Merged-In: Ia779c5e25c7c3db218007d23e4c887e8cd44e730
* Merge "Compat if POLICYVERS <= security_policyvers()"Treehugger Robot2018-04-181-2/+2
|\
| * Compat if POLICYVERS <= security_policyvers()Yifan Hong2018-04-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POLICYVERS in the build system specifies the policydb version that the policy is compiled with. security_policyvers() specifies the maximum policy version that the kernel is compatible with. Allow POLICYVERS <= security_policyvers() to be considered compatible. This changes compatibility check logic for RuntimeInfo, hence this does not affect OTA, except the following case: * device kernel reports 30 * new images are built with POLICYVERS=31 * fwk matrix has 31 * device do OTA with these images * OTA will fail Right now, since there are no plans to bump POLICYVERS in build system (and it stays 30), OTA won't break. Bug: 77886167 Test: vts_treble_vintf_test Change-Id: I91fb631b291d17e26ad1a9befb669aac6b7ed654 Merged-In: I91fb631b291d17e26ad1a9befb669aac6b7ed654
* | Cleanup global FileFetcherandroid-o-mr1-iot-preview-8Yifan Hong2018-04-103-45/+37
|/ | | | | | | | | | | | | | | | | | This global instance is modifiable everywhere and is hard to maintain. It also contains references as out-variables, which is not the standard. Clean it up by refactoring it into a public (i.e. not in details namespace) class, FileSystem. Introduce VintfObject::InitFileSystem that allows the behavior to be changed before any files are read. Bug: 37999212 Test: host and target libvintf_test, vintf_object_test Change-Id: I1c64b31fd37119450be89dfd1d2bfe76a71ccf3d Merged-In: I1c64b31fd37119450be89dfd1d2bfe76a71ccf3d
* Merge "Support for fragmented manifests."Treehugger Robot2018-04-051-0/+15
|\
| * Support for fragmented manifests.Steven Moreland2018-04-051-0/+15
| | | | | | | | | | | | | | | | Bug: 66917623 Test: vintf_object_test (host + device) Test: libvintf_test (host + device) Test: boot device which is depending on fragments Change-Id: Iab0c1e3a2031029c155c08a1cec7079537756a43
* | Always include file names in assembled xmls.Steven Moreland2018-04-051-0/+16
|/ | | | | | | | | | With fragments becoming more popular and build system support for them on the way, this is useful for debugging. Change-Id: Ida7631dc0f314739aa1b275a6aee0264972c0f21 Fixes: 77640776 Test: libvintf_test
* assemble_vintf: Add checkUnusedHalsYifan Hong2018-03-291-0/+2
| | | | | | | | Test: m framework_compatibility_matrix.xml device_manifest.xml Bug: 65028233 Change-Id: I466c60573676e8bf3a0d8d97000c380bdfec4b58 Merged-In: I466c60573676e8bf3a0d8d97000c380bdfec4b58
* assemble_vintf supports DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILESYifan Hong2018-03-271-0/+82
| | | | | | | | | | | | | | Relax multiple cases that were previously flagged as error to allow combining matrices that doesn't have a "level" attribute. Specifically, all HALs in matrices without a specific FCM version are added as-is. Test: m framework_compatibility_matrix.xml -j Test: libvintf_test Test: vintf_object_test Bug: 65028233 Change-Id: Ifa947529731ab17d705be945139de504db2d0253
* regex-instance: tests for regex instancesYifan Hong2018-03-232-0/+395
| | | | | | | | | | | | | | | | | | Adds tests to libvintf_test and vintf_object_test to test the following: * HalManifest::checkUnusedHals * HalManifest::checkCompatibility * CompatibilityMatrix::combine * VintfObject::CheckDeprecation Bug: 73738616 Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Change-Id: Ia376d55be3394761d193a044a11229a55944cf9b Merged-In: Ia376d55be3394761d193a044a11229a55944cf9b
* regex-instance: Fix check deprecate testYifan Hong2018-03-221-36/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecation check should check <regex-instance> as well as <instance>. An instance is considered deprecated if it matches some <instance> or <regex-instance> in "old" matrix but a higher major version / higher minor version matchese some <instance> or <regex-instance> in "new" matrix. For example: 1.xml: @1.0::IFoo/legacy/[0-9]+ 2.xml: @2.0::IFoo/leg[a-z]+/[0-9]+ And a device manifest provides @1.0::IFoo/legacy/1, then this instance is deprecated. Caveat: VintfObject::IsInstanceInUse is changed to VintfObject::ListInstances because the matrix no longer provides an exact list of instances that it checks, but rather a "match rule"; hence it needs to list all instances from IServiceManager or manifest to work. However, this doesn't work with passthrough service manager. Hence, if a HAL is a passthrough HAL, only <instance>s can be checked. Bug: 73738616 Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Change-Id: Ibb7585b157c3c1148ba78b8fcd27a113d398297a
* regex-instance: HalInterface: add regex API and hide public fieldsYifan Hong2018-03-221-5/+3
| | | | | | | | | | | | | | | | <regex-instance> is added under an <interface> tag, which is represented by an HalInterface object. Add API for looping over all <regex-instance>s / <instance>s under it. With this API, HalInterface can hide its public fields. Bug: 73738616 Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Change-Id: Ia072dd7e946c28789797db8a46fd968bc7872dca
* HalManifest::getTransport uses instance API.Yifan Hong2018-03-201-0/+3
| | | | | | Test: vts_treble_vintf_test Bug: 73556059 Change-Id: I9076e765e3ad549386f7945d921859f148edd797
* CompatibilityMatrix::combine handles multiple instances.Yifan Hong2018-03-191-0/+197
| | | | | | | | | | | | | | | | | | | | | Fix an edge case: 1.xml states 1.0/default AND 1.0/custom 2.xml states 2.0/default AND 2.0/strong The old code generates: (1.0/default AND 1.0/custom) OR (2.0/default AND 2.0/custom) The new code correctly generates: (1.0/default OR 2.0/default) AND (1.0/custom) AND (Optional 2.0/strong) Test: libvintf_test Test: vintf_object_test Bug: 74341777 Change-Id: I07f0529b9bc1d046c269fc41f33be307f599422a
* CompatibilityMatrix::combine also allow downrev of minor version.Yifan Hong2018-03-151-1/+1
| | | | | | | | | | If level=1 states foo@1.2-3 and level=2 states foo@1.0-4, then combine() should return a matrix with foo@1.0-4. This relaxes the minor version requirement on upgrading devices. Test: libvintf_test Bug: 74341777 Change-Id: Ia9bd3f7ce4ab39745acaabbe1ed111b490a379cf
* CompatMatrix::combine allow to use hal versions at higher FCM version.Yifan Hong2018-03-152-16/+52
| | | | | | | | | | | | | | Test: libvintf_test Test: vintf_object_test Test: vts_treble_vintf_test Test: build compatibility matrix with device of target-level 2 (marlin), audio 2.0 and 4.0 are now in "OR" relationship. Bug: 74341777 Fixes: 70673533 Change-Id: I7e9eb09e846304d6cb6c0479c7e7dffaeffad9df
* Add <fqname> to manifests.Yifan Hong2018-03-141-7/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | The format of <fqname> is: <hal> <name>android.hardware.foo</name> <!-- transport, etc. --> <fqname>@1.0::IFoo/default</fqname> </hal> It is possible to mix <fqname> and <version> x <interface> x <instance> ; see tests for details. This allows instances at different versions. For example, it is now allowed to serve @1.0::IFoo/default, @1.1::IFoo/custom simultaneously without serving @1.1::IFoo/default. If override="true" and no <version>x<interface>x<instance> nor <fqname>, the HAL tag is disabled. (Previously, the HAL tag is disabled iff no <version> exists). Bug: 73556059 Test: libvintf_test Test: vintf_object_test Change-Id: I80cb9ccdeec708c2c5530812913b37f8b3cc3ffa
* HalManifest::checkIncompatibleHals uses instances API.Yifan Hong2018-03-141-1/+1
| | | | | | | | | | | Now that <hal> is not the smallest unit of a manifest, the compatibility check logic is updated accordingly. Test: libvintf_test Test: vintf_object_test Bug: 73556059 Change-Id: Ief73afc61bace0dcc3d02410c16c7e261fa63315
* Tests for ManifestHal::isDisabledHalYifan Hong2018-03-141-0/+33
| | | | | | Bug: 69051162 Test: libvintf_test Change-Id: I0afbf3e68d27bfb4a7d29749e02b56a1cabb64ac
* Add ManifestHal::isOverride().Yifan Hong2018-03-131-2/+2
| | | | | | | | | Hide the isOverride field. Bug: 73556059 Test: vts_treble_vintf_test Test: libvintf_test Change-Id: Ib7d4a96e7043124617841277b06afc456d01672a
* ManifestHal: constructor fixYifan Hong2018-03-131-76/+62
| | | | | | | | | | This allows ManifestHal to have private fields. Test: builds Test: libvintf_test Test: vintf_object_test Bug: 73556059 Change-Id: Idbe7966c92a1832095b8cd7a6bddeb15fc4a73ee
* Instance is the smallest unit of manifests/matrices.Yifan Hong2018-03-122-31/+8
| | | | | | | | | | | | | | Introduce forEachInstance on HalManifest and CompatibilityMatrix, because <hal> are no longer the smallest unit of tests, but rather a ManifestInstance / MatrixInstance object. Bug: 73556059 Bug: 74247301 Test: libvintf_test Test: vintf_object_test Change-Id: If7186617db52acd67f255ac6e6c99f34a7570206
* Update "HALs incompatible" message with FCM versionYifan Hong2018-03-071-2/+4
| | | | | | Test: libvintf_test Change-Id: Ib7ef638ffee89e1acb105cc5680cc39a893e82fe Fixes: 74089125
* use FQName parseSteven Moreland2018-03-061-2/+1
| | | | | | | | | | FQName::FQName(string) could leave the FQName in an invalid state, and so this constructor is being removed and the mValid member is being removed. Bug: 73774955 Test: vintf_object_test Change-Id: I5d507b1199f098baacff984b3307c535bd85b7fb
* Add PropertyFetcher.Yifan Hong2018-03-053-9/+29
| | | | | | | | | | | | | This is a mockable / replacable class for getting sysprops. On host, sysprops may be provided via ADB or command line arguments. On device, default behavior is to use android-base/properties.h. Bug: 72722951 Test: libvintf_test Test: vintf_object_test Change-Id: I752c4336dacd4c5f3254f32e4caf8dc743c636d9
* Create libvintf_commonYifan Hong2018-03-053-12/+13
| | | | | | | | | | | | | | | | | | This is a static lib excluding utils.cpp. This is originally libvintftest, but modified to include RuntimeInfo and KernelConfigParser as well for better generalization. This lib can be used instead of libvintf when different FileFetcher / PropertyFetcher / PartitionMounter are needed, for example. Test: builds Test: libvintf_test Test: vintf_object_test Bug: 72722951 Change-Id: I3e4400bfb00bf0434a90a5fca9709bc76d5026c2
* Better error message for incompatible HALs.Yifan Hong2018-02-122-3/+106
| | | | | | | | | Specify the exact requirement (with instance names expanded) that the HAL manifest is missing. Test: libvintf_test Change-Id: I817fef94dd42d58fe86a5ecb3e6603210f936d5d Fixes: 71801860
* parse_xml.cpp: Deserilization does not touch lastError()Yifan Hong2018-02-121-6/+33
| | | | | | | | | | | | | | | | | | The global mLastError fields for each converters can potentially cause a segfault when a program with multiple threads tries to deserialize a bad file at the same time. - deserialization APIs that touches the mLastError field are marked as non-const APIs - const variants are provided (error is provided as an output parameter) - Functionalities are equivalent (tests ensure this). Test: libvintf_test Test: vintf_object_test Fixes: 71874788 Change-Id: I416de909b32809a4ac377d9da998c48d7d409457
* Framework matrix set from PLATFORM_SEPOLICY_*Yifan Hong2018-02-071-1/+1
| | | | | | | | Test: libvintf_test Test: m framework_compatibility_matrix.xml -j Bug: 67920434 Change-Id: I37046c2c97ec7f073f02196008de64efab30a105
* Do not allow duplicated manifest.vendor-ndk.version.Yifan Hong2018-02-021-0/+17
| | | | | | | | | | | | | As specified by VINTF doc in P, the following is not allowed: <manifest...> <vendor-ndk><version>27</version></vendor-ndk> <vendor-ndk><version>27</version></vendor-ndk> </manifest> Test: libvintf_test Change-Id: Ib9d42d2d75b7362c268597bc947c214e03dd5d00 Fixes: 72461606
* remove LIBVINTF_HOST macroYifan Hong2018-01-312-8/+8
| | | | | | | | | | | | There is a mixed use of LIBVINTF_HOST and LIBVINTF_TARGET, and for libvintftest, LIBVINTF_HOST is not even defined properly. Remove the use of LIBVINTF_HOST and replace with LIBVINTF_TARGET instead. Test: libvintf_test Test: vintf_object_test Change-Id: I557e65376dfd1d0fe953e9a7a03a47f227596460
* Add VintfObject::CheckDeprecation().android-wear-8.0.0_r1Yifan Hong2018-01-242-1/+192
| | | | | | | | | | | | | | | | | | | | This API reads all framework matrices at different FCM version, and consider a service instance as "deprecated" if all of the following is true: 1. instance is in an "old matrix" 2. instance is not in the "new matrix" 3. instance is registered through service manager / in device manifest 4. No instance with the same package/major version/interface/ instance name but a higher minor version is: 4.1 in the "new matrix"; and 4.2 registered through service manager / in device manifest. Test: vintf_object_test Test: vts_treble_vintf_test Bug: 69425186 Change-Id: I316ba9510688fc927b8f0675ed8db5e29d5036dd
* AssembleVintf: add minor revision to kernel versionYifan Hong2018-01-231-4/+5
| | | | | | Test: builds Bug: 72388844 Change-Id: I7af9aad696781be80af048dd48162e6c4e9fd9bf
* CompatibilityMatrix: do not write <sepolicy> and <avb> if emptyYifan Hong2018-01-231-7/+1
| | | | | | | | They are parsed as optional tags, so it is okay to not write them when they contain no values. Test: libvintf_test Change-Id: I5da7830e3838b25def874dd4ef01b20b900bac5f
* Merge "Test to add new tags to manifests."Treehugger Robot2018-01-221-0/+27
|\
| * Test to add new tags to manifests.Steven Moreland2018-01-221-0/+27
| | | | | | | | | | | | | | | | We're relying on this to keep the manifest updated. Change-Id: I0c25a9e7465ef83c2092668b60c7baafe724ca48 Fixes: 71879447 Test: libvintf_test
* | AssembleVintf: PRODUCT_ => PLATFORM_ for system sdk versionsYifan Hong2018-01-221-1/+1
|/ | | | | | Test: libvintf_test Bug: 69088799 Change-Id: Iafe51d06972760cd01df78acb79bcac421b53c8e
* Load ODM manifest from /odm/etc/vintf as wellYifan Hong2018-01-191-76/+116
| | | | | | | | | | | ... as /odm/etc/ . /odm/etc/vintf has higher priority than files under /odm/etc. As a side effect, simplified the device manifest loading logic. Test: vintf_object_test Fixes: 36790901 Change-Id: Ie4816e83ac88492250b030a5a48b9fd4640c0dbb
* VintfObject: load /vendor/etc/vintf/cm.xml before /vendor/cm.xmlYifan Hong2018-01-191-0/+3
| | | | | | | | cm => compatibility_matrix Test: vintf_object_test Bug: 36790901 Change-Id: Id62cbd1a2a7612c0fbf15adce39dbef67a4c18a8