Skip to content

Rework provisioning of temporary directories for testing #5147

Closed

Description

@GMNGeoffrey

Our tests were written with Bazel expectations about there existing a TEST_TMPDIR env variable that points to a temporary directory for the test. In CMake there is no such thing, so I added https://github.com/google/iree/blob/main/build_tools/cmake/run_test.sh to wrap tests in something that creates and deletes such a directory. This causes a few issues:

  1. It's not cross-platform, so we've since grown run_test.bat and run_test.ps1
  2. The current naming convention we use for TEST_TMPDIR involves the path to the test, which apparently runs afoul of the weird thing we do here to add_subdirectory in a different binary directory https://github.com/google/iree/blob/9f0148fa15692bd16d9193fa3fc94f114114cad9/integrations/tensorflow/bindings/python/CMakeLists.txt. (It tries to create a directory at a path that doesn't exist). We could change that naming convention to just be effectively a UUID.
  3. Apparently it messes up debuggers, which is apparently a thing that some people care about.
  4. Some people have aesthetic objections to wrapping everything in a shells script. It adds another layer of indirection.

I think the solution to all this might be to require that each test that does IO be responsible for setting up its own scratch space, although to work with Bazel it needs to respect TEST_TMPDIR if that is set, work across OS's, etc. I think https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp would work in Python. We'd need something else for C++, obviously. This makes ctest less hermetic, but it's not Bazel, so wasn't particularly hermetic anyway.

Related to #818 in theme of "deleting weird shell wrappers we use".

Activity

  1. added
    infrastructure
    quality of life 😊
    on Mar 18, 2021
  2. self-assigned this
    on Mar 18, 2021
  3. antiagainst commented on Mar 18, 2021

    @antiagainst
    Member

    Related to this, I think the TEST_TMPDIR isn't well respected too. When I sshed into phones in our lab, I see a huge amount of files with dylib_executableNNNNNN directly under /data/local/tmp. They should be generated into TEST_TMPDIR so it can be deleted after running the tests?

  4. GMNGeoffrey commented on Mar 18, 2021

    @GMNGeoffrey
    MemberAuthor
  5. GMNGeoffrey commented on Mar 18, 2021

    @GMNGeoffrey
    MemberAuthor

    Ah wait, no it should still respect it if set... Something isn't setting it.

  6. Repository owner moved this from In Progress to Done in IREE - ARCHIVED (do not update)on Jun 9, 2022
  7. moved this to Done in IREEon Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infrastructurequality of life 😊

Type

No type

Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions