Commit Graph

6 Commits

Author SHA1 Message Date
Joshua Gross 967eeff86e Add unit tests for Layout Animations
Summary:
Add unit tests for Layout Animations.

This first batch generates a random mutation, then animates it to completion.

I found one issue with UPDATE+REMOVE+INSERT animation consistency. That shouldn't cause any crashes in production, but is a chance to improve consistency of mutations overall - and could in theory point to memory corruption, though it's somewhat unlikely.

I ran with randomized seeds, found issues, fixed them, re-ran to ensure issues were fixed, rinsed and repeated. At the end I was able to run dozens of times (with random seeds) and found nothing.

The next step is to repeatedly generate mutations that conflict with ongoing animations.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D28343750

fbshipit-source-id: c1c60d89a31be3ac05d57482f0af3c482b866abe
2021-05-11 12:11:35 -07:00
Micha Reiser dde48fd554 Use mock clock
Summary:
Change the `TransactionTelemetryTest` to use a mock clock or change the tests to only test if at least x amount of time has passed.

Using a mock clock is the only way to make the test deterministic and be able to assert on the sub-results of the captured phases.

Changelog: [Internal] Change to the `TelemetryTest`. Neither changes the runtime behavior nor the API.

Reviewed By: sammy-SC

Differential Revision: D27618448

fbshipit-source-id: 0cbf51b050aabb75341112ea4a43bea0115082f9
2021-04-08 09:27:18 -07:00
Micha Reiser 46acfcb8fc Allow swapping the clock implementation for TransactionTelemetry
Summary:
The `TransactionalTelemetryTest`s are flaky because they use a real clock and assert on how much time has passed (with a threshold, but that's no good either).

Using the real clock in the test is the cause for the test to be flaky because it depends on the assumption that it's the sole process running, never risking to be put in the process-queue of the OS. However, that's not the case and is why the test sporadically fails if the OS decided to schedule other threads/process in the middle of the test.

This diff allows parametrising the `TransactionTelemetry` class with the clock implementation so that tests can use a Mock Clock if desired (separate diff).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D27618516

fbshipit-source-id: 5a08e115b388398ca2b05b9d5ae0fd281dfe3b04
2021-04-08 09:27:18 -07:00
Micha Reiser 28ed660c2d Use EXPECT_NEAR to improve test failure messages
Summary:
The current test failures don't include the values passed to `EXPECT` which makes it difficult to understand if the test ended earlier or later then expected.

```
Failure: Value of: (commitDuration >= 1000 - threshold) && (commitDuration <= 1000 + threshold)
  Actual: false
Expected: true
```

This diff uses the gtest `EXPECT_NEAR` to get exception messages including the delta:

```
Failure: The difference between telemetryDurationToMilliseconds(telemetry.getTextMeasureTime()) and 600 is 153, which exceeds threshold, where
telemetryDurationToMilliseconds(telemetry.getTextMeasureTime()) evaluates to 753,
600 evaluates to 600, and
threshold evaluates to 70.
```

This doesn't change the test's flakiness because of how sleep is implemented.

Changelog: [Internal] Test only change

Reviewed By: sammy-SC

Differential Revision: D27595206

fbshipit-source-id: f31bdd92ecc7271c9491dda18639ea08820f5730
2021-04-07 01:31:47 -07:00
Samuel Susla 9ef995a14a Enable C++ 17 in React Native
Summary:
Changelog: [Internal] enable support for C++ 17.

C++ 17 in React Native targets.

Short and comprehensive list of C++ features:
https://github.com/AnthonyCalandra/modern-cpp-features#c17-language-features

Reviewed By: JoshuaGross

Differential Revision: D27431145

fbshipit-source-id: e8da6fe9d70e9b7343a8caec21cdbeb043478575
2021-04-01 04:50:59 -07:00
Samuel Susla 79090c4802 Fabric: Decoupling Telemetry aggregation classes into a separate module
Summary:
We need to do this to break a dependency cycle that would happen if we try to have `view` depend on `mounting` just to add some telemetry to `view`.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D26827446

fbshipit-source-id: 4c415ebf5be3a02c18c80ea8a4a77068cae0f0fe
2021-03-29 05:12:42 -07:00