From: Tom Rini Date: Thu, 31 Oct 2019 12:07:21 -0400 Subject: [U-Boot] [PATCH] test/py: Set cache_dir to /tmp/.pytest_cache In-Reply-To: <5016a039-577a-fa27-b6c3-8b3d85e502b9@wwwdotorg.org> References: <20191031145122.13558-1-trini@konsulko.com> <5016a039-577a-fa27-b6c3-8b3d85e502b9@wwwdotorg.org> Message-ID: <20191031160721.GN11173@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Oct 31, 2019 at 10:04:18AM -0600, Stephen Warren wrote: > On 10/31/19 8:51 AM, Tom Rini wrote: > > For some time now, pytest has supported setting where a cache directory > > that it will use is located (and in turn has logic to re-use this cache > > and speed things up when possible). When running the pytest tests on > > Azure Pipelines, our source directory is read-only and we now see a > > warning about being unable to create the .pytest_cache directory as the > > default is in the same place as pytest.ini. Set cache_dir to > > /tmp/.pytest_cache so that it will always be placed in a read/write > > location. > > > > Cc: Stephen Warren > > Cc: Simon Glass > > Cc: Bin Meng > > Signed-off-by: Tom Rini > > --- > > Looking at > > https://docs.pytest.org/en/latest/customize.html#confval-cache_dir we > > could use an environment variable but TMP/TMPDIR/etc aren't always going > > to be set and that in turn leads to test/py/$TMPDIR/.pytest_cache being > > used. I think hard-coding to /tmp here ends up being less problematic > > but I am open to suggestions. We could even just ignore the warning, I > > only spotted it when seeing why a test had otherwise failed. > > --- > > test/py/pytest.ini | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/test/py/pytest.ini b/test/py/pytest.ini > > index e93d010f1fa2..56c1f0521a54 100644 > > --- a/test/py/pytest.ini > > +++ b/test/py/pytest.ini > > @@ -11,3 +11,4 @@ markers = > > notbuildconfigspec: U-Boot: Describes required disabled Kconfig options. > > requiredtool: U-Boot: Required host tools for a test. > > slow: U-Boot: Specific test will run slowly. > > +cache_dir = /tmp/.pytest_cache > > Won't this hard-coding break running parallel invocations; they'll all try > to use the same cache directory and conflict with each-other? > > Various test/py tests create data files (e.g. disk images, files for DFU to > download/upload, etc.). That directory must be writable. Can we tell pytest > to use (a sub-directory of that) directory as the cache? I don't think it will break anything today at least. We don't use pytest's cache_dir directly for creating our disk images, we put those elsewhere. This is strictly used by pytest itself, afaict. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: