[lxc-devel] [go-lxc/v2] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Sat Nov 26 20:12:11 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 302 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161126/98d9beae/attachment.bin>
-------------- next part --------------
From ebde4d3006ab0a9a4b719ad3efcde0f12c74b2f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 26 Nov 2016 15:06:30 -0500
Subject: [PATCH 1/3] tests: Skip architecture test on !x86
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc_test.go | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lxc_test.go b/lxc_test.go
index bb60a06..a155d6e 100644
--- a/lxc_test.go
+++ b/lxc_test.go
@@ -14,6 +14,7 @@ import (
 	"strconv"
 	"strings"
 	"sync"
+	"syscall"
 	"testing"
 	"time"
 )
@@ -1104,6 +1105,23 @@ func TestCommandWithUIDGID(t *testing.T) {
 }
 
 func TestCommandWithArch(t *testing.T) {
+	uname := syscall.Utsname{}
+	if err := syscall.Uname(&uname); err != nil {
+		t.Errorf(err.Error())
+	}
+
+	arch := ""
+	for _, c := range uname.Machine {
+		if c == 0 {
+			break
+		}
+		arch += string(byte(c))
+	}
+
+	if arch != "x86_64" && arch != "i686" {
+		t.Skip("skipping architecture test, not on x86")
+	}
+
 	c, err := NewContainer(ContainerName)
 	if err != nil {
 		t.Errorf(err.Error())

From 2205ca977a780f6d0757989fd439235fcfb216f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 26 Nov 2016 15:10:33 -0500
Subject: [PATCH 2/3] tests: Make skip messages consistent
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxc_test.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxc_test.go b/lxc_test.go
index a155d6e..800bf9b 100644
--- a/lxc_test.go
+++ b/lxc_test.go
@@ -1242,7 +1242,9 @@ func TestIPv4Addresses(t *testing.T) {
 }
 
 func TestIPv6Addresses(t *testing.T) {
-	t.Skip("skipping test")
+	if !unprivileged() {
+		t.Skip("skipping test in privileged mode.")
+	}
 
 	c, err := NewContainer(ContainerName)
 	if err != nil {

From 9c271de13d0a7118278fe4ae48ad69df10b107bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 26 Nov 2016 15:11:44 -0500
Subject: [PATCH 3/3] Run "go fmt"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 container.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/container.go b/container.go
index 6872ce4..ae09abc 100644
--- a/container.go
+++ b/container.go
@@ -1556,13 +1556,12 @@ func (c *Container) Migrate(cmd uint, opts MigrateOptions) error {
 		return err
 	}
 
-	if (cmd != MIGRATE_RESTORE) {
+	if cmd != MIGRATE_RESTORE {
 		if err := c.makeSure(isRunning); err != nil {
 			return err
 		}
 	}
 
-
 	cdirectory := C.CString(opts.Directory)
 	defer C.free(unsafe.Pointer(cdirectory))
 


More information about the lxc-devel mailing list