summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/tests
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r--bitbake/lib/bb/tests/fetch.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 832e0dd6a4..4e26e38811 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -3408,6 +3408,8 @@ class GoModTest(FetcherTest):
3408 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 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'))) 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'))) 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 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod')),
3412 '7873b8544842329b4f385a3aa6cf82cc2bc8defb41a04fa5291c35fd5900e873')
3411 3413
3412 @skipIfNoNetwork() 3414 @skipIfNoNetwork()
3413 def test_gomod_url_go_mod_only(self): 3415 def test_gomod_url_go_mod_only(self):
@@ -3439,6 +3441,8 @@ class GoModTest(FetcherTest):
3439 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3441 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'))) 3442 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'))) 3443 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')))
3444 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')),
3445 '13aedd85db8e555104108e0e613bb7e4d1242af7f27c15423dd9ab63b60b72a1')
3442 3446
3443 @skipIfNoNetwork() 3447 @skipIfNoNetwork()
3444 def test_gomod_url_no_go_mod_in_module(self): 3448 def test_gomod_url_no_go_mod_in_module(self):
@@ -3455,6 +3459,26 @@ class GoModTest(FetcherTest):
3455 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3459 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'))) 3460 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'))) 3461 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')))
3462 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')),
3463 '13aedd85db8e555104108e0e613bb7e4d1242af7f27c15423dd9ab63b60b72a1')
3464
3465 @skipIfNoNetwork()
3466 def test_gomod_url_host_only(self):
3467 urls = ['gomod://go.opencensus.io;version=v0.24.0;'
3468 'sha256sum=203a767d7f8e7c1ebe5588220ad168d1e15b14ae70a636de7ca9a4a88a7e0d0c']
3469
3470 fetcher = bb.fetch2.Fetch(urls, self.d)
3471 ud = fetcher.ud[urls[0]]
3472 self.assertEqual(ud.url, 'https://proxy.golang.org/go.opencensus.io/%40v/v0.24.0.zip')
3473 self.assertNotIn('name', ud.parm)
3474
3475 fetcher.download()
3476 fetcher.unpack(self.unpackdir)
3477 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3478 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.zip')))
3479 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.mod')))
3480 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.mod')),
3481 '0dc9ccc660ad21cebaffd548f2cc6efa27891c68b4fbc1f8a3893b00f1acec96')
3458 3482
3459class GoModGitTest(FetcherTest): 3483class GoModGitTest(FetcherTest):
3460 3484
@@ -3480,6 +3504,8 @@ class GoModGitTest(FetcherTest):
3480 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3504 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3481 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'golang.org/x/net/@v/v0.9.0.zip'))) 3505 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'golang.org/x/net/@v/v0.9.0.zip')))
3482 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'golang.org/x/net/@v/v0.9.0.mod'))) 3506 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'golang.org/x/net/@v/v0.9.0.mod')))
3507 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'golang.org/x/net/@v/v0.9.0.mod')),
3508 'c5d6851ede50ec1c001afb763040194b68961bf06997e2605e8bf06dcd2aeb2e')
3483 3509
3484 @skipIfNoNetwork() 3510 @skipIfNoNetwork()
3485 def test_gomodgit_url_subdir(self): 3511 def test_gomodgit_url_subdir(self):
@@ -3504,6 +3530,8 @@ class GoModGitTest(FetcherTest):
3504 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3530 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3505 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip'))) 3531 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.zip')))
3506 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod'))) 3532 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod')))
3533 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'github.com/!azure/azure-sdk-for-go/sdk/storage/azblob/@v/v1.0.0.mod')),
3534 '7873b8544842329b4f385a3aa6cf82cc2bc8defb41a04fa5291c35fd5900e873')
3507 3535
3508 @skipIfNoNetwork() 3536 @skipIfNoNetwork()
3509 def test_gomodgit_url_srcrev_var(self): 3537 def test_gomodgit_url_srcrev_var(self):
@@ -3524,6 +3552,8 @@ class GoModGitTest(FetcherTest):
3524 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3552 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3525 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip'))) 3553 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip')))
3526 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod'))) 3554 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')))
3555 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')),
3556 '13aedd85db8e555104108e0e613bb7e4d1242af7f27c15423dd9ab63b60b72a1')
3527 3557
3528 @skipIfNoNetwork() 3558 @skipIfNoNetwork()
3529 def test_gomodgit_url_no_go_mod_in_module(self): 3559 def test_gomodgit_url_no_go_mod_in_module(self):
@@ -3544,3 +3574,28 @@ class GoModGitTest(FetcherTest):
3544 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download') 3574 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3545 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip'))) 3575 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.zip')))
3546 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod'))) 3576 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')))
3577 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'gopkg.in/ini.v1/@v/v1.67.0.mod')),
3578 '13aedd85db8e555104108e0e613bb7e4d1242af7f27c15423dd9ab63b60b72a1')
3579
3580 @skipIfNoNetwork()
3581 def test_gomodgit_url_host_only(self):
3582 urls = ['gomodgit://go.opencensus.io;version=v0.24.0;'
3583 'repo=github.com/census-instrumentation/opencensus-go;'
3584 'srcrev=b1a01ee95db0e690d91d7193d037447816fae4c5']
3585
3586 fetcher = bb.fetch2.Fetch(urls, self.d)
3587 ud = fetcher.ud[urls[0]]
3588 self.assertEqual(ud.host, 'github.com')
3589 self.assertEqual(ud.path, '/census-instrumentation/opencensus-go')
3590 self.assertEqual(ud.names, ['go.opencensus.io@v0.24.0'])
3591 self.assertEqual(self.d.getVar('SRCREV_go.opencensus.io@v0.24.0'), 'b1a01ee95db0e690d91d7193d037447816fae4c5')
3592
3593 fetcher.download()
3594 fetcher.unpack(self.unpackdir)
3595 vcsdir = os.path.join(self.unpackdir, 'pkg/mod/cache/vcs')
3596 self.assertTrue(os.path.exists(os.path.join(vcsdir, 'aae3ac7b2122ed3345654e6327855e9682f4a5350d63e93dbcfc51c4419df0e1')))
3597 downloaddir = os.path.join(self.unpackdir, 'pkg/mod/cache/download')
3598 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.zip')))
3599 self.assertTrue(os.path.exists(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.mod')))
3600 self.assertEqual(bb.utils.sha256_file(os.path.join(downloaddir, 'go.opencensus.io/@v/v0.24.0.mod')),
3601 '0dc9ccc660ad21cebaffd548f2cc6efa27891c68b4fbc1f8a3893b00f1acec96')