瀏覽代碼

Merge pull request #1010 from dotcloud/1009-testing-hack

Testing|hack, issue #1009: Update make hack environment
Guillaume J. Charmes 12 年之前
父節點
當前提交
b44e2e71aa
共有 3 個文件被更改,包括 18 次插入9 次删除
  1. 9 2
      Makefile
  2. 4 3
      hack/README.rst
  3. 5 4
      hack/Vagrantfile

+ 9 - 2
Makefile

@@ -2,6 +2,8 @@ DOCKER_PACKAGE := github.com/dotcloud/docker
 RELEASE_VERSION := $(shell git tag | grep -E "v[0-9\.]+$$" | sort -nr | head -n 1)
 SRCRELEASE := docker-$(RELEASE_VERSION)
 BINRELEASE := docker-$(RELEASE_VERSION).tgz
+BUILD_SRC := build_src
+BUILD_PATH := ${BUILD_SRC}/src/${DOCKER_PACKAGE}
 
 GIT_ROOT := $(shell git rev-parse --show-toplevel)
 BUILD_DIR := $(CURDIR)/.gopath
@@ -71,8 +73,13 @@ else ifneq ($(DOCKER_DIR), $(realpath $(DOCKER_DIR)))
 	@rm -f $(DOCKER_DIR)
 endif
 
-test: all
-	@(cd $(DOCKER_DIR); sudo -E go test $(GO_OPTIONS))
+test:
+	# Copy docker source and dependencies for testing
+	rm -rf ${BUILD_SRC}; mkdir -p ${BUILD_PATH}
+	tar --exclude=${BUILD_SRC} -cz . | tar -xz -C ${BUILD_PATH}
+	GOPATH=${CURDIR}/${BUILD_SRC} go get -d
+	# Do the test
+	sudo -E GOPATH=${CURDIR}/${BUILD_SRC} go test ${GO_OPTIONS}
 
 testall: all
 	@(cd $(DOCKER_DIR); sudo -E go test ./... $(GO_OPTIONS))

+ 4 - 3
hack/README.rst

@@ -3,8 +3,8 @@ This directory contains material helpful for hacking on docker.
 make hack
 =========
 
-Set up an Ubuntu 13.04 virtual machine for developers including kernel 3.8
-and buildbot. The environment is setup in a way that can be used through
+Set up an Ubuntu 12.04 virtual machine for developers including kernel 3.8
+go1.1 and buildbot. The environment is setup in a way that can be used through
 the usual go workflow and/or the root Makefile. You can either edit on
 your host, or inside the VM (using make ssh-dev) and run and test docker
 inside the VM.
@@ -22,6 +22,7 @@ developers are inconvenienced by the failure.
 
 When running 'make hack' at the docker root directory, it spawns a virtual
 machine in the background running a buildbot instance and adds a git
-post-commit hook that automatically run docker tests for you.
+post-commit hook that automatically run docker tests for you each time you
+commit in your local docker repository.
 
 You can check your buildbot instance at http://192.168.33.21:8010/waterfall

+ 5 - 4
hack/Vagrantfile

@@ -2,7 +2,7 @@
 # vi: set ft=ruby :
 
 BOX_NAME = "ubuntu-dev"
-BOX_URI = "http://cloud-images.ubuntu.com/raring/current/raring-server-cloudimg-vagrant-amd64-disk1.box"
+BOX_URI = "http://files.vagrantup.com/precise64.box"
 VM_IP = "192.168.33.21"
 USER = "vagrant"
 GOPATH = "/data/docker"
@@ -21,14 +21,15 @@ Vagrant::Config.run do |config|
   # Touch for makefile
   pkg_cmd = "touch #{DOCKER_PATH}; "
   # Install docker dependencies
-  pkg_cmd << "export DEBIAN_FRONTEND=noninteractive; apt-get -qq update; " \
-    "apt-get install -q -y lxc git aufs-tools golang make linux-image-extra-`uname -r`; " \
+  pkg_cmd << "apt-get update -qq; apt-get install -y python-software-properties; " \
+    "add-apt-repository -y ppa:dotcloud/docker-golang/ubuntu; apt-get update -qq; " \
+    "apt-get install -y linux-image-generic-lts-raring lxc git aufs-tools golang-stable make; " \
     "chown -R #{USER}.#{USER} #{GOPATH}; " \
     "install -m 0664 #{CFG_PATH}/bash_profile /home/#{USER}/.bash_profile"
   config.vm.provision :shell, :inline => pkg_cmd
   # Deploy buildbot CI
   pkg_cmd = "apt-get install -q -y python-dev python-pip supervisor; " \
-    "pip install -r #{CFG_PATH}/requirements.txt; " \
+    "pip install -q -r #{CFG_PATH}/requirements.txt; " \
     "chown #{USER}.#{USER} /data; cd /data; " \
     "#{CFG_PATH}/setup.sh #{USER} #{GOPATH} #{DOCKER_PATH} #{CFG_PATH} #{BUILDBOT_PATH}"
   config.vm.provision :shell, :inline => pkg_cmd