Browse code

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 authored on 2015/08/17 18:20:45
Showing 5 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,72 @@
0
+# This file describes the standard way to build Docker, using docker
1
+#
2
+# Usage:
3
+#
4
+# # Assemble the full dev environment. This is slow the first time.
5
+# docker build -t docker -f Dockerfile.gccgo .
6
+#
7
+
8
+FROM gcc:5.2
9
+
10
+# Packaged dependencies
11
+RUN apt-get update && apt-get install -y \
12
+	apparmor \
13
+	aufs-tools \
14
+	btrfs-tools \
15
+	build-essential \
16
+	curl \
17
+	git \
18
+	iptables \
19
+	net-tools \
20
+	libapparmor-dev \
21
+	libcap-dev \
22
+	libsqlite3-dev \
23
+	mercurial \
24
+	parallel \
25
+	python-mock \
26
+	python-pip \
27
+	python-websocket \
28
+	--no-install-recommends
29
+
30
+# Get lvm2 source for compiling statically
31
+RUN git clone -b v2_02_103 https://git.fedorahosted.org/git/lvm2.git /usr/local/lvm2
32
+# see https://git.fedorahosted.org/cgit/lvm2.git/refs/tags for release tags
33
+
34
+# Compile and install lvm2
35
+RUN cd /usr/local/lvm2 \
36
+	&& ./configure --enable-static_link \
37
+	&& make device-mapper \
38
+	&& make install_device-mapper
39
+# see https://git.fedorahosted.org/cgit/lvm2.git/tree/INSTALL
40
+
41
+# Install lxc
42
+ENV LXC_VERSION 1.1.2
43
+RUN mkdir -p /usr/src/lxc \
44
+	&& curl -sSL https://linuxcontainers.org/downloads/lxc/lxc-${LXC_VERSION}.tar.gz | tar -v -C /usr/src/lxc/ -xz --strip-components=1
45
+RUN cd /usr/src/lxc \
46
+	&& ./configure \
47
+	&& make \
48
+	&& make install \
49
+	&& ldconfig
50
+
51
+ENV GOPATH /go:/go/src/github.com/docker/docker/vendor
52
+
53
+# Get the "docker-py" source so we can run their integration tests
54
+ENV DOCKER_PY_COMMIT 139850f3f3b17357bab5ba3edfb745fb14043764
55
+RUN git clone https://github.com/docker/docker-py.git /docker-py \
56
+	&& cd /docker-py \
57
+	&& git checkout -q $DOCKER_PY_COMMIT
58
+
59
+# Add an unprivileged user to be used for tests which need it
60
+RUN groupadd -r docker
61
+RUN useradd --create-home --gid docker unprivilegeduser
62
+
63
+VOLUME /var/lib/docker
64
+WORKDIR /go/src/github.com/docker/docker
65
+ENV DOCKER_BUILDTAGS apparmor selinux
66
+
67
+# Wrap all commands in the "docker-in-docker" script to allow nested containers
68
+ENTRYPOINT ["hack/dind"]
69
+
70
+# Upload docker source
71
+COPY . /go/src/github.com/docker/docker
... ...
@@ -23,9 +23,13 @@ if [ "$BUILDFLAGS_FILE" ]; then
23 23
 	readarray -t BUILDFLAGS < "$BUILDFLAGS_FILE"
24 24
 fi
25 25
 
26
+if [[ "$(go version)" =~ "gccgo" ]]; then
27
+	GCCGOFLAGS="-gccgoflags= -lpthread -ldl "
28
+fi
29
+
26 30
 if ! (
27 31
 	cd "$dir"
28
-	go test "${testcover[@]}" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c
32
+	go test "${testcover[@]}" "$GCCGOFLAGS" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" $TESTFLAGS -c 
29 33
 ); then
30 34
 	exit 1
31 35
 fi
... ...
@@ -2853,7 +2853,7 @@ func (s *DockerSuite) TestPtraceContainerProcsFromHost(c *check.C) {
2853 2853
 }
2854 2854
 
2855 2855
 func (s *DockerSuite) TestAppArmorDeniesPtrace(c *check.C) {
2856
-	testRequires(c, SameHostDaemon, NativeExecDriver, Apparmor, DaemonIsLinux)
2856
+	testRequires(c, SameHostDaemon, NativeExecDriver, Apparmor, DaemonIsLinux, NotGCCGO)
2857 2857
 
2858 2858
 	// Run through 'sh' so we are NOT pid 1. Pid 1 may be able to trace
2859 2859
 	// itself, but pid>1 should not be able to trace pid1.
... ...
@@ -270,7 +270,8 @@ func (s *DockerSuite) TestRunOOMExitCode(c *check.C) {
270 270
 	errChan := make(chan error)
271 271
 	go func() {
272 272
 		defer close(errChan)
273
-		out, exitCode, _ := dockerCmdWithError("run", "-m", "4MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
273
+		//changing memory to 40MB from 4MB due to an issue with GCCGO that test fails to start the container.
274
+		out, exitCode, _ := dockerCmdWithError("run", "-m", "40MB", "busybox", "sh", "-c", "x=a; while true; do x=$x$x$x$x; done")
274 275
 		if expected := 137; exitCode != expected {
275 276
 			errChan <- fmt.Errorf("wrong exit code for OOM container: expected %d, got %d (output: %q)", expected, exitCode, out)
276 277
 		}
... ...
@@ -137,6 +137,16 @@ var (
137 137
 		},
138 138
 		"Test requires support for IPv6",
139 139
 	}
140
+	NotGCCGO = testRequirement{
141
+		func() bool {
142
+			out, err := exec.Command("go", "version").Output()
143
+			if err != nil && strings.Contains(string(out), "gccgo") {
144
+				return true
145
+			}
146
+			return false
147
+		},
148
+		"Test requires native Golang compiler instead of GCCGO",
149
+	}
140 150
 )
141 151
 
142 152
 // testRequires checks if the environment satisfies the requirements