diff options
author | Vyacheslav Yurkov <uvv.mail@gmail.com> | 2024-01-16 09:23:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-01-19 12:21:22 +0000 |
commit | 58722df9e1a9d8e7557f6fb857674ab1c0e9851a (patch) | |
tree | 74382bcdb0c0a556b838c7bff7ce4378cac0aeb7 /meta/lib/oeqa/selftest/cases | |
parent | a075bf502eedf41aa76b50597d05111a7bb3eaf8 (diff) | |
download | poky-58722df9e1a9d8e7557f6fb857674ab1c0e9851a.tar.gz |
oeqa/selftest/recipetool: Add test coverage for local go modules
(From OE-Core rev: 2d0ccfdca0a6cc1146464585f529fb5115a0b3ea)
Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/selftest/cases')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/recipetool.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 83848d6170..0c296875b2 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py | |||
@@ -927,6 +927,61 @@ class RecipetoolCreateTests(RecipetoolBase): | |||
927 | self.assertTrue(os.path.isfile(deps_require_file)) | 927 | self.assertTrue(os.path.isfile(deps_require_file)) |
928 | self._test_recipe_contents(deps_require_file, checkvars, []) | 928 | self._test_recipe_contents(deps_require_file, checkvars, []) |
929 | 929 | ||
930 | def test_recipetool_create_go_replace_modules(self): | ||
931 | # Check handling of replaced modules | ||
932 | temprecipe = os.path.join(self.tempdir, 'recipe') | ||
933 | os.makedirs(temprecipe) | ||
934 | |||
935 | recipefile = os.path.join(temprecipe, 'openapi-generator_git.bb') | ||
936 | deps_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-modules.inc') | ||
937 | lics_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-licenses.inc') | ||
938 | modules_txt_file = os.path.join(temprecipe, 'openapi-generator', 'modules.txt') | ||
939 | |||
940 | srcuri = 'https://github.com/OpenAPITools/openapi-generator.git' | ||
941 | srcrev = "v7.2.0" | ||
942 | srcbranch = "master" | ||
943 | srcsubdir = "samples/openapi3/client/petstore/go" | ||
944 | |||
945 | result = runCmd('recipetool create -o %s %s -S %s -B %s --src-subdir %s' % (temprecipe, srcuri, srcrev, srcbranch, srcsubdir)) | ||
946 | |||
947 | self.maxDiff = None | ||
948 | inherits = ['go-vendor'] | ||
949 | |||
950 | checkvars = {} | ||
951 | checkvars['GO_IMPORT'] = "github.com/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go" | ||
952 | checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https', | ||
953 | 'file://modules.txt'} | ||
954 | |||
955 | self.assertNotIn('Traceback', result.output) | ||
956 | self.assertIn('No license file was detected for the main module', result.output) | ||
957 | self.assertTrue(os.path.isfile(recipefile)) | ||
958 | self._test_recipe_contents(recipefile, checkvars, inherits) | ||
959 | |||
960 | # make sure that dependencies don't mention local directory ./go-petstore | ||
961 | dependencies = \ | ||
962 | [ ('github.com/stretchr/testify','v1.8.4', '', '', ''), | ||
963 | ('go.googlesource.com/oauth2','v0.10.0','golang.org/x/oauth2', '', ''), | ||
964 | ('github.com/davecgh/go-spew','v1.1.1', '', '', ''), | ||
965 | ('github.com/golang/protobuf','v1.5.3', '', '', ''), | ||
966 | ('github.com/kr/pretty','v0.3.0', '', '', ''), | ||
967 | ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''), | ||
968 | ('github.com/rogpeppe/go-internal','v1.9.0', '', '', ''), | ||
969 | ('go.googlesource.com/net','v0.12.0','golang.org/x/net', '', ''), | ||
970 | ('github.com/golang/appengine','v1.6.7','google.golang.org/appengine', '', ''), | ||
971 | ('go.googlesource.com/protobuf','v1.31.0','google.golang.org/protobuf', '', ''), | ||
972 | ('gopkg.in/check.v1','v1.0.0-20201130134442-10cb98267c6c', '', '', ''), | ||
973 | ('gopkg.in/yaml.v3','v3.0.1', '', '', ''), | ||
974 | ] | ||
975 | |||
976 | src_uri = set() | ||
977 | for d in dependencies: | ||
978 | src_uri.add(self._go_urifiy(*d)) | ||
979 | |||
980 | checkvars = {} | ||
981 | checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri | ||
982 | |||
983 | self.assertTrue(os.path.isfile(deps_require_file)) | ||
984 | self._test_recipe_contents(deps_require_file, checkvars, []) | ||
930 | 985 | ||
931 | class RecipetoolTests(RecipetoolBase): | 986 | class RecipetoolTests(RecipetoolBase): |
932 | 987 | ||