diff options
Diffstat (limited to 'bitbake/lib/bb/tests/fetch.py')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 2ef2063436..2365a50960 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -3390,3 +3390,68 @@ class FetchPremirroronlyBrokenTarball(FetcherTest): | |||
3390 | fetcher.download() | 3390 | fetcher.download() |
3391 | output = "".join(logs.output) | 3391 | output = "".join(logs.output) |
3392 | self.assertFalse(" not a git repository (or any parent up to mount point /)" in output) | 3392 | self.assertFalse(" not a git repository (or any parent up to mount point /)" in output) |
3393 | |||
3394 | class GoModTest(FetcherTest): | ||
3395 | |||
3396 | @skipIfNoNetwork() | ||
3397 | def test_gomod_url(self): | ||
3398 | urls = ['gomod://github.com/Azure/azure-sdk-for-go/sdk/storage/azblob;version=v1.0.0;' | ||
3399 | 'sha256sum=9bb69aea32f1d59711701f9562d66432c9c0374205e5009d1d1a62f03fb4fdad'] | ||
3400 | |||
3401 | fetcher = bb.fetch2.Fetch(urls, self.d) | ||
3402 | ud = fetcher.ud[urls[0]] | ||
3403 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.zip') | ||
3404 | self.assertNotIn('name', ud.parm) | ||
3405 | |||
3406 | fetcher.download() | ||
3407 | fetcher.unpack(self.unpackdir) | ||
3408 | downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') | ||
3409 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip'))) | ||
3410 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod'))) | ||
3411 | |||
3412 | @skipIfNoNetwork() | ||
3413 | def test_gomod_url_go_mod_only(self): | ||
3414 | urls = ['gomod://github.com/Azure/azure-sdk-for-go/sdk/storage/azblob;version=v1.0.0;mod=1;' | ||
3415 | 'sha256sum=7873b8544842329b4f385a3aa6cf82cc2bc8defb41a04fa5291c35fd5900e873'] | ||
3416 | |||
3417 | fetcher = bb.fetch2.Fetch(urls, self.d) | ||
3418 | ud = fetcher.ud[urls[0]] | ||
3419 | self.assertEqual(ud.url, 'https://proxy.golang.org/github.com/%21azure/azure-sdk-for-go/sdk/storage/azblob/%40v/v1.0.0.mod') | ||
3420 | self.assertNotIn('name', ud.parm) | ||
3421 | |||
3422 | fetcher.download() | ||
3423 | fetcher.unpack(self.unpackdir) | ||
3424 | downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') | ||
3425 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod'))) | ||
3426 | |||
3427 | @skipIfNoNetwork() | ||
3428 | def test_gomod_url_sha256sum_varflag(self): | ||
3429 | urls = ['gomod://gopkg.in/ini.v1;version=v1.67.0'] | ||
3430 | self.d.setVarFlag('SRC_URI', 'gopkg.in/ini.v1@v1.67.0.sha256sum', 'bd845dfc762a87a56e5a32a07770dc83e86976db7705d7f89c5dbafdc60b06c6') | ||
3431 | |||
3432 | fetcher = bb.fetch2.Fetch(urls, self.d) | ||
3433 | ud = fetcher.ud[urls[0]] | ||
3434 | self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') | ||
3435 | self.assertEqual(ud.parm['name'], 'gopkg.in/ini.v1@v1.67.0') | ||
3436 | |||
3437 | fetcher.download() | ||
3438 | fetcher.unpack(self.unpackdir) | ||
3439 | downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') | ||
3440 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip'))) | ||
3441 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod'))) | ||
3442 | |||
3443 | @skipIfNoNetwork() | ||
3444 | def test_gomod_url_no_go_mod_in_module(self): | ||
3445 | urls = ['gomod://gopkg.in/ini.v1;version=v1.67.0;' | ||
3446 | 'sha256sum=bd845dfc762a87a56e5a32a07770dc83e86976db7705d7f89c5dbafdc60b06c6'] | ||
3447 | |||
3448 | fetcher = bb.fetch2.Fetch(urls, self.d) | ||
3449 | ud = fetcher.ud[urls[0]] | ||
3450 | self.assertEqual(ud.url, 'https://proxy.golang.org/gopkg.in/ini.v1/%40v/v1.67.0.zip') | ||
3451 | self.assertNotIn('name', ud.parm) | ||
3452 | |||
3453 | fetcher.download() | ||
3454 | fetcher.unpack(self.unpackdir) | ||
3455 | downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') | ||
3456 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip'))) | ||
3457 | self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod'))) | ||