diff mbox series

[2/3] tests: Make test_lfs_enabled actually test git-lfs

Message ID 20230210133921.1268885-2-paulo@myneves.com
State New
Headers show
Series [1/3] tests: Remove redundant lfs=1 URI paramter | expand

Commit Message

Paulo Neves Feb. 10, 2023, 1:39 p.m. UTC
Due to the datastore not having the PATH variable set, _find_git_lfs
would never return true and thus fetcher's git lfs test logic was
unreachable.

Now we set PATH on the datastore of the test and if the test host has
git-lfs the test will actually test git-lfs logic.

Signed-off-by: Paulo Neves <paulo@myneves.com>
---
 lib/bb/tests/fetch.py | 1 +
 1 file changed, 1 insertion(+)

--
2.34.1

Comments

Alexandre Belloni Feb. 13, 2023, 11:37 p.m. UTC | #1
Hello,

This fails on the AB with:

FAIL: test_lfs_enabled (bb.tests.fetch.GitLfsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/bitbake/lib/bb/tests/fetch.py", line 2246, in test_lfs_enabled
    self.assertTrue(ud.method._find_git_lfs(self.d),
AssertionError: False is not true : git-lfs not found. Cannot test git-lfs without git-lfs in the PATH


On 10/02/2023 13:39:32+0000, Paulo Neves wrote:
> Due to the datastore not having the PATH variable set, _find_git_lfs
> would never return true and thus fetcher's git lfs test logic was
> unreachable.
> 
> Now we set PATH on the datastore of the test and if the test host has
> git-lfs the test will actually test git-lfs logic.
> 
> Signed-off-by: Paulo Neves <paulo@myneves.com>
> ---
>  lib/bb/tests/fetch.py | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
> index 122d7e05f..a9ad247d9 100644
> --- a/lib/bb/tests/fetch.py
> +++ b/lib/bb/tests/fetch.py
> @@ -2237,6 +2237,7 @@ class GitLfsTest(FetcherTest):
> 
>          uri = 'git://%s;protocol=file;branch=master' % self.srcdir
>          self.d.setVar('SRC_URI', uri)
> +        self.d.setVar('PATH', os.environ.get('PATH'))
> 
>          # Careful: suppress initial attempt at downloading until
>          # we know whether git-lfs is installed.
> --
> 2.34.1
> 
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#14392): https://lists.openembedded.org/g/bitbake-devel/message/14392
> Mute This Topic: https://lists.openembedded.org/mt/96875983/3617179
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Paulo Neves Feb. 14, 2023, 11:26 a.m. UTC | #2
This means that the test cannot run in the autobuilder and should
probably be removed or re-done.

My whole patchset needs to be re-done as well. The reason is that the
current git-lfs support in bitbake has very confusing behavior and very
host configuration dependent. This patch highlights that, as before it
we were supposedly testing git-lfs without git-lfs on the host. I am of
the opinion we should not do that.

There is no documentation anywhere on the behavior of the lfs parameter.
My current understanding is the following:

What the lfs=0/1 parameter does is to force the filter to run on the
DL_DIR's bare repository by doing a checkout to a temporary directory.
If lfs is unset, bitbake will still checkout lfs contents but will do it
during the unpack method which usually happens in the WORKDIR. git does
this transparently on git checkout. This is not ideal as it means that
there can be network access during the do_unpack task. This situation is
only (possibly) avoided if the user sets lfs=1. Otherwise, the user will
have network access on the do_unpack task.

Expect a V2

Paulo Neves

On 2/14/23 00:37, Alexandre Belloni wrote:
> Hello,
>
> This fails on the AB with:
>
> FAIL: test_lfs_enabled (bb.tests.fetch.GitLfsTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File "/home/pokybuild/yocto-worker/oe-selftest-armhost/build/bitbake/lib/bb/tests/fetch.py", line 2246, in test_lfs_enabled
>      self.assertTrue(ud.method._find_git_lfs(self.d),
> AssertionError: False is not true : git-lfs not found. Cannot test git-lfs without git-lfs in the PATH
>
>
> On 10/02/2023 13:39:32+0000, Paulo Neves wrote:
>> Due to the datastore not having the PATH variable set, _find_git_lfs
>> would never return true and thus fetcher's git lfs test logic was
>> unreachable.
>>
>> Now we set PATH on the datastore of the test and if the test host has
>> git-lfs the test will actually test git-lfs logic.
>>
>> Signed-off-by: Paulo Neves <paulo@myneves.com>
>> ---
>>   lib/bb/tests/fetch.py | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
>> index 122d7e05f..a9ad247d9 100644
>> --- a/lib/bb/tests/fetch.py
>> +++ b/lib/bb/tests/fetch.py
>> @@ -2237,6 +2237,7 @@ class GitLfsTest(FetcherTest):
>>
>>           uri = 'git://%s;protocol=file;branch=master' % self.srcdir
>>           self.d.setVar('SRC_URI', uri)
>> +        self.d.setVar('PATH', os.environ.get('PATH'))
>>
>>           # Careful: suppress initial attempt at downloading until
>>           # we know whether git-lfs is installed.
>> --
>> 2.34.1
>>
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#14392): https://lists.openembedded.org/g/bitbake-devel/message/14392
>> Mute This Topic: https://lists.openembedded.org/mt/96875983/3617179
>> Group Owner: bitbake-devel+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alexandre.belloni@bootlin.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>
> --
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
diff mbox series

Patch

diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index 122d7e05f..a9ad247d9 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -2237,6 +2237,7 @@  class GitLfsTest(FetcherTest):

         uri = 'git://%s;protocol=file;branch=master' % self.srcdir
         self.d.setVar('SRC_URI', uri)
+        self.d.setVar('PATH', os.environ.get('PATH'))

         # Careful: suppress initial attempt at downloading until
         # we know whether git-lfs is installed.