These are tests to validate source-compatibility through various changes to FIDL libraries. They do not test binary-compatibility. Tests for compiled languages are only meant to be built, not executed, since source-compatibility issues show up at compile time.
Soft transitioning a FIDL library involves an initial state (before), an intermediate state (during), and a final state (after). Depending on the bindings used and the kind of change made to the FIDL library, the transition is either FIDL-assisted or source-assisted.
In a FIDL-assisted transition, you change source code while the FIDL library is held in a transitional state (e.g., using the Transitional
attribute). For these transitions, we test four states:
Time | 1 | 2 | 3 | 4 |
---|---|---|---|---|
FIDL | before | during | during | after |
Source | before | before | after | after |
In a source-assisted transition, you change the FIDL library while source code held is in a transitional state (e.g., using default:
in switch statements). This would lead to testing four states:
Time | 1 | 2 | 3 | 4 |
---|---|---|---|---|
FIDL | before | before | after | after |
Source | before | during | during | after |
However, certain FIDL changes require a FIDL-assisted transition in some bindings and a source-assisted transition in others. Suppose we make a change in FIDL library L requiring a FIDL-assisted transition in bindings A and source-assisted in bindings B. We would take the following steps:
All correct ways of interleaving the steps will have L and B both in the during state at some point. Therefore, although a FIDL during state is unnecessary for a pure source-assisted transition, we must include it in tests. Thus, we actually test 5 states for source-assisted transitions:
Time | 1 | 2 | 3 | 4 | 5 |
---|---|---|---|---|---|
FIDL | before | before | during | after | after |
Source | before | during | during | during | after |
Under fidl/
there are three libraries:
fidl.test.before
, before the change has begun;fidl.test.during
, during the transition;fidl.test.after
, after the transition is complete.Under cpp/
there are four binary targets testing FIDL-assisted transitions:
cpp_before
compiles cpp/before.cc
against fidl.test.before
cpp_during_1
compiles cpp/before.cc
against fidl.test.during
cpp_during_2
compiles cpp/after.cc
against fidl.test.during
cpp_after
compiles cpp/after.cc
against fidl.test.after
There are currently no tests for C++ source-assisted transitions.
Under go/
there is a single package testing FIDL-assisted transitions. The package has client code:
client_1_before.go
tests client code against fidl.test.before
.client_2_before_during.go
is generated by update-during.sh
.client_3_after_during.go
is generated by update-during.sh
.client_4_after.go
tests client code against fidl.test.after
.And server code:
server_1_before.go
tests server code against fidl.test.before
.server_2_before_during.go
is generated by update-during.sh
.server_3_after_during.go
is generated by update-during.sh
.server_4_after.go
tests server code against fidl.test.after
.There are currently no tests for Go source-assisted transitions.
Under rust/
there is a single library testing both FIDL-assisted transitions:
fidl_assisted/main.rs
executes macros from the other two modules.fidl_assisted/before.rs
defines the macro before_impl
.fidl_assisted/after.rs
defines the macro after_impl
.And source-assisted transitions:
source_assisted/main.rs
executes macros from the other three modules.source_assisted/before.rs
defines the macro before_impl
.source_assisted/during.rs
defines the macro during_impl
.source_assisted/after.rs
defines the macro after_impl
.The macros allow for building the same code against different FIDL libraries without repetition.