Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Unified Diff: go/src/infra/tools/cipd/local/pkgdef_test.go

Issue 1258673004: cipd: Make it work on Windows. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: go/src/infra/tools/cipd/local/pkgdef_test.go
diff --git a/go/src/infra/tools/cipd/local/pkgdef_test.go b/go/src/infra/tools/cipd/local/pkgdef_test.go
index 720415d07dda9f48d7db448cedc705f180cb00d5..3c51a46aa777e16e66442125908e70f51a051435 100644
--- a/go/src/infra/tools/cipd/local/pkgdef_test.go
+++ b/go/src/infra/tools/cipd/local/pkgdef_test.go
@@ -8,6 +8,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
+ "runtime"
"strings"
"testing"
@@ -224,9 +225,13 @@ func TestFindFiles(t *testing.T) {
mkF("ENV/dir/def.py")
mkD("ENV/empty") // will be skipped
mkF("ENV/exclude_me") // excluded via "exclude: 'exclude_me'"
- mkL("ENV/abs_link", filepath.Dir(tempDir))
- mkL("ENV/rel_link", "abc.py")
- mkL("ENV/abs_in_root", filepath.Join(tempDir, "ENV", "dir", "def.py"))
+
+ // Symlinks do not work on Windows.
+ if runtime.GOOS != "windows" {
+ mkL("ENV/abs_link", filepath.Dir(tempDir))
+ mkL("ENV/rel_link", "abc.py")
+ mkL("ENV/abs_in_root", filepath.Join(tempDir, "ENV", "dir", "def.py"))
+ }
mkF("infra/xyz.py")
mkF("infra/zzz.pyo")
@@ -271,22 +276,33 @@ func TestFindFiles(t *testing.T) {
names = append(names, f.Name())
byName[f.Name()] = f
}
- So(names, ShouldResemble, []string{
- "ENV/abc.py",
- "ENV/abc.pyo",
- "ENV/abs_in_root",
- "ENV/abs_link",
- "ENV/dir/def.py",
- "ENV/rel_link",
- "dir/file2.py",
- "file1.py",
- "infra/xyz.py",
- })
- // Separately check symlinks.
- ensureSymlinkTarget(byName["ENV/abs_in_root"], "dir/def.py")
- ensureSymlinkTarget(byName["ENV/abs_link"], filepath.ToSlash(filepath.Dir(tempDir)))
- ensureSymlinkTarget(byName["ENV/rel_link"], "abc.py")
+ if runtime.GOOS == "windows" {
+ So(names, ShouldResemble, []string{
+ "ENV/abc.py",
+ "ENV/abc.pyo",
+ "ENV/dir/def.py",
+ "dir/file2.py",
+ "file1.py",
+ "infra/xyz.py",
+ })
+ } else {
+ So(names, ShouldResemble, []string{
+ "ENV/abc.py",
+ "ENV/abc.pyo",
+ "ENV/abs_in_root",
+ "ENV/abs_link",
+ "ENV/dir/def.py",
+ "ENV/rel_link",
+ "dir/file2.py",
+ "file1.py",
+ "infra/xyz.py",
+ })
+ // Separately check symlinks.
+ ensureSymlinkTarget(byName["ENV/abs_in_root"], "dir/def.py")
+ ensureSymlinkTarget(byName["ENV/abs_link"], filepath.ToSlash(filepath.Dir(tempDir)))
+ ensureSymlinkTarget(byName["ENV/rel_link"], "abc.py")
+ }
})
})
}

Powered by Google App Engine
This is Rietveld 408576698