Sometimes logcat messages are missing and causing rollback tests
to fail which check logcat messages to confirm some particular
rollback events have happened.
Let's use system properties as a reliable way to log rollback
events.
Bug: 171853854
Test: atest StagedRollbackTest NetworkStagedRollbackTest
Change-Id: Ia74da915811978008eed501049f5f44029e5c81a
See b/170689774#comment9.
We need root privileges to read/write files under /data/misc_ce and the
like.
Bug: 170689774
Test: atest StagedRollbackTest
Change-Id: I3504e96e965bba5d640dba08ac5d11cf31c0ddba
1. We need root to push files to folders like
/data/user_de or /data/misc_ce successfully.
2. Disable root at the end of each helper method so
we don't accidentally run the following code as root.
Bug: 170804667
Test: atest StagedRollbackTest
Change-Id: Icfa8054eafa9230a1893bde33b8f0005f8b6c69d
Let's verify the theory in b/170689774#comment4 where the 'after'
list is incorrectly calculated because the 1st #getSnapshotDirectories
fails.
Bug: 170689774
Test: atest StagedRollbackTest
Change-Id: I0570df4642e923d69092bd66125520cb30253863
See b/170689774#comment2.
If the assertion fails, it will log the content of the 'after' list
which gives us more information for debugging.
Bug: 170689774
Test: atest StagedRollbackTest
Change-Id: Ib4ccd1be6f39c1d4c2556cbf6a06cfdf14240220
This test reveals a bug where the De directory of a staged-installed
apk (including the case of apk-in-apex) is not restored correctly.
The bug is fixed by aosp/1450376.
Bug: 169594054
Test: atest StagedRollbackTest#testRollbackApkDataDirectories_De
Change-Id: Ib5179a25446a7ea03f6a4436fe1623f57a013eaf
Revert "Snap for 6793014 from 44725f06b7f7d6407b5ee82d989bdd6c7a..."
Revert "Snap for 6793014 from f22ad3164937a8f2e309965c102b6366d5..."
Revert "Snap for 6793014 from 11467102abddb6026aaa164c1361439c2d..."
Revert "Snap for 6793014 from 265280bf5cb4bc14e132c3a35ae5f7ae65..."
Revert "Snap for 6793014 from f2989f9c65556d5155dbd57f82f0c93a16..."
Revert "Snap for 6793014 from 8b8bf0a07b0521bbe8483fbbab1222ffd6..."
Revert "Snap for 6793014 from 3777d883a3857b1a1589181c436d9018d7..."
Revert "Snap for 6793014 from 3157b4ee4325286f0c2ab0f26528460c8b..."
Revert "Snap for 6793014 from a43295d1825da62af038d345a7a861ed7a..."
Revert "Snap for 6793014 from 2076be4d27078d6ebc0a6b5e5ceb386109..."
Revert "Snap for 6793014 from d0e31526c62b2aeb35c293ac96feb180fc..."
Revert "Snap for 6793014 from 7a3a8c6351d5167a6ae0b33bc376efabd2..."
Revert "Snap for 6793014 from 41471cb21bb16b5c3bcc92f84293b79684..."
Revert "Snap for 6793014 from 42e5cca3cfb829690c9d8c6aca57a8e7d5..."
Revert "Snap for 6793014 from 4f81304963d19f4511b1e8e7d0aad87a67..."
Revert "Snap for 6793014 from 07602cdacf5bcc835db41f7eaa24af9964..."
Revert "Snap for 6793014 from 14cb57e107a3abce8b14937b1f92c28d18..."
Revert "Snap for 6793014 from ab1e4a81d09a540a5f927059e5bc03a606..."
Revert "Snap for 6793014 from 8c65adad0bcdfb3acc561063b4048dca24..."
Revert "Snap for 6793014 from b3061942700265e2bf04af9997775dcbbb..."
Revert "Snap for 6793014 from 551c5953fc62e339e4ee884ec2cd0ac3be..."
Revert "Snap for 6793014 from 4919273b2ac5c6347a18e17c5ec70d8da6..."
Revert "Snap for 6793014 from 988d4244914e0c749655e8cb6db18ba44f..."
Revert submission 12465146-release-request-6b259cbc-1f45-4b05-bc7e-c9b893b79d68-for-git_main-busytown-release-6793014
Reason for revert: b/166531456
Reverted Changes:
I5ff7a6c0d:Snap for 6793014 from f2989f9c65556d5155dbd57f82f0...
I77bdff943:Snap for 6793014 from a43295d1825da62af038d345a7a8...
I2ac5c520a:Snap for 6793014 from c3f124cca05579acf0a6cb589ebd...
I023b9702f:Snap for 6793014 from 98756d6d3e2bb0ba28eb125caa7a...
Ibc7893d72:Snap for 6793014 from fd1ad6750ef332d3f50f218f4d5d...
Ic27847bee:Snap for 6793014 from 8c65adad0bcdfb3acc561063b404...
If20bc9352:Snap for 6793014 from 7a3a8c6351d5167a6ae0b33bc376...
I6542d17e8:Snap for 6793014 from 3777d883a3857b1a1589181c436d...
I66e6bb8a9:Snap for 6793014 from 8b8bf0a07b0521bbe8483fbbab12...
I3cd190b6b:Snap for 6793014 from 424180bdc4aa18249e678daebfd0...
If92db7402:Snap for 6793014 from ab1e4a81d09a540a5f927059e5bc...
Iaced03c87:Snap for 6793014 from d0e31526c62b2aeb35c293ac96fe...
I5d28c6b4b:Snap for 6793014 from 4f81304963d19f4511b1e8e7d0aa...
I30d07bea3:Snap for 6793014 from 7594ec6384c4da320726def34f47...
I473205f48:Snap for 6793014 from 551c5953fc62e339e4ee884ec2cd...
I0656b41af:Snap for 6793014 from 44725f06b7f7d6407b5ee82d989b...
I0f9796067:Snap for 6793014 from 4919273b2ac5c6347a18e17c5ec7...
I9a38cda8f:Snap for 6793014 from 2076be4d27078d6ebc0a6b5e5ceb...
I876a82f51:Snap for 6793014 from 11467102abddb6026aaa164c1361...
I749d7d023:Snap for 6793014 from 41471cb21bb16b5c3bcc92f84293...
I038daea41:Snap for 6793014 from 07602cdacf5bcc835db41f7eaa24...
I47aa3131c:Snap for 6793014 from 14cb57e107a3abce8b14937b1f92...
I32dba8a95:Snap for 6793014 from 3157b4ee4325286f0c2ab0f26528...
I2ebc9f9db:Snap for 6793014 from 988d4244914e0c749655e8cb6db1...
Iae7c3370f:Snap for 6793014 from 9ffb8852294e06e2d387dc1fb868...
I6467a7f1b:Snap for 6793014 from 42e5cca3cfb829690c9d8c6aca57...
I8c6375203:Snap for 6793014 from b3061942700265e2bf04af999777...
I843b2e1f3:Snap for 6793014 from 265280bf5cb4bc14e132c3a35ae5...
Ie254f7079:Snap for 6793014 from f22ad3164937a8f2e309965c102b...
I01e0974ed:Snap for 6793014 from bbbccc3c2b7fc7c5780f6c415c42...
Change-Id: I9160aa1ae5523d8e92c618ae1922576bb70a7ac8
See b/161410257#comment1 for the details.
We need to pass MATCH_ANY_USER to ensure packages installed on the
2nd user are visiable to PackageWatchdog so it can observe packages
with rollback enabled correctly.
Bug: 161410257
Test: atest MultiUserRollbackTest#testBadUpdateRollback
Change-Id: Ie06eadfe14e003675b1898208f907ba7bb1d86b7
This CL passes the correct install user when creating sessions in
StagingManager and effectively reverts ag/6901350.
Add a test to ensure b/129397974 is not regressed as described in
b/158222747#comment11.
Fix: 129744602
Fix: 158222747
Test: atest MultiUserRollbackTest#testStagedRollback
Change-Id: I718992240aa76898ff9e4220ea6a769ee8cd61f5
The original code is flawed in that `pm install-abandon` only abandons
the 1st session returned by `pm get-stagedsessions ...`.
1. move AbandonSessionsRule to be shared by multiple host tests
2. use AbandonSessionsRule to do the job
Bug: 160754072
Test: StagedInstallInternalTest
Change-Id: Ib7b32fbd7b1133ac6a8e6782234a4fe2c5a782bd
Now we delete APEX CE snapshots immediately when a rollback is deleted.
If the user is locked, the deletion will fail, but that's OK. The
orphaned snapshots will be cleaned when the user is unlocked.
Bug: 158712947
Test: atest StagedRollbackTest RollbackUnitTest
Change-Id: I3e3eef4c52f281d28a6a6ac6735c27ef8b83ddc2
See b/160281947#comment2 for the analysis.
Let's clean up staged sessions to improve test isolation.
Bug: 160281947
Test: atest StagedRollbackTest
Change-Id: I3ad6317eaee3ffb4c6351c630460dd8f1d27e644
This change handles the case of split APKs. All files starting with
"NetworkStack" will be returned as split APKs.
See b/159978937#comment6. NetworkStack is changed from a single APK to
split APKs. We need this change for install to succeed.
Bug: 159978937
Test: atest NetworkStagedRollbackTest
Change-Id: I20f5fee08ea208ba4dc7711d82a1718239c647c2
Disable the test because it is blocking pre-submit.
The analysis is at b/159569441#comment2. Waiting for the NetworkStack
team to figure out what's going wrong.
Bug: 159569441
Test: m
Change-Id: Ibb921b8e718c5c9cd86c5580010cb163125d8fae
Tests that CE snapshots for APK are deleted after restoration.
Bug: 151805360
Test: atest StagedRollbackTest
Change-Id: I0e03909b4ac52ea60e399adf5e5a0066d71cb257
See comment#6.
Clean up rollbacks and test apps before and after running tests.
This ensure we are in a good and expected condition when running tests.
Bug: 154080003
Test: atest RollbackTest
Test: atest MultiUserRollbackTest
Test: atest NetworkStagedRollbackTest
Test: atest StagedRollbackTest
Change-Id: If10fc8865e644611f1cf6a9db9d6dca6c7f11aee
1. Document behavior changes due to ag/11475396
2. Test snapshots are deleted after restoration
See go/rollbackmanager-snapshot-deletion for more details.
Bug: 151805360
Test: atest StagedRollbackTest
Change-Id: Ia8993f82073a145889243bcefc74b6336bf71749
Test that the user data is wiped out correctly when
rollbackDataPolicy="wipe" is specified in the manifest.
Bug: 148098864
Test: atest RollbackTest StagedRollbackTest
Change-Id: I1de723951009ec8e1417a23845d34fcd8786f687
The test failed because it can't find the apk file for NetworkStack.
Let's include more names for search.
Bug: 154792230
Test: atest NetworkStagedRollbackTest
Change-Id: I0909e531fcd0e99fcedb8d07ba0be01f4e762914
The test failed because we failed to enable rollback for
ModuleMetadataGoogle which is not a module on AOSP builds.
Let's skip the test for builds which have no mainline modules
installed.
Bug: 152721401
Test: atest StagedRollbackTest
Change-Id: Iaf75dea5388e2a751a26f983a79924c4358d4833
See b/152840581#comment2 for the analysis.
1. call #waitForDeviceNotAvailable to wait for reboot reliably.
2. reduce watchdog timeout to 120s which works well for me and speeds up
the test.
Bug: 152840581
Test: atest StagedRollbackTest
Merged-In: Ibbc9998c74681b1b8fc29b90ea66406f39ae7443
Change-Id: Ic791fbc00c231a5f24751b36e99515cfad13b7e7
See b/152840581#comment2 for the analysis.
call #waitForDeviceNotAvailable to wait for reboot reliably.
Bug: 152840581
Test: atest NetworkStagedRollbackTest
Change-Id: Ibbc9998c74681b1b8fc29b90ea66406f39ae7443
See b/151890602#comment4.
If the assumption is true, we will see logs that the rollback for
testappA is exipred happens slightly after the call to #getAvailableRollbacks.
Also move assertions below so the test runs to the end and we have a
better picture for what happened during the test.
(Cherry-picked from eab998a9af)
Bug: 151890602
Test: m
Merged-In: I85adb8c3c5598ef4ce11550b51f22d1ce3c282a6
Change-Id: I85adb8c3c5598ef4ce11550b51f22d1ce3c282a6
It is possible to have multiple committed rollbacks which include the
same app.
Uninstalling an app will delete committed rollbacks which include
the app. However, there is a race condition between when the app is
uninstalled and when rollback manager deletes the rollback as is stated
here:
https://cs.corp.google.com/android/frameworks/base/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/RollbackTest.java?rcl=75dfeca3d40624b745f41155aa38bc5e3fa405fe&l=116
We hit the assertion in #getUniqueRollbackInfoForPackage when there are
multiple rollbacks including the same package which is caused by the
race condition above.
Let's rewrite the code by calling #hasRollbackInclude instead which will
not throw.
Also do some cleanup in the xml to improve the isolation of our tests.
Bug: 152271716
Test: atest RollbackTest
Change-Id: Iad3effe52db2a0d2d5e3914bcd08ed93926f3fd3
https://g3doc.corp.google.com/experiments/g3doc/mobile/phenotype/android/testing.md?cl=head#hermetic
Phenotype talks to a server to override the device config changes made
by the tests. Therefore, rollback expiration didn't happen as expected
and caused the test to fail.
We need to override the flags on our own during tests so the
device config values ('rollback_lifetime_in_millis' in this case)
won't be changed in an unexpected way.
Note this is the same fix as ag/10467568.
Bug: 151890602
Test: atest RollbackTest
Change-Id: Ie884e4807999d105f6224c46a39434e1f437ed1b
When tradefed fails to run a test, it will try to recover the device
which might lead to another reboot. This interferes with our test
flow which also involves reboot. See b/150749023#comment2 for more
details.
Let's rewrite the test to prevent auto-recovery of tradefed from kicking
in. Generally, it is a bad practice to depend our test flow on a failed
test due to reboot. We should call #waitForDeviceNotAvailable to wait
for reboot to happen and then call #waitForDeviceAvailable before
continuing next tests.
Bug: 150749023
Test: atest StagedRollbackTest#testBadApkOnly
Change-Id: Ia39630585c3b7344174a8c66d0a33f05a2d80cc7
Somehow rollbacks related to testappA are not cleaned before running the
test and cause test failures. See b/150653097#comment2 for more details.
Let's clean rollbacks manually to have a clean start.
Bug: 150653097
Test: atest MultiUserRollbackTest
Change-Id: I4eb126e193f76c821d26fc62115263b86066a215
https://g3doc.corp.google.com/experiments/g3doc/mobile/phenotype/android/testing.md?cl=head#hermetic
Phenotype talks to a server to override the device config changes made
by the tests. Therefore, watchdog timeout didn't happen as expected and
caused tests to fail.
We need to override the flags on our own during tests so the
device config values ('watchdog_request_timeout_millis' in this case)
won't be changed in an unexpected way.
See b/148042585#comment21 for more details.
Bug: 148042585
Test: atest NetworkStagedRollbackTest
Change-Id: I4d8944f7fef93445de8f971c6a96fef7c71872db
In the cases that a logging parent cannot be found for any packages
in a rollback, the watchdog event should still be logged. Ensure
that the state of a rollback is captured on boot by removing the
condition of only saving a rollback id if there is a logging package,
and by adding a symbolic null package to the list of logging packages
on boot if none were found. Expand tests to verify.
Bug: 149957011
Test: atest StagedRollbackTest
Test: atest NetworkStagedRollbackTest
Change-Id: I56f8afb6730e59fbe67ea8747e0da3aca19a0d8a
'-g' to grant permissions automatically without checking the API level.
This works around the issue of b/149733368#comment2.
'--user all' to install the app on all users. This is more efficient
than calling #installPackageAsUser one by one on each user.
Bug: 149876119
Test: atest MultiUserRollbackTest
Change-Id: Ia5d85d3c13925ae969ffab9319360c1fefe1f950
My local test shows that switch-user doesn't work on my physical device.
In fact there are APIs to run tests against a particular user without
switching. It also speeds up tests without switching users from time to
time.
Bug: 149876119
Test: atest MultiUserRollbackTest
Change-Id: I34d26ddcb6a6e9cdc39228310830a3cd83212e4a
Sometimes RollbackManager is slow in making rollbacks available.
Let's give it enough time to do the job and make test less flaky.
Bug: 149876119
Test: atest MultiUserRollbackTest
Change-Id: I0a64e2dcde1f5e6dae618cacd6546ad953c1aca7
Don't reboot the device when there is no file to delete. This saves us a
significant amount of time since each reboot takes 1 min and there are
dozens of reboot during the whole test case.
Bug: 149528114
Test: atest StagedRollbackTest
Change-Id: If3b06a304d9c87680c7cc5b7498d3b2ecf11cdfa
By classifying the tests into 2 categories, we can:
1) run remaining tests with network disabled to reduce the interference
of network crashes.
2) make it easier to identify bugs caused by network stack or
problems in rollback infra.
Note this CL contains stubs only. We will move actual test code later.
Bug: 147785893
Test: m
Change-Id: I5ecc63a057e9a115ea3aa446970a3f20dff750d0