Commit graph

8 commits

Author SHA1 Message Date
Zhi Dou
5c912f481e printflags: print flags declared in mainline module
This change adds flag files in mainline module into the read path of
printflags.

Bug: 327466668
Test: build image, flash device with new image, and adb shell printflags
Change-Id: I3c88019086b17ce2eed3c00afff651b1ebd55353
2024-03-04 22:03:05 +00:00
Mårten Kongstad
6fdaa11d7c aconfig: fix formatting warnings
Update the rust toolchain to 1.75.0 and run `cargo fmt`.

Bug: N/A
Test: cargo fmt --check
Test: atest :all
Change-Id: I718c350f4c346b85ff3608f3101278c2ee776b36
2024-01-31 09:40:21 +01:00
Dennis Shen
277e5dc36e Restructure aconfig repo to be a cargo workspace with many crates
Previously, aconfig repo is the root directory of aconfig binary crate,
but it also hosts printflags crate inside, and there is no cargo support
for printflags binary crate. In addition, with more aconfig development,
more crates are being added to this repo. Thus this repo should be
configured as a Cargo workspace with multiple crates rather than a
single crate.

Note the top level Cargo.toml file specifies the crates this workspace
carries:
(1) aconfig_protos: the proto library crate that will be used by many other
crates such as aconfig binary crate and printflags binary crate
(2) aconfig: the aconfig binary crate
(3) printflags: the printflags binary crate

(1) aconfig_protos crate setup:

Inside aconfig_protos dir we set up the aconfig_protos crate, the
previously src/proto.rs is now aconfig_protos/src/lib.rs, the build.rs
is carried over to this crate.

(2) aconfig binary crate setup:

Notice its Cargo.toml file claims package dependency on aconfig_protos
crate. It no longer carries proto related module and build.rs file.

(3) printflags binary crate setup:

Similary, notice that in its Cargo.toml file, it claims package
dependency on aconfig_protos crate.

With this setup, we can Cargo build/test each crate individually when
inside a specific crate dir. But we can also run Cargo build/test at
repo root level, which will build/test all the crates in this workplace.

This is the structuring cl. The next cl is to move storage modules into
its own library crate. This storage file library crate will be used by
both aconfig binary crate as well as flag read library crate (to be
created as another new crate here).

Bug: b/321984352
Test: top and individual crate dir level Cargo build/test, m each
individual targets

Change-Id: I75833f4997f7ee554ff6c1557df9ac87f62b2732
Merged-In: I75833f4997f7ee554ff6c1557df9ac87f62b2732
2024-01-24 02:18:52 +00:00
Atneya Nair
a3a6bfb4a0 aconfig: Print flags with namespace, and sort them
For readability/convenience when looking at BRs/dev.

Test: adb shell printflags
Bug: 315402442
Change-Id: Ia8c447d99f6fe0a9ed6a33c4c68f2e97f5310dc0
2023-12-14 18:02:57 +00:00
Mårten Kongstad
0ae74f86ba aconfig: include all tests in TEST_MAPPING
The aconfig tests used to be implicitly run by Treehugger, but something
has changed and Treehugger no longer verifies aconfig uploads. Fix this
by explicitly listing all aconfig tests in the TEST_MAPPING file.

Treehugger does not allow new tests in presubmit before they have proven
themselves (in terms of flakiness and execution speed) in postsubmit.
For this reason this CL adds the tests to postsubmit; a follow-up CL
will move them to presubmit.

This has the added benefit of allowing developers to easily run all
tests locally, either by

  $ atest

if current working directory is build/tools/aconfig or one of its
subdirectories, or

  $ atest --test-mapping $(gettop)/build/tools/aconfig

from anywhere in the Android tree.

Also add all tests to "general-tests" to enable Treehugger to run them.
Move aconfig.test from "device-tests" to "general-tests"; the former
group is intended for tests that depend on device-specific
functionality. See [1] for more info.

1. https://source.android.com/docs/core/tests/development/test-mapping

Bug: N/A
Test: atest --test-mapping $(gettop)/build/tools/aconfig
Change-Id: If857733834c8ad43a16e6162e50e6b1f713f979d
2023-12-12 14:05:15 +01:00
Mårten Kongstad
6e61f84fd6 printflags: improve protobuf decode error message
Include the file path and first bytes of file in the error message in
case aconfig fails to parse one of the protobuf files.

Example output:

  $ adb shell printflags
  Error: failed to parse /vendor/etc/aconfig_flags.pb ([0a], 1 byte(s))

  Caused by:
      Unexpected EOF

Bug: 304278614
Test: atest printflags.test
Change-Id: I18ff88bd25d72dd477c4b11a32505e75884906ee
2023-10-10 10:12:29 +02:00
Mårten Kongstad
3bb7988492 printflags: include device_config values
Amend the default flag values read from
/<partition>/etc/aconfig_flags.pb with the currently used values as
stored in device_config.

Bug: 301547297
Test: atest printflags.test
Test: adb shell printflags
Change-Id: Ic11702a0ae093d2e9dc3ff543b5ca0684b67e0dc
2023-09-27 10:42:04 +02:00
Mårten Kongstad
433fab94c8 printflags: introduce device tool to print feature flags
Metadata about all feature flags used on device are located in
/<partition>/etc/aconfig_flags.pb. Add a new tool, printflags, to read
and pretty-print these files.

printflags is only intended for debugging purposes.

Bug: 301547297
Test: adb shell printflags
Change-Id: I0a3277fecfc8a60eea0aa6bf362a25a311360b71
2023-09-22 13:47:49 +02:00