Repository navigation
Description
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:
- It's not cross-platform, so we've since grown run_test.bat and run_test.ps1
- 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.
- Apparently it messes up debuggers, which is apparently a thing that some people care about.
- 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".
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
antiagainst commentedon Mar 18, 2021
Related to this, I think the
TEST_TMPDIRisn't well respected too. When I sshed into phones in our lab, I see a huge amount of files withdylib_executableNNNNNNdirectly under/data/local/tmp. They should be generated intoTEST_TMPDIRso it can be deleted after running the tests?GMNGeoffrey commentedon Mar 18, 2021
Yup looks like the temp file path stuff is basically bypassed on android :-(
https://github.com/google/iree/blob/main/iree/base/internal/file_io_posix.cc#L115-L136
GMNGeoffrey commentedon Mar 18, 2021
Ah wait, no it should still respect it if set... Something isn't setting it.
GMNGeoffrey commentedon Mar 18, 2021
Looks like it's missing here: https://github.com/google/iree/blob/e3cdd5ce91c6894ac34f27cdecb947c3922275d0/build_tools/cmake/iree_check_test.cmake#L140
antiagainst commentedon Mar 19, 2021
Yeah. We have it in
iree_cc_test.cmake:https://github.com/google/iree/blob/2b235dc85f27e99103cd35911264ce38ac2d5767/build_tools/cmake/iree_cc_test.cmake#L143
Use CMake to create temporary test directories eliminating run_test.* (…
Use CMake to create temporary test directories eliminating run_test.* (…