summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/cases/recipetool.py
diff options
context:
space:
mode:
authorLukas Funke <lukas.funke@weidmueller.com>2023-11-02 16:53:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-11-06 16:41:11 +0000
commitb2c07c250171f8c60c74cf7e682abc34556160a9 (patch)
treef1b7ca7ad4d77abecccf3ff6cc812f71a9d9e5a0 /meta/lib/oeqa/selftest/cases/recipetool.py
parent22f8fdbe7f0fd478185c1c81f85ab06908cdaebc (diff)
downloadpoky-b2c07c250171f8c60c74cf7e682abc34556160a9.tar.gz
selftest: recipetool: Add test for go recipe handler
This commit adds a test for the go recipetool handler. The choosen go project to test the created recipe was picked randomly. The SRC_URIs and the LIC_FILES_CHKSUMs are checked against there reference values. (From OE-Core rev: 3337b9ec069a21b87676a90d0f7819e6a8dc856a) Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases/recipetool.py')
-rw-r--r--meta/lib/oeqa/selftest/cases/recipetool.py185
1 files changed, 185 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py
index b64f724b8f..55cbba9ca7 100644
--- a/meta/lib/oeqa/selftest/cases/recipetool.py
+++ b/meta/lib/oeqa/selftest/cases/recipetool.py
@@ -669,6 +669,191 @@ class RecipetoolTests(RecipetoolBase):
669 libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'recipetool') 669 libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'recipetool')
670 sys.path.insert(0, libpath) 670 sys.path.insert(0, libpath)
671 671
672 def test_recipetool_create_go(self):
673 # Basic test to check go recipe generation
674 def urifiy(url, version, modulepath = None, pathmajor = None, subdir = None):
675 modulepath = ",path='%s'" % modulepath if len(modulepath) else ''
676 pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else ''
677 subdir = ",subdir='%s'" % subdir if len(subdir) else ''
678 return "${@go_src_uri('%s','%s'%s%s%s)}" % (url, version, modulepath, pathmajor, subdir)
679
680 temprecipe = os.path.join(self.tempdir, 'recipe')
681 os.makedirs(temprecipe)
682
683 recipefile = os.path.join(temprecipe, 'edgex-go_git.bb')
684 deps_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-modules.inc')
685 lics_require_file = os.path.join(temprecipe, 'edgex-go', 'edgex-go-licenses.inc')
686 modules_txt_file = os.path.join(temprecipe, 'edgex-go', 'modules.txt')
687
688 srcuri = 'https://github.com/edgexfoundry/edgex-go.git'
689 srcrev = "v3.0.0"
690 srcbranch = "main"
691
692 result = runCmd('recipetool create -o %s %s -S %s -B %s' % (temprecipe, srcuri, srcrev, srcbranch))
693
694 self.maxDiff = None
695 inherits = ['go-vendor']
696
697 checkvars = {}
698 checkvars['GO_IMPORT'] = "github.com/edgexfoundry/edgex-go"
699 checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https',
700 'file://modules.txt'}
701 checkvars['LIC_FILES_CHKSUM'] = {'file://src/${GO_IMPORT}/LICENSE;md5=8f8bc924cf73f6a32381e5fd4c58d603'}
702
703 self.assertTrue(os.path.isfile(recipefile))
704 self._test_recipe_contents(recipefile, checkvars, inherits)
705
706 checkvars = {}
707 checkvars['VENDORED_LIC_FILES_CHKSUM'] = set(
708 ['file://src/${GO_IMPORT}/vendor/github.com/Microsoft/go-winio/LICENSE;md5=69205ff73858f2c22b2ca135b557e8ef',
709 'file://src/${GO_IMPORT}/vendor/github.com/armon/go-metrics/LICENSE;md5=d2d77030c0183e3d1e66d26dc1f243be',
710 'file://src/${GO_IMPORT}/vendor/github.com/cenkalti/backoff/LICENSE;md5=1571d94433e3f3aa05267efd4dbea68b',
711 'file://src/${GO_IMPORT}/vendor/github.com/davecgh/go-spew/LICENSE;md5=c06795ed54b2a35ebeeb543cd3a73e56',
712 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/LICENSE;md5=dcdb33474b60c38efd27356d8f2edec7',
713 'file://src/${GO_IMPORT}/vendor/github.com/eclipse/paho.mqtt.golang/edl-v10;md5=3adfcc70f5aeb7a44f3f9b495aa1fbf3',
714 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-bootstrap/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
715 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-configuration/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
716 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-core-contracts/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
717 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-messaging/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
718 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-registry/v3/LICENSE;md5=0d6dae39976133b2851fba4c1e1275ff',
719 'file://src/${GO_IMPORT}/vendor/github.com/edgexfoundry/go-mod-secrets/v3/LICENSE;md5=f9fa2f4f8e0ef8cc7b5dd150963eb457',
720 'file://src/${GO_IMPORT}/vendor/github.com/fatih/color/LICENSE.md;md5=316e6d590bdcde7993fb175662c0dd5a',
721 'file://src/${GO_IMPORT}/vendor/github.com/fxamacker/cbor/v2/LICENSE;md5=827f5a2fa861382d35a3943adf9ebb86',
722 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
723 'file://src/${GO_IMPORT}/vendor/github.com/go-jose/go-jose/v3/json/LICENSE;md5=591778525c869cdde0ab5a1bf283cd81',
724 'file://src/${GO_IMPORT}/vendor/github.com/go-kit/log/LICENSE;md5=5b7c15ad5fffe2ff6e9d58a6c161f082',
725 'file://src/${GO_IMPORT}/vendor/github.com/go-logfmt/logfmt/LICENSE;md5=98e39517c38127f969de33057067091e',
726 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/locales/LICENSE;md5=3ccbda375ee345400ad1da85ba522301',
727 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/universal-translator/LICENSE;md5=2e2b21ef8f61057977d27c727c84bef1',
728 'file://src/${GO_IMPORT}/vendor/github.com/go-playground/validator/v10/LICENSE;md5=a718a0f318d76f7c5d510cbae84f0b60',
729 'file://src/${GO_IMPORT}/vendor/github.com/go-redis/redis/v7/LICENSE;md5=58103aa5ea1ee9b7a369c9c4a95ef9b5',
730 'file://src/${GO_IMPORT}/vendor/github.com/golang/protobuf/LICENSE;md5=939cce1ec101726fa754e698ac871622',
731 'file://src/${GO_IMPORT}/vendor/github.com/gomodule/redigo/LICENSE;md5=2ee41112a44fe7014dce33e26468ba93',
732 'file://src/${GO_IMPORT}/vendor/github.com/google/uuid/LICENSE;md5=88073b6dd8ec00fe09da59e0b6dfded1',
733 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/mux/LICENSE;md5=33fa1116c45f9e8de714033f99edde13',
734 'file://src/${GO_IMPORT}/vendor/github.com/gorilla/websocket/LICENSE;md5=c007b54a1743d596f46b2748d9f8c044',
735 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/consul/api/LICENSE;md5=b8a277a612171b7526e9be072f405ef4',
736 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/errwrap/LICENSE;md5=b278a92d2c1509760384428817710378',
737 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-cleanhttp/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
738 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-hclog/LICENSE;md5=ec7f605b74b9ad03347d0a93a5cc7eb8',
739 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-immutable-radix/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
740 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-multierror/LICENSE;md5=d44fdeb607e2d2614db9464dbedd4094',
741 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/go-rootcerts/LICENSE;md5=65d26fcc2f35ea6a181ac777e42db1ea',
742 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/golang-lru/LICENSE;md5=f27a50d2e878867827842f2c60e30bfc',
743 'file://src/${GO_IMPORT}/vendor/github.com/hashicorp/serf/LICENSE;md5=b278a92d2c1509760384428817710378',
744 'file://src/${GO_IMPORT}/vendor/github.com/leodido/go-urn/LICENSE;md5=8f50db5538ec1148a9b3d14ed96c3418',
745 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-colorable/LICENSE;md5=24ce168f90aec2456a73de1839037245',
746 'file://src/${GO_IMPORT}/vendor/github.com/mattn/go-isatty/LICENSE;md5=f509beadd5a11227c27b5d2ad6c9f2c6',
747 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/consulstructure/LICENSE;md5=96ada10a9e51c98c4656f2cede08c673',
748 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/copystructure/LICENSE;md5=56da355a12d4821cda57b8f23ec34bc4',
749 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/go-homedir/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
750 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/mapstructure/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
751 'file://src/${GO_IMPORT}/vendor/github.com/mitchellh/reflectwalk/LICENSE;md5=3f7765c3d4f58e1f84c4313cecf0f5bd',
752 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nats.go/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
753 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nkeys/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
754 'file://src/${GO_IMPORT}/vendor/github.com/nats-io/nuid/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
755 'file://src/${GO_IMPORT}/vendor/github.com/pmezard/go-difflib/LICENSE;md5=e9a2ebb8de779a07500ddecca806145e',
756 'file://src/${GO_IMPORT}/vendor/github.com/rcrowley/go-metrics/LICENSE;md5=1bdf5d819f50f141366dabce3be1460f',
757 'file://src/${GO_IMPORT}/vendor/github.com/spiffe/go-spiffe/v2/LICENSE;md5=86d3f3a95c324c9479bd8986968f4327',
758 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/objx/LICENSE;md5=d023fd31d3ca39ec61eec65a91732735',
759 'file://src/${GO_IMPORT}/vendor/github.com/stretchr/testify/LICENSE;md5=188f01994659f3c0d310612333d2a26f',
760 'file://src/${GO_IMPORT}/vendor/github.com/x448/float16/LICENSE;md5=de8f8e025d57fe7ee0b67f30d571323b',
761 'file://src/${GO_IMPORT}/vendor/github.com/zeebo/errs/LICENSE;md5=84914ab36fc0eb48edbaa53e66e8d326',
762 'file://src/${GO_IMPORT}/vendor/golang.org/x/crypto/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
763 'file://src/${GO_IMPORT}/vendor/golang.org/x/mod/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
764 'file://src/${GO_IMPORT}/vendor/golang.org/x/net/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
765 'file://src/${GO_IMPORT}/vendor/golang.org/x/sync/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
766 'file://src/${GO_IMPORT}/vendor/golang.org/x/sys/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
767 'file://src/${GO_IMPORT}/vendor/golang.org/x/text/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
768 'file://src/${GO_IMPORT}/vendor/golang.org/x/tools/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707',
769 'file://src/${GO_IMPORT}/vendor/google.golang.org/genproto/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
770 'file://src/${GO_IMPORT}/vendor/google.golang.org/grpc/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57',
771 'file://src/${GO_IMPORT}/vendor/google.golang.org/protobuf/LICENSE;md5=02d4002e9171d41a8fad93aa7faf3956',
772 'file://src/${GO_IMPORT}/vendor/gopkg.in/eapache/queue.v1/LICENSE;md5=1bfd4408d3de090ef6b908b0cc45a316',
773 'file://src/${GO_IMPORT}/vendor/gopkg.in/yaml.v3/LICENSE;md5=3c91c17266710e16afdbb2b6d15c761c'])
774
775 self.assertTrue(os.path.isfile(lics_require_file))
776 self._test_recipe_contents(lics_require_file, checkvars, [])
777
778 dependencies = \
779 [ ('github.com/eclipse/paho.mqtt.golang','v1.4.2', '', '', ''),
780 ('github.com/edgexfoundry/go-mod-bootstrap','v3.0.1','github.com/edgexfoundry/go-mod-bootstrap/v3','/v3', ''),
781 ('github.com/edgexfoundry/go-mod-configuration','v3.0.0','github.com/edgexfoundry/go-mod-configuration/v3','/v3', ''),
782 ('github.com/edgexfoundry/go-mod-core-contracts','v3.0.0','github.com/edgexfoundry/go-mod-core-contracts/v3','/v3', ''),
783 ('github.com/edgexfoundry/go-mod-messaging','v3.0.0','github.com/edgexfoundry/go-mod-messaging/v3','/v3', ''),
784 ('github.com/edgexfoundry/go-mod-secrets','v3.0.1','github.com/edgexfoundry/go-mod-secrets/v3','/v3', ''),
785 ('github.com/fxamacker/cbor','v2.4.0','github.com/fxamacker/cbor/v2','/v2', ''),
786 ('github.com/gomodule/redigo','v1.8.9', '', '', ''),
787 ('github.com/google/uuid','v1.3.0', '', '', ''),
788 ('github.com/gorilla/mux','v1.8.0', '', '', ''),
789 ('github.com/rcrowley/go-metrics','v0.0.0-20201227073835-cf1acfcdf475', '', '', ''),
790 ('github.com/spiffe/go-spiffe','v2.1.4','github.com/spiffe/go-spiffe/v2','/v2', ''),
791 ('github.com/stretchr/testify','v1.8.2', '', '', ''),
792 ('go.googlesource.com/crypto','v0.8.0','golang.org/x/crypto', '', ''),
793 ('gopkg.in/eapache/queue.v1','v1.1.0', '', '', ''),
794 ('gopkg.in/yaml.v3','v3.0.1', '', '', ''),
795 ('github.com/microsoft/go-winio','v0.6.0','github.com/Microsoft/go-winio', '', ''),
796 ('github.com/hashicorp/go-metrics','v0.3.10','github.com/armon/go-metrics', '', ''),
797 ('github.com/cenkalti/backoff','v2.2.1+incompatible', '', '', ''),
798 ('github.com/davecgh/go-spew','v1.1.1', '', '', ''),
799 ('github.com/edgexfoundry/go-mod-registry','v3.0.0','github.com/edgexfoundry/go-mod-registry/v3','/v3', ''),
800 ('github.com/fatih/color','v1.9.0', '', '', ''),
801 ('github.com/go-jose/go-jose','v3.0.0','github.com/go-jose/go-jose/v3','/v3', ''),
802 ('github.com/go-kit/log','v0.2.1', '', '', ''),
803 ('github.com/go-logfmt/logfmt','v0.5.1', '', '', ''),
804 ('github.com/go-playground/locales','v0.14.1', '', '', ''),
805 ('github.com/go-playground/universal-translator','v0.18.1', '', '', ''),
806 ('github.com/go-playground/validator','v10.13.0','github.com/go-playground/validator/v10','/v10', ''),
807 ('github.com/go-redis/redis','v7.3.0','github.com/go-redis/redis/v7','/v7', ''),
808 ('github.com/golang/protobuf','v1.5.2', '', '', ''),
809 ('github.com/gorilla/websocket','v1.4.2', '', '', ''),
810 ('github.com/hashicorp/consul','v1.20.0','github.com/hashicorp/consul/api', '', 'api'),
811 ('github.com/hashicorp/errwrap','v1.0.0', '', '', ''),
812 ('github.com/hashicorp/go-cleanhttp','v0.5.1', '', '', ''),
813 ('github.com/hashicorp/go-hclog','v0.14.1', '', '', ''),
814 ('github.com/hashicorp/go-immutable-radix','v1.3.0', '', '', ''),
815 ('github.com/hashicorp/go-multierror','v1.1.1', '', '', ''),
816 ('github.com/hashicorp/go-rootcerts','v1.0.2', '', '', ''),
817 ('github.com/hashicorp/golang-lru','v0.5.4', '', '', ''),
818 ('github.com/hashicorp/serf','v0.10.1', '', '', ''),
819 ('github.com/leodido/go-urn','v1.2.3', '', '', ''),
820 ('github.com/mattn/go-colorable','v0.1.12', '', '', ''),
821 ('github.com/mattn/go-isatty','v0.0.14', '', '', ''),
822 ('github.com/mitchellh/consulstructure','v0.0.0-20190329231841-56fdc4d2da54', '', '', ''),
823 ('github.com/mitchellh/copystructure','v1.2.0', '', '', ''),
824 ('github.com/mitchellh/go-homedir','v1.1.0', '', '', ''),
825 ('github.com/mitchellh/mapstructure','v1.5.0', '', '', ''),
826 ('github.com/mitchellh/reflectwalk','v1.0.2', '', '', ''),
827 ('github.com/nats-io/nats.go','v1.25.0', '', '', ''),
828 ('github.com/nats-io/nkeys','v0.4.4', '', '', ''),
829 ('github.com/nats-io/nuid','v1.0.1', '', '', ''),
830 ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''),
831 ('github.com/stretchr/objx','v0.5.0', '', '', ''),
832 ('github.com/x448/float16','v0.8.4', '', '', ''),
833 ('github.com/zeebo/errs','v1.3.0', '', '', ''),
834 ('go.googlesource.com/mod','v0.8.0','golang.org/x/mod', '', ''),
835 ('go.googlesource.com/net','v0.9.0','golang.org/x/net', '', ''),
836 ('go.googlesource.com/sync','v0.1.0','golang.org/x/sync', '', ''),
837 ('go.googlesource.com/sys','v0.7.0','golang.org/x/sys', '', ''),
838 ('go.googlesource.com/text','v0.9.0','golang.org/x/text', '', ''),
839 ('go.googlesource.com/tools','v0.6.0','golang.org/x/tools', '', ''),
840 ('github.com/googleapis/go-genproto','v0.0.0-20230223222841-637eb2293923','google.golang.org/genproto', '', ''),
841 ('github.com/grpc/grpc-go','v1.53.0','google.golang.org/grpc', '', ''),
842 ('go.googlesource.com/protobuf','v1.28.1','google.golang.org/protobuf', '', ''),
843 ]
844
845 src_uri = set()
846 for d in dependencies:
847 src_uri.add(urifiy(*d))
848
849 checkvars = {}
850 checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri
851
852 self.assertTrue(os.path.isfile(deps_require_file))
853 self._test_recipe_contents(deps_require_file, checkvars, [])
854
855
856
672 def _copy_file_with_cleanup(self, srcfile, basedstdir, *paths): 857 def _copy_file_with_cleanup(self, srcfile, basedstdir, *paths):
673 dstdir = basedstdir 858 dstdir = basedstdir
674 self.assertTrue(os.path.exists(dstdir)) 859 self.assertTrue(os.path.exists(dstdir))