diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 20096c81c..ebe0f2d03 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -38,7 +38,7 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v3 - - run: brew install gpgme gnupg@1.4 + - run: brew install gpgme gnupg - uses: actions/setup-go@v3 with: go-version: '1.17.12' diff --git a/gpgme_test.go b/gpgme_test.go index 49ea5bdf3..1e1cd0865 100644 --- a/gpgme_test.go +++ b/gpgme_test.go @@ -8,7 +8,6 @@ import ( "os" "os/exec" "path/filepath" - "strings" "testing" ) @@ -118,10 +117,10 @@ func TestGetDirInfo(t *testing.T) { } func ctxWithCallback(t *testing.T) *Context { - ensureVersion(t, "1.", "can only set password callback for GPG v1.x") - ctx, err := New() checkError(t, err) + err = ctx.SetPinEntryMode(PinEntryLoopback) + checkError(t, err) checkError(t, ctx.SetCallback(func(uid_hint string, prev_was_bad bool, f *os.File) error { if prev_was_bad { @@ -395,46 +394,6 @@ func TestContext_AssuanSend(t *testing.T) { checkError(t, err) } -func isVersion(t testing.TB, version string) bool { - t.Helper() - var info *EngineInfo - info, err := GetEngineInfo() - checkError(t, err) - for info != nil { - if info.Protocol() == ProtocolOpenPGP { - if strings.Contains(info.FileName(), "gpg") && strings.HasPrefix(info.Version(), version) { - return true - } - return false - } - info = info.Next() - } - return false -} - -var gpgBins = []string{"gpg2", "gpg1", "gpg"} - -// ensureVersion tries to setup gpgme with a specific version or skip -func ensureVersion(t testing.TB, version, msg string) { - t.Helper() - if isVersion(t, version) { - return - } - for _, bin := range gpgBins { - path, err := exec.LookPath(bin) - if err != nil { - continue - } - if err := SetEngineInfo(ProtocolOpenPGP, path, absTestGPGHome()); err != nil { - continue - } - if isVersion(t, version) { - return - } - } - t.Skip(msg) -} - func diff(t testing.TB, dst, src []byte) { t.Helper() line := 1