aboutsummaryrefslogtreecommitdiff
path: root/tests/docker
AgeCommit message (Collapse)AuthorFilesLines
2016-09-08docker: build debootstrap after cloningSascha Silbe1-0/+1
When using the git version of debootstrap (because no usable version of debootstrap was installed on the host), we need to run 'make' so that devices.tar.gz gets built. Otherwise the first debootstrap stage will fail without printing any error message. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-8-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: make sure debootstrap is at least 1.0.67Sascha Silbe1-0/+10
debootstrap prior to 1.0.67 generated an empty sources.list during foreign bootstraps (Debian#732255 [1]). Fall back to the git checkout if the installed debootstrap version is too old. [1] https://bugs.debian.org/732255 Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-7-git-send-email-silbe@linux.vnet.ibm.com> [Update 'sort -C' to 'sorc -c &>/dev/null' - Fam] Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: print warning if EXECUTABLE is not set when building debootstrap imageSascha Silbe1-0/+3
Building the debian-debootstrap image will usually fail if EXECUTABLE isn't set (when using the Makefile). Warn the user in this case so they know why it's failing. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-6-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: debian-bootstrap.pre: print helpful message if DEB_ARCH/DEB_TYPE unsetSascha Silbe1-0/+13
The debian-bootstrap image doesn't choose a default architecture and distribution version, instead the user has to set both DEB_ARCH and DEB_TYPE in the environment. Print a reasonably helpful message if either of them isn't set instead of complaining about "qemu-" being missing or erroring out because we cannot cd to the mirror URL. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-5-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: debian-bootstrap.pre: print error messages to stderrSascha Silbe1-4/+4
Send error messages where they belong so they're seen even if stdout is redirected to /dev/null. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-4-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: avoid dependency on 'realpath' packageSascha Silbe1-1/+1
The 'realpath' executable is shipped in a separate package that isn't installed by default on some distros. We already use 'readlink -e' (provided by GNU coreutils) in some other part of the code, so let's settle for that instead. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-Id: <1473192351-601-3-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker.py: don't hang on large docker outputSascha Silbe1-3/+6
Unlike Popen.communicate(), subprocess.call() doesn't read from the stdout file descriptor. If the child process produces more output than fits into the pipe buffer, it will block indefinitely. If we don't intend to consume the output, just send it straight to /dev/null to avoid this issue. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.vnet.ibm.com> Message-Id: <1473192351-601-2-git-send-email-silbe@linux.vnet.ibm.com> Signed-off-by: Fam Zheng <famz@redhat.com>
2016-09-08docker: Add a glib2-2.22 imageFam Zheng1-0/+8
It's a variation of our existing centos6, plus two more lines to downgrade glib2 to version 2.22 which we download from vault.centos.org. Suggested-by: Paolo Bonzini <pbonzoni@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1470708908-12885-1-git-send-email-famz@redhat.com>
2016-08-05docker: Add "--enable-werror" to configure command lineFam Zheng1-0/+1
We don't have .git in the docker checkout, add this to enable -Werror explicitly. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1469453510-658-1-git-send-email-famz@redhat.com
2016-08-05docker: Be compatible with older dockerFam Zheng1-3/+2
By not using "--format" with docker images command. The option is not available on RHEL 7 docker command. Use an awk matching command instead. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <1470202928-3392-1-git-send-email-famz@redhat.com>
2016-07-20docker: pass EXECUTABLE to build scriptAlex Bennée1-1/+3
To build a docker image with which needs qemu linux-user emulation we need to pass --include-executable to the build script. Using the same mechanism as for other container controls we enable the option is EXECUTABLE is set on the make command line e.g: make docker-image-debian-bootstrap V=1 J=9 DEB_ARCH=armhf \ DEB_TYPE=stable EXECUTABLE=./arm-linux-user/qemu-arm Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-11-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-07-20docker: Don't start a container that doesn't existFam Zheng1-1/+5
Image building targets are dependencies of test running targets, so when a docker image doesn't exist, it means it's skipped (due to dependency checks in pre script). Therefore, skip the test too. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1468934445-32183-10-git-send-email-famz@redhat.com
2016-07-20docker: Add "images" subcommand to docker.pyFam Zheng1-0/+9
This is a wrapper for the 'docker images' command. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-9-git-send-email-famz@redhat.com
2016-07-20docker: Fix exit code if $CMD failedFam Zheng1-0/+4
Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1468934445-32183-8-git-send-email-famz@redhat.com
2016-07-20docker: More sensible run scriptFam Zheng2-6/+10
It is very easy to figure out current directory and bash option from the execution, so do less in the Makefile invocation command line, and figure both options in the script. This makes the next patch easier. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1468934445-32183-7-git-send-email-famz@redhat.com
2016-07-20tests/docker/docker.py: add update operationAlex Bennée1-1/+58
This adds a new operation to the docker script to allow updating of binaries in an existing container. This is because it would be inefficient to re-build the whole container just for an update to the QEMU binary. To update the executable run: ./tests/docker/docker.py update \ debian:armhf ./arm-linux-user/qemu-arm Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-6-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-07-20tests/docker/dockerfiles: new debian-bootstrap.dockerAlex Bennée2-0/+108
Together with the debian-bootstrap.pre script can now build an arbitrary architecture of Debian using debootstrap. This allows debootstrap to set up its first stage before the container is built. To build a container you need a command line like: DEB_ARCH=armhf DEB_TYPE=testing \ ./tests/docker/docker.py build \ --include-executable=arm-linux-user/qemu-arm debian:armhf \ ./tests/docker/dockerfiles/debian-bootstrap.docker Although a number of non-debian systems package the debootstrap script it is fairly portable in itself. Assuming we have some sort of fakeroot implementation we can just clone the upstream repository and use the script from there. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-5-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-07-20tests/docker/docker.py: check and run .pre scriptAlex Bennée1-0/+12
The docker script will now search for an associated $dockerfile.pre script which gets run in the same build context as the dockerfile will be. This is to support pre-seeding the build context before running the docker build. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-4-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-07-20tests/docker/docker.py: support --include-executableAlex Bennée1-0/+58
When passed the path to a binary we copy it and any linked libraries (if it is dynamically linked) into the docker build context. These can then be included by a dockerfile with the line: # Copy all of context into container ADD . / This is mainly intended for setting up foreign architecture docker images which use qemu-$arch to do cross-architecture linux-user execution. It also relies on the host and guest file-system following reasonable multi-arch layouts so the copied libraries don't clash with the guest ones. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1468934445-32183-3-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-07-20tests/docker/docker.py: docker_dir outside buildAlex Bennée1-8/+13
Instead of letting the build_image create the temporary working dir we move the creation to the build command. This is preparation for the later patches where additional files can be added to the build context before the build step is run. We also ensure we remove the build context after we are done (mkdtemp doesn't do this automatically for you). Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1468934445-32183-2-git-send-email-famz@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: build all targets in test-clangPaolo Bonzini1-2/+0
Warnings specific to clang may affect devices that are not build by x86_64-softmmu and aarch64-softmmu. Build all targets since that is also what Peter does. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-7-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: support travis test with fedora imagePaolo Bonzini1-2/+2
Install sparse and PyYAML. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-6-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: remove unused feature "ccache"Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-5-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: fix test-mingwPaolo Bonzini2-2/+2
Add flex and bison for use in test-mingw, because test-mingw uses the in-tree libdtc. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-4-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: make test-full build all targets, not nonePaolo Bonzini1-1/+1
Fix common.rc to avoid passing an empty --target-list= option to configure. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-3-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-08tests/docker: fix make-archive-maybePaolo Bonzini1-3/+3
make-archive-maybe expects an archive path relative to $1, but receives a path relative to the current directory. Redirect the output outside the subshell to bypass the "cd $1". Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1465224417-141321-2-git-send-email-pbonzini@redhat.com Signed-off-by: Fam Zheng <famz@redhat.com>
2016-06-07docker: Don't use eval trick on MakefileEduardo Habkost1-2/+1
The eval trick for defining DOCKER_SRC_COPY doesn't do anything useful, as DOCKER_SRC_COPY is immediately expanded just after it is defined, and CUR_TIME is already defined using ":=". Simply define it using ":=" so it is evaluated only once. The eval trick was also triggering an weird error on Travis builds: qemu/tests/docker/Makefile.include:34: *** unterminated variable reference. Stop. The issue is not easily reproducible (maybe it's a bug in some versions of Make), but it is avoided if removing the eval trick. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-06-01docker: Add EXTRA_CONFIGURE_OPTSFam Zheng2-0/+4
Whatever passed in this variable will be appended to all configure commands. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1464755128-32490-15-git-send-email-famz@redhat.com
2016-06-01docker: Add travis toolFam Zheng2-0/+69
The script is not prefixed with test- so it won't run with "make docker-test", because it can take too long. Run it with "make docker-travis@ubuntu". Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-13-git-send-email-famz@redhat.com
2016-06-01docker: Add mingw testFam Zheng1-0/+34
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-12-git-send-email-famz@redhat.com
2016-06-01docker: Add clang testFam Zheng1-0/+26
The (currently partially commented out) configure options are suggested by John Snow <jsnow@redhat.com>. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1464755128-32490-11-git-send-email-famz@redhat.com
2016-06-01docker: Add full testFam Zheng1-0/+17
This builds all available targets. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1464755128-32490-10-git-send-email-famz@redhat.com
2016-06-01docker: Add quick testFam Zheng1-0/+19
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-9-git-send-email-famz@redhat.com
2016-06-01docker: Add common.rcFam Zheng1-0/+31
"requires" checks the "FEATURE" environment for specified prerequisits, and skip the execution of test if not found. "build_qemu" is the central routine to compile QEMU for tests to call. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-8-git-send-email-famz@redhat.com
2016-06-01docker: Add test runnerFam Zheng1-0/+58
It's better to have a launcher for all tests, to make it easier to initialize and manage the environment. If "DEBUG=1" a shell prompt will show up before the test runs. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-7-git-send-email-famz@redhat.com
2016-06-01docker: Add imagesFam Zheng3-0/+24
Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-6-git-send-email-famz@redhat.com
2016-06-01Makefile: Rules for docker testingFam Zheng1-0/+123
This adds a group of make targets to run docker tests, all are available in source tree without running ./configure. The usage is shown with "make docker". Besides the fixed ones, dynamic targets for building each image and running each test in each image are generated automatically by make, scanning $(SRC_PATH)/tests/docker/ files with specific patterns. Alternative to manually list particular targets (docker-TEST@IMAGE) set, you can control which tests/images to run by filtering variables, TESTS= and IMAGES=, which are expressed in Makefile pattern syntax, "foo% %bar ...". For example: $ make docker-test IMAGES="ubuntu fedora" Unfortunately, it's impossible to propagate "-j $JOBS" into make in containers, however since each combination is made a first class target in the top Makefile, "make -j$N docker-test" still parallels the tests coarsely. Still, $J is made a magic variable to let all make invocations in containers to use -j$J. Instead of providing a live version of the source tree to the docker container we snapshot it with git-archive. This ensures the tree is in a pristine state for whatever operations the container is going to run on them. Uncommitted changes known to files known by the git index will be included in the snapshot if there are any. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1464755128-32490-5-git-send-email-famz@redhat.com
2016-06-01tests: Add utilities for docker testingFam Zheng1-0/+194
docker.py is added with a number of useful subcommands to manager docker images and instances for QEMU docker testing. Subcommands are: run: A wrapper of "docker run" (or "sudo -n docker run" if necessary), which takes care of killing and removing the running container at SIGINT. clean: Tear down all the containers including inactive ones that are started by docker_run. build: Compare an image from given dockerfile and rebuild it if they're different. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1464755128-32490-2-git-send-email-famz@redhat.com