This patch makes SubprocessMemoryTest use process PIDs during creation of the SubprocessMemory objects within the tests so that there isn't interference between multiple instances of the test running at the same time which could potentially occur in multi-user environments.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp | ||
---|---|---|
42 | Multiplying a pid with a number seems a bit weird to me. It is not really guaranteed to result in a number unique to the process (pid=1 and TestNumber=2 gives the same value as pid=2 and TestNumber=1). And I don't know if this multiplication potentially could overflow as well. |
llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp | ||
---|---|---|
42 | Any news about this? Do you agree that the multiplication is weird? |
llvm/unittests/tools/llvm-exegesis/X86/SubprocessMemoryTest.cpp | ||
---|---|---|
42 | Sorry for the delay. Planning on working on this over the weekend. I do agree that multiplication is weird the way I have it implemented here. However, I do think it's the most elegant solution available without changing the library code just to expose more testing hooks. I think doing 2D array indexing should work. We can do getpid() * NumberOfTests + TestNumber which should make everything unique and also won't overflow on 32 bit arithmetic as PIDs are limited to 2^22. |
Multiplying a pid with a number seems a bit weird to me. It is not really guaranteed to result in a number unique to the process (pid=1 and TestNumber=2 gives the same value as pid=2 and TestNumber=1). And I don't know if this multiplication potentially could overflow as well.