summaryrefslogtreecommitdiff
path: root/libgo/go/archive/zip/zip_test.go
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-31 00:59:47 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-31 00:59:47 +0000
commit4a3da3a8a45d5496118798146de1fa4e5798ed5a (patch)
tree13beeaed3698c61903fe93fb1ce70bd9b18d4e7f /libgo/go/archive/zip/zip_test.go
parentcd529f4d86a17a3e8959f2cb5ac7132a841ab6f1 (diff)
downloadgcc-4a3da3a8a45d5496118798146de1fa4e5798ed5a.tar.gz
runtime: Remove now unnecessary pad field from ParFor.
It is not needed due to the removal of the ctx field. Reviewed-on: https://go-review.googlesource.com/16525 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229616 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/archive/zip/zip_test.go')
-rw-r--r--libgo/go/archive/zip/zip_test.go36
1 files changed, 34 insertions, 2 deletions
diff --git a/libgo/go/archive/zip/zip_test.go b/libgo/go/archive/zip/zip_test.go
index 32a16a79efb..f00ff47d37e 100644
--- a/libgo/go/archive/zip/zip_test.go
+++ b/libgo/go/archive/zip/zip_test.go
@@ -229,10 +229,11 @@ func TestZip64(t *testing.T) {
t.Skip("slow test; skipping")
}
const size = 1 << 32 // before the "END\n" part
- testZip64(t, size)
+ buf := testZip64(t, size)
+ testZip64DirectoryRecordLength(buf, t)
}
-func testZip64(t testing.TB, size int64) {
+func testZip64(t testing.TB, size int64) *rleBuffer {
const chunkSize = 1024
chunks := int(size / chunkSize)
// write 2^32 bytes plus "END\n" to a zip file
@@ -302,6 +303,37 @@ func testZip64(t testing.TB, size int64) {
if got, want := f0.UncompressedSize64, uint64(size)+uint64(len(end)); got != want {
t.Errorf("UncompressedSize64 %d, want %d", got, want)
}
+
+ return buf
+}
+
+// Issue 9857
+func testZip64DirectoryRecordLength(buf *rleBuffer, t *testing.T) {
+ d := make([]byte, 1024)
+ if _, err := buf.ReadAt(d, buf.Size()-int64(len(d))); err != nil {
+ t.Fatal("read:", err)
+ }
+
+ sigOff := findSignatureInBlock(d)
+ dirOff, err := findDirectory64End(buf, buf.Size()-int64(len(d))+int64(sigOff))
+ if err != nil {
+ t.Fatal("findDirectory64End:", err)
+ }
+
+ d = make([]byte, directory64EndLen)
+ if _, err := buf.ReadAt(d, dirOff); err != nil {
+ t.Fatal("read:", err)
+ }
+
+ b := readBuf(d)
+ if sig := b.uint32(); sig != directory64EndSignature {
+ t.Fatalf("Expected directory64EndSignature (%d), got %d", directory64EndSignature, sig)
+ }
+
+ size := b.uint64()
+ if size != directory64EndLen-12 {
+ t.Fatalf("Expected length of %d, got %d", directory64EndLen-12, size)
+ }
}
func testInvalidHeader(h *FileHeader, t *testing.T) {