MCPcopy
hub / github.com/Jguer/yay / TestIntegrationLocalInstallTwoSrcInfosWithDeps

Function TestIntegrationLocalInstallTwoSrcInfosWithDeps

local_install_test.go:1045–1185  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1043}
1044
1045func TestIntegrationLocalInstallTwoSrcInfosWithDeps(t *testing.T) {
1046 makepkgBin := t.TempDir() + "/makepkg"
1047 pacmanBin := t.TempDir() + "/pacman"
1048 gitBin := t.TempDir() + "/git"
1049 tmpDir1 := t.TempDir()
1050 tmpDir2 := t.TempDir()
1051 f, err := os.OpenFile(makepkgBin, os.O_RDONLY|os.O_CREATE, 0o755)
1052 require.NoError(t, err)
1053 require.NoError(t, f.Close())
1054
1055 f, err = os.OpenFile(pacmanBin, os.O_RDONLY|os.O_CREATE, 0o755)
1056 require.NoError(t, err)
1057 require.NoError(t, f.Close())
1058
1059 f, err = os.OpenFile(gitBin, os.O_RDONLY|os.O_CREATE, 0o755)
1060 require.NoError(t, err)
1061 require.NoError(t, f.Close())
1062
1063 pkgsTars := []string{
1064 tmpDir1 + "/libzip-git-1.9.2.r166.gd2c47d0f-1-x86_64.pkg.tar.zst",
1065 tmpDir2 + "/gourou-0.8.1-4-x86_64.pkg.tar.zst",
1066 }
1067
1068 wantShow := []string{
1069 "makepkg --verifysource --skippgpcheck -f -Cc",
1070 "makepkg --verifysource --skippgpcheck -f -Cc",
1071 "makepkg --nobuild -f -C --ignorearch",
1072 "makepkg -c --nobuild --noextract --ignorearch",
1073 "pacman -U --config /etc/pacman.conf -- /testdir1/libzip-git-1.9.2.r166.gd2c47d0f-1-x86_64.pkg.tar.zst",
1074 "pacman -D -q --asexplicit --config /etc/pacman.conf -- libzip-git",
1075 "makepkg --nobuild -f -C --ignorearch",
1076 "makepkg -c --nobuild --noextract --ignorearch",
1077 "pacman -U --config /etc/pacman.conf -- /testdir2/gourou-0.8.1-4-x86_64.pkg.tar.zst",
1078 "pacman -D -q --asexplicit --config /etc/pacman.conf -- gourou",
1079 }
1080
1081 wantCapture := []string{
1082 "git -C testdata/gourou git reset --hard HEAD",
1083 "git -C testdata/gourou git merge --no-edit --ff",
1084 "git -C testdata/libzip-git git reset --hard HEAD",
1085 "git -C testdata/libzip-git git merge --no-edit --ff",
1086 "makepkg --packagelist",
1087 "makepkg --packagelist",
1088 }
1089
1090 captureCounter := 0
1091 captureOverride := func(cmd *exec.Cmd) (stdout string, stderr string, err error) {
1092 captureCounter++
1093 switch captureCounter {
1094 case 5:
1095 return pkgsTars[0] + "\n", "", nil
1096 case 6:
1097 return pkgsTars[1] + "\n", "", nil
1098 default:
1099 return "", "", nil
1100 }
1101 }
1102

Callers

nothing calls this directly

Calls 9

MakeArgumentsFunction · 0.92
AddArgMethod · 0.80
AddTargetMethod · 0.80
newTestLoggerFunction · 0.70
handleCmdFunction · 0.70
DoMethod · 0.65
LenMethod · 0.65
CloseMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected