(t *testing.T)
| 635 | } |
| 636 | |
| 637 | func TestSymlink(t *testing.T) { |
| 638 | condSkip(t) |
| 639 | // Do it all once, unmount, re-mount and then check again. |
| 640 | // TODO(bradfitz): do this same pattern (unmount and remount) in the other tests. |
| 641 | var suffix string |
| 642 | var link string |
| 643 | const target = "../../some-target" // arbitrary string. some-target is fake. |
| 644 | check := func() { |
| 645 | fi, err := os.Lstat(link) |
| 646 | if err != nil { |
| 647 | t.Fatalf("Stat: %v", err) |
| 648 | } |
| 649 | if fi.Mode()&os.ModeSymlink == 0 { |
| 650 | t.Errorf("Mode = %v; want Symlink bit set", fi.Mode()) |
| 651 | } |
| 652 | got, err := os.Readlink(link) |
| 653 | if err != nil { |
| 654 | t.Fatalf("Readlink: %v", err) |
| 655 | } |
| 656 | if got != target { |
| 657 | t.Errorf("ReadLink = %q; want %q", got, target) |
| 658 | } |
| 659 | } |
| 660 | inEmptyMutDir(t, func(env *mountEnv, rootDir string) { |
| 661 | // Save for second test: |
| 662 | link = filepath.Join(rootDir, "some-link") |
| 663 | suffix = strings.TrimPrefix(link, env.mountPoint) |
| 664 | |
| 665 | if err := os.Symlink(target, link); err != nil { |
| 666 | t.Fatalf("Symlink: %v", err) |
| 667 | } |
| 668 | t.Logf("Checking in first process...") |
| 669 | check() |
| 670 | }) |
| 671 | pkmountTest(t, func(env *mountEnv) { |
| 672 | t.Logf("Checking in second process...") |
| 673 | link = env.mountPoint + suffix |
| 674 | check() |
| 675 | }) |
| 676 | } |
| 677 | |
| 678 | func TestFinderCopy(t *testing.T) { |
| 679 | if runtime.GOOS != "darwin" { |
nothing calls this directly
no test coverage detected