facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.
https://buck.build
Apache License 2.0
8.56k stars 1.16k forks source link

[Question] Isolation level between test targets within the same project. #2729

Closed Abdulmajeed-Alzoubi closed 1 year ago

Abdulmajeed-Alzoubi commented 1 year ago

Hi, in case we run buck test ... for a specific project which has, let's say, 10 test targets. Then buck will run/execute all the 10 targets in parallel (assuming we have enough threads), where each target is assigned to a single thread.

The question is about the isolation level between the processes that execute each test target.

  1. Can different targets share a common memory -> so the code MUST be thread safe in this case?
  2. Or is it guaranteed that different targets have different view of the memory, so the bytes needed for one target will be just used for that target, but none of the others even in the case where we have common dependencies (common util class, common objects, etc.)?

The purpose of this question is to know if splitting one test target to multiple targets could cause any race condition, if the test code itself was not written in a thread-safe manner.

Abdulmajeed-Alzoubi commented 1 year ago

The answer is different targets are executed in different JVM, so no static common states (shared objects), but external states is shared like filesystem and network.