Ver Fonte

adding a Dockerfile.gccgo to use gccgo compiler instead of go compiler.
temporarily disabling registry builds as crypto package is broken with gccgo.

Signed-off-by: Srini Brahmaroutu <srbrahma@us.ibm.com>

Srini Brahmaroutu há 10 anos atrás
pai
commit
2c53643b33

+ 72 - 0
Dockerfile.gccgo

@@ -0,0 +1,72 @@
+# This file describes the standard way to build Docker, using docker
+#
+# Usage:
+#
+# # Assemble the full dev environment. This is slow the first time.
+# docker build -t docker -f Dockerfile.gccgo .
+#
+
+FROM gcc:5.2
+
+# Packaged dependencies
+RUN apt-get update && apt-get install -y \
+	apparmor \
+	aufs-tools \
+	btrfs-tools \
+	build-essential \
+	curl \
+	git \
+	iptables \
+	net-tools \
+	libapparmor-dev \
+	libcap-dev \
+	libsqlite3-dev \
+	mercurial \
+	parallel \
+	python-mock \
+	python-pip \
+	python-websocket \
+	--no-install-recommends
+
+# Get lvm2 source for compiling statically
+RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
+# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
+
+# Compile and install lvm2
+RUN cd /usr/local/lvm2 \
+	&& ./configure --enable-static_link \
+	&& make device-mapper \
+	&& make install_device-mapper
+# see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
+
+# Install lxc
+ENV LXC_VERSION 1.1.2
+RUN mkdir -p /usr/src/lxc \
+	&& curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
+RUN cd /usr/src/lxc \
+	&& ./configure \
+	&& make \
+	&& make install \
+	&& ldconfig
+
+ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
+
+# Get the "docker-py" source so we can run their integration tests
+ENV DOCKER_PY_COMMIT 139850f3f3b17357bab5ba3edfb745fb14043764
+RUN git clone https://github.com/docker/docker-py.git /docker-py \
+	&& cd /docker-py \
+	&& git checkout -q $DOCKER_PY_COMMIT
+
+# Add an unprivileged user to be used for tests which need it
+RUN groupadd -r docker
+RUN useradd --create-home --gid docker unprivilegeduser
+
+VOLUME /var/lib/docker
+WORKDIR /go/src/github.com/docker/docker
+ENV DOCKER_BUILDTAGS apparmor selinux
+
+# Wrap all commands in the "docker-in-docker" script to allow nested containers
+ENTRYPOINT ["hack/dind"]
+
+# Upload docker source
+COPY . /go/src/github.com/docker/docker

+ 5 - 1
hack/make/.go-compile-test-dir

@@ -23,9 +23,13 @@ if [ "$BUILDFLAGS_FILE" ]; then
 	readarray -t BUILDFLAGS < "$BUILDFLAGS_FILE"
 fi
 
+if [[ "$(go version)" =~ "gccgo" ]]; then
+	GCCGOFLAGS="-gccgoflags= -lpthread -ldl "
+fi
+
 if ! (
 	cd "$dir"
-	go test "${testcover[@]}" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
+	go test "${testcover[@]}" "$GCCGOFLAGS" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c 
 ); then
 	exit 1
 fi

+ 1 - 1
integration-cli/docker_cli_run_test.go

@@ -2853,7 +2853,7 @@ func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *check.C) {
 }
 
 func (s *DockerSuite) TestAppArmorDeniesPtrace(c *check.C) {
-	testRequires(c, SameHostDaemon, NativeExecDriver, Apparmor, DaemonIsLinux)
+	testRequires(c, SameHostDaemon, NativeExecDriver, Apparmor, DaemonIsLinux, NotGCCGO)
 
 	// Run through 'sh' so we are NOT pid 1. Pid 1 may be able to trace
 	// itself, but pid>1 should not be able to trace pid1.

+ 2 - 1
integration-cli/docker_cli_run_unix_test.go

@@ -270,7 +270,8 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
 	errChan := make(chan error)
 	go func() {
 		defer close(errChan)
-		out, exitCode, _ := dockerCmdWithError("run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
+		//changing memory to 40MB from 4MB due to an issue with GCCGO that test fails to start the container.
+		out, exitCode, _ := dockerCmdWithError("run", "-m", "40MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
 		if expected := 137; exitCode != expected {
 			errChan <- fmt.Errorf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
 		}

+ 10 - 0
integration-cli/requirements.go

@@ -137,6 +137,16 @@ var (
 		},
 		"Test requires support for IPv6",
 	}
+	NotGCCGO = testRequirement{
+		func() bool {
+			out, err := exec.Command("go", "version").Output()
+			if err != nil && strings.Contains(string(out), "gccgo") {
+				return true
+			}
+			return false
+		},
+		"Test requires native Golang compiler instead of GCCGO",
+	}
 )
 
 // testRequires checks if the environment satisfies the requirements