From: Sunitha Harish <sunithaharish04@gmail.com>
To: Lei Yu <yulei.sh@bytedance.com>, Joseph Reynolds <jrey@linux.ibm.com>
Cc: openbmc <openbmc@lists.ozlabs.org>,
deepak.kodihalli.83@gmail.com, Ed Tanous <edtanous@google.com>,
Brad Bishop <bradleyb@fuzziesquirrel.com>,
gmills@us.ibm.com, geissonator@yahoo.com,
Ratan Gupta <ratagupt@linux.vnet.ibm.com>
Subject: Re: UnitTest using the /tmp file system
Date: Wed, 24 Mar 2021 10:37:17 +0530 [thread overview]
Message-ID: <8877bb56-2ba8-5040-e47b-cb54c1cafce2@gmail.com> (raw)
In-Reply-To: <CAGm54UEm9JXX555jkR7UQGa8P5kzA+cgsb1fRvUvc1OzANxuBQ@mail.gmail.com>
On 24-03-2021 08:42, Lei Yu wrote:
> On Tue, Mar 23, 2021 at 11:08 PM Joseph Reynolds <jrey@linux.ibm.com> wrote:
>> 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?
>>
> I agree it is better to mock as many interfaces as possible to avoid
> accessing host's file system.
>
> But in certain cases, I do want to test the functions that involves filesystem.
> In such case, I usually use mkdtemp() to create a temp dir in test
> case's ctor or setup(), and remove it on test case's dtor or
> tearDown().
Yes. The test platform's /tmp directory is used to create the files. The
implementations in various repos are as Lei mentioned. The files are
removed when the test is complete.
next prev parent reply other threads:[~2021-03-24 5:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-21 4:00 UnitTest using the /tmp file system Sunitha Harish
2021-03-23 5:44 ` Sunitha Harish
2021-03-23 15:03 ` Joseph Reynolds
2021-03-24 3:12 ` Lei Yu
2021-03-24 5:07 ` Sunitha Harish [this message]
2021-03-27 14:03 ` Patrick Williams
2021-03-29 4:29 ` Sunitha Harish
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8877bb56-2ba8-5040-e47b-cb54c1cafce2@gmail.com \
--to=sunithaharish04@gmail.com \
--cc=bradleyb@fuzziesquirrel.com \
--cc=deepak.kodihalli.83@gmail.com \
--cc=edtanous@google.com \
--cc=geissonator@yahoo.com \
--cc=gmills@us.ibm.com \
--cc=jrey@linux.ibm.com \
--cc=openbmc@lists.ozlabs.org \
--cc=ratagupt@linux.vnet.ibm.com \
--cc=yulei.sh@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).