Skip to content

Multi-crate tests cannot share auxiliary modules #2162

Closed

Description

@lht

The multi-crate testing is very easy to use, while it's also tempting to reuse the auxiliary modules. It seems this could lead race issue. One aux crate could be truncated by another parallel test runner compiling the same aux module.

We need document the restriction, or detect and fail with a good message, or even better, supports module reuse.

Activity

  1. nikomatsakis commented on Apr 8, 2012

    @nikomatsakis
    Contributor

    I thought there was already an open bug on this but I couldn't find it. I too have encountered this problem and I have two ideas for how to fix this:

    • The easiest is probably to create a separate output directory for each test that uses aux-build. This seems good because it isolates the tests from one another. It would also allow multiple tests to perform the same aux-build without any problem.
    • Alternatively, we could have a process tasked with performing aux-builds: each test task would send a message requesting that the aux-build be performed and then await the response. The central task would then check whether the aux-build is not started / has already been done / is in progress / . In the first case, it can spawn a task to perform the aux-build. In the second case, it can respond immediately. In the third case, it can add the test task to a "notify list" and wait until the ongoing compilation finishes.

    The latter is more optimal for text execution time but seems rather more complex and fails to isolate the tests, so I am leaning towards the former.

  2. lht commented on Apr 9, 2012

    @lht
    ContributorAuthor

    I also like for the first solution. The auxiliary crates are small, should not cost too much execution time.

  3. ghost assigned on Apr 10, 2012
  4. ghost assigned on Apr 10, 2012
  5. lht commented on Apr 10, 2012

    @lht
    ContributorAuthor

    Assign to myself. I have some local tests for re-exports best to be included after this is implemented.

  6. removed their assignment
    on Jun 16, 2014
  7. added a commit that references this issue on Sep 22, 2022
  8. added a commit that references this issue on Jun 27, 2026
  9. added a commit that references this issue on Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-testsuiteArea: The testsuite used to check the correctness of rustcC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions