UnitTest using the /tmp file system

Sunitha Harish sunithaharish04 at gmail.com
Sun Mar 21 15:00:30 AEDT 2021


Hi,

This is regarding the unit tests in various repos under openbmc like: 
phosphor-bmc-code-management, phosphor-logging, phosphor-networkd, pldm 
etc . I have seen the testcases using the /tmp filesystem to create the 
directories/files when the UT is run.

I followed the similar way of writing the UT in one of my commits 
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/37352 .  As per 
the review comments in this commit, using the /tmp file system for UT is 
anti-pattern, and this needs to be changed by mocking the same. I agree 
that this is a valid thing to do.

Now this email is to discuss why this was originally done? Can the 
community come-up with a generalized solution for this ?

Thanks & regards,
Sunitha






More information about the openbmc mailing list