Commit graph

8 commits

Author SHA1 Message Date
Tao Bao
6b28f05c5b tests: Move ResourcesTest into component test.
Although the tests were initially written for checking the validity of
the text images, it doesn't hurt to run them continuously as part of the
component test (recovery_manual_test requires reboots during the run,
due to the nature of the tests of recovery-{refresh,persist}). This also
allows detecting breaking changes to libminui or libpng.

There's a catch that the ResourcesTest won't be triggered via `atest`,
as the res-* testdata won't be picked up via AndroidTest.xml. Explored
a few options but not addressing that in this CL:
- `atest` is not fully working in AOSP yet (missing support in
  tools/tradefederation/core/atest/atest.py).
- `atest` doesn't allow specifying the testdata with path in the 'push'
  option.
- It won't fail the test run though, as ResourcesTest will skip the
  tests automatically when it finds no text image file.
- APCT and manual `adb sync data` are not affected, and I don't see an
  active user of `atest` other than a tool for manual test invocation.
- Unrelated to this CL, `atest` doesn't seem to work well with
  recovery_component_test or recovery_unit_test while we have both of
  them in one AndroidTest.xml. It randomly triggers only one of them,
  despite of the given test name. When splitting AndroidTest.xml into
  two, it tends to pick up the wrong testdata subdir and gives wrong
  results.

Test: Run recovery_manual_test and recovery_component_test on marlin.
Change-Id: I3a237499a7770356e14085674bc8b9cb4551db85
2018-04-16 11:29:06 -07:00
Tao Bao
3d0cd1d036 Expose PngHandler via resources.h.
As a private header for testing purpose. PngHandler additionally loads a
given filename if the one with '/res/images' prefix is not available. It
also provides color_type/bit_depth that are parsed from the PNG file.

This allows reusing the same code for the ResourcesTest (renamed from
ResourceTest).

Test: Run recovery_manual_test on marlin.
Change-Id: I3f939d79a1cb1b83a899847dbe2d51bde15d16d8
2018-04-13 15:25:50 -07:00
Tao Bao
9d91e89831 tests: Pick up testdata with LOCAL_TEST_DATA.
Also push the testdata in AndroidTest.xml for `atest`.

LOCAL_TEST_DATA was added in commit [1], which ships testdata next to
native tests.

With this CL,
 1) manually sync-ing via `adb sync` and running tests with `adb shell`
    keep working.
 2) both of 32- and 64-bit recovery_{unit,component}_test now work in
    APCT continuous tests. Note that 64-bit tests were failing
    previously in APCT, due to missing testdata.
 3) `atest recovery_unit_test` works, as the testdata gets pushed to
    /data/local/tmp.

[1] commit d07ba4e2a625a8f000d042c1953adb612bccbbe2 in
https://android-review.googlesource.com/c/platform/build/+/312567.

Bug: 77320514
Test: Build recovery_{unit,component,manual}_test. Setup the test via
      `adb sync data`. Run both of 32- and 64-bit versions on device.
Test: Build and run recovery_host_test on host, for both of 32- and
      64-bit versions.
Test: `atest recovery_component_test`
Change-Id: Ie54037726043a3a659a80030b83db1f8c1de318d
2018-04-02 14:14:29 -07:00
Elliott Hughes
1d65c95fe8 StartsWith allows a std::string prefix now.
Bug: N/A
Test: builds
Change-Id: I5183ec8133f5dc9a81a438223c6d3d2ea11ef0ec
2017-12-20 12:36:31 -08:00
Tianjie Xu
de6735e80c Fix the android-cloexec-* warnings in bootable/recovery
Add the O_CLOEXEC or 'e' accordingly.

Bug: 63510015
Test: recovery tests pass
Change-Id: I7094bcc6af22c9687eb535116b2ca6a59178b303
2017-07-19 12:17:41 -07:00
Tianjie Xu
d17a688525 Add checkers and tests for empty locale in PNG file
match_locale() will return false for empty locale string in the PNG
file. Also add a manual test to validate if a PNG file is qualified to
use under recovery.

Bug: 34054052
Test: recovery_manual_test catches invalid PNG files successfully & Locale_test passed

Change-Id: Id7e2136e1d8abf20da15825aa7901effbced8b03
2017-01-18 19:37:06 -08:00
Tao Bao
a3ece96f9f tests: Replace the O_RDONLY in access(2).
Although O_RDONLY gives the same value as F_OK (0), it's not the right
friend of access(2).

Also clean up the temporary files from ZipTest (TemporaryDir doesn't
like non-empty directory).

Test: recovery_unit_test passes and has no leftover.
Change-Id: I66b90e43c0954c89ce08b36b9e2b4e84183b28f5
2016-12-21 18:56:53 -08:00
Tianjie Xu
5d8b53b248 Move recovery_test.cpp out of unit test
Move recovery-refresh/persist tests out because these tests need special
steps to run. Also switch the constants to std::string.

Test: recovery_manual_test passed on an A/B device
Change-Id: I60b3ec6f094044945c3aafc1fae540896a6ddea6
2016-11-08 10:42:51 -08:00