UnitTest using the /tmp file system
Joseph Reynolds
jrey at linux.ibm.com
Wed Mar 24 02:03:37 AEDT 2021
On 3/23/21 12:44 AM, Sunitha Harish wrote:
> Any views please ?
>
> On 21-03-2021 09:30, Sunitha Harish wrote:
>> 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.
Are the files written to the BMC's file system or to the test platform's
file system? I don't understand why this is important either way.
Can't we just erase the file when the unit test is complete?
Joseph
>>
>> 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