summaryrefslogtreecommitdiff
path: root/src/cmd/pack/pack_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/pack/pack_test.go')
-rw-r--r--src/cmd/pack/pack_test.go33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/cmd/pack/pack_test.go b/src/cmd/pack/pack_test.go
index 486242603..cf6121fcc 100644
--- a/src/cmd/pack/pack_test.go
+++ b/src/cmd/pack/pack_test.go
@@ -56,11 +56,8 @@ func tmpDir(t *testing.T) string {
return name
}
-// Test that we can create an archive, write to it, and get the same contents back.
-// Tests the rv and then the pv command on a new archive.
-func TestCreate(t *testing.T) {
- dir := tmpDir(t)
- defer os.RemoveAll(dir)
+// testCreate creates an archive in the specified directory.
+func testCreate(t *testing.T, dir string) {
name := filepath.Join(dir, "pack.a")
ar := archive(name, os.O_RDWR, nil)
// Add an entry by hand.
@@ -85,6 +82,22 @@ func TestCreate(t *testing.T) {
}
}
+// Test that we can create an archive, write to it, and get the same contents back.
+// Tests the rv and then the pv command on a new archive.
+func TestCreate(t *testing.T) {
+ dir := tmpDir(t)
+ defer os.RemoveAll(dir)
+ testCreate(t, dir)
+}
+
+// Test that we can create an archive twice with the same name (Issue 8369).
+func TestCreateTwice(t *testing.T) {
+ dir := tmpDir(t)
+ defer os.RemoveAll(dir)
+ testCreate(t, dir)
+ testCreate(t, dir)
+}
+
// Test that we can create an archive, put some files in it, and get back a correct listing.
// Tests the tv command.
func TestTableOfContents(t *testing.T) {
@@ -186,8 +199,9 @@ func TestExtract(t *testing.T) {
// Test that pack-created archives can be understood by the tools.
func TestHello(t *testing.T) {
- if runtime.GOOS == "nacl" {
- t.Skip("skipping on nacl")
+ switch runtime.GOOS {
+ case "android", "nacl":
+ t.Skipf("skipping on %s", runtime.GOOS)
}
dir := tmpDir(t)
@@ -222,8 +236,9 @@ func TestHello(t *testing.T) {
// Test that pack works with very long lines in PKGDEF.
func TestLargeDefs(t *testing.T) {
- if runtime.GOOS == "nacl" {
- t.Skip("skipping on nacl")
+ switch runtime.GOOS {
+ case "android", "nacl":
+ t.Skipf("skipping on %s", runtime.GOOS)
}
dir := tmpDir(t)