diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 20096c81c..9bfaf3f03 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -16,8 +16,8 @@ jobs: - run: sudo apt-get install -y libgpgme-dev - uses: actions/setup-go@v3 with: - go-version: '1.17.12' - - run: go test -v ./... + go-version: '1.25.4' + - run: go test -v -v ./... ubuntu-ppe64le: runs-on: ubuntu-latest @@ -32,14 +32,14 @@ jobs: apt-get update -q -y apt-get install -y libgpgme-dev golang run: | - go test -v ./... + go test -v -v ./... macos: 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' - - run: go test -v ./... + go-version: '1.25.4' + - run: GPGME_DEBUG=9 go test -v -v ./... diff --git a/data.go b/data.go index 0e81c36d6..4e512c573 100644 --- a/data.go +++ b/data.go @@ -11,6 +11,7 @@ import ( "os" "runtime" "runtime/cgo" + "strings" "unsafe" ) @@ -45,6 +46,9 @@ func gogpgme_writefunc(handle, buffer unsafe.Pointer, size C.size_t) C.ssize_t { d := h.Value().(*Data) n, err := d.w.Write(unsafe.Slice((*byte)(buffer), size)) if err != nil && err != io.EOF { + if !strings.Contains(err.Error(), "a special error") { + panic("UNEXPECTED WRITE ERROR: " + err.Error()) + } d.err = err C.gpgme_err_set_errno(C.EIO) return -1 diff --git a/gpgme_test.go b/gpgme_test.go index 49ea5bdf3..ee1f4cba4 100644 --- a/gpgme_test.go +++ b/gpgme_test.go @@ -118,10 +118,12 @@ func TestGetDirInfo(t *testing.T) { } func ctxWithCallback(t *testing.T) *Context { - ensureVersion(t, "1.", "can only set password callback for GPG v1.x") + //ensureVersion(t, "1.", "can only set password callback for GPG v1.x") ctx, err := New() checkError(t, 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 { @@ -246,8 +248,14 @@ func TestContext_Verify(t *testing.T) { ctx, err := New() checkError(t, err) - _, err = ctx.GetKey("test@example.com", false) + key, err := ctx.GetKey("test@example.com", false) checkError(t, err) + if key == nil { + t.Fatal("Expected key, got nil") + } + if key.Fingerprint() != "44B646DC347C31E867FF4F450327FFB0229F6136" { + t.Fatalf("Unexpected fingerprint %q", key.Fingerprint()) + } signed, err := NewDataBytes([]byte(testSignedText)) checkError(t, err)