From c617524866ea0cd456db0d8b87aed7c7dddf4510 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Wed, 24 Jan 2018 20:02:23 -0800 Subject: [PATCH 1/2] pkg/mount: use sort.Slice Sorting by mount point length can be implemented in a more straightforward fashion since Go 1.8 introduced sort.Slice() with an ability to provide a less() function in place. Signed-off-by: Kir Kolyshkin Upstream-commit: a00310b54c0cdcafb402aeea92feca865da9fdf3 Component: engine --- components/engine/pkg/mount/mount.go | 4 +++- components/engine/pkg/mount/mountinfo.go | 14 -------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/components/engine/pkg/mount/mount.go b/components/engine/pkg/mount/mount.go index 8ff4925d73..7bdbf8a837 100644 --- a/components/engine/pkg/mount/mount.go +++ b/components/engine/pkg/mount/mount.go @@ -72,7 +72,9 @@ func RecursiveUnmount(target string) error { } // Make the deepest mount be first - sort.Sort(sort.Reverse(byMountpoint(mounts))) + sort.Slice(mounts, func(i, j int) bool { + return len(mounts[i].Mountpoint) > len(mounts[j].Mountpoint) + }) for i, m := range mounts { if !strings.HasPrefix(m.Mountpoint, target) { diff --git a/components/engine/pkg/mount/mountinfo.go b/components/engine/pkg/mount/mountinfo.go index 05803938af..ecd03fc022 100644 --- a/components/engine/pkg/mount/mountinfo.go +++ b/components/engine/pkg/mount/mountinfo.go @@ -38,17 +38,3 @@ type Info struct { // VfsOpts represents per super block options. VfsOpts string } - -type byMountpoint []*Info - -func (by byMountpoint) Len() int { - return len(by) -} - -func (by byMountpoint) Less(i, j int) bool { - return by[i].Mountpoint < by[j].Mountpoint -} - -func (by byMountpoint) Swap(i, j int) { - by[i], by[j] = by[j], by[i] -} From 671826c75df04eb2ada8b60e53eefcfb09b25319 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 8 Mar 2018 16:57:23 -0600 Subject: [PATCH 2/2] [integration] skip ppc64le oom tests for now These tests were enabled by changing a config option on the ci machines, instead of from a patch, so let me disable them for now on ppc64le and open up another patch to enable them, where I can find out what the issues are with them. Signed-off-by: Christopher Jones Upstream-commit: 620ddc78a1437feaa42f40853ef586d268991620 Component: engine --- .../engine/integration-cli/docker_cli_events_unix_test.go | 4 ++-- components/engine/integration-cli/docker_cli_run_unix_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/engine/integration-cli/docker_cli_events_unix_test.go b/components/engine/integration-cli/docker_cli_events_unix_test.go index afac998e02..680030807e 100644 --- a/components/engine/integration-cli/docker_cli_events_unix_test.go +++ b/components/engine/integration-cli/docker_cli_events_unix_test.go @@ -49,7 +49,7 @@ func (s *DockerSuite) TestEventsRedirectStdout(c *check.C) { } func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) { - testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, swapMemorySupport) + testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, swapMemorySupport, NotPpc64le) errChan := make(chan error) go func() { @@ -79,7 +79,7 @@ func (s *DockerSuite) TestEventsOOMDisableFalse(c *check.C) { } func (s *DockerSuite) TestEventsOOMDisableTrue(c *check.C) { - testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, NotArm, swapMemorySupport) + testRequires(c, DaemonIsLinux, oomControl, memoryLimitSupport, NotArm, swapMemorySupport, NotPpc64le) errChan := make(chan error) observer, err := newEventObserver(c) diff --git a/components/engine/integration-cli/docker_cli_run_unix_test.go b/components/engine/integration-cli/docker_cli_run_unix_test.go index 952cf0a4ac..d817bc3b22 100644 --- a/components/engine/integration-cli/docker_cli_run_unix_test.go +++ b/components/engine/integration-cli/docker_cli_run_unix_test.go @@ -615,7 +615,7 @@ func (s *DockerSuite) TestRunWithInvalidPathforBlkioDeviceWriteIOps(c *check.C) } func (s *DockerSuite) TestRunOOMExitCode(c *check.C) { - testRequires(c, memoryLimitSupport, swapMemorySupport) + testRequires(c, memoryLimitSupport, swapMemorySupport, NotPpc64le) errChan := make(chan error) go func() { defer close(errChan)