Skip to contentSkip to conversation

docker: Build in a clean directory

PATCH In review Fam Zheng 3 participants 5 messages Sep 28, 2016 – Sep 29, 2016

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH 1/1 docker: Build in a clean directory

Currently we configure and build under "$QEMU_SRC/tests/docker" which is dubious, create a fixed directory (to be friendly to ccache) and change to there before calling build_qemu.

---
 tests/docker/common.rc  | 3 +++
 tests/docker/test-clang | 2 ++
 tests/docker/test-full  | 2 ++
 tests/docker/test-mingw | 2 ++
 tests/docker/test-quick | 2 ++
 5 files changed, 11 insertions(+)
tests/docker/common.rc +3 -0
index 510a3ad..21657e8 100755
@@ -11,6 +11,9 @@
 # or (at your option) any later version. See the COPYING file in
 # the top-level directory.
 
+BUILD_DIR=/var/tmp/qemu-build
+mkdir $BUILD_DIR
+
 requires()
 {
     for c in $@; do
tests/docker/test-clang +2 -0
index 60e4e97..16485e6 100755
@@ -15,6 +15,8 @@
 
 requires clang
 
+cd "$BUILD_DIR"
+
 OPTS="--enable-debug --cxx=clang++ --cc=clang --host-cc=clang"
 # -fsanitize=undefined is broken on Fedora 23, skip it for now
 # See also: https://bugzilla.redhat.com/show_bug.cgi?id=1263834
tests/docker/test-full +2 -0
index fd9b798..05f0d49 100755
@@ -13,5 +13,7 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 build_qemu
 make check $MAKEFLAGS
tests/docker/test-mingw +2 -0
index c03757a..3396876 100755
@@ -15,6 +15,8 @@
 
 requires mingw dtc
 
+cd "$BUILD_DIR"
+
 for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
     TARGET_LIST=x86_64-softmmu,aarch64-softmmu \
         build_qemu --cross-prefix=$prefix \
tests/docker/test-quick +2 -0
index 7885dfa..c465dc0 100755
@@ -13,6 +13,8 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu
Signature · 1 line
2.7.4
#1 lore raw
Quoted 2 lines · Fam Zheng

Currently we configure and build under "$QEMU_SRC/tests/docker" which is dubious, create a fixed directory (to be friendly to ccache) and change

Period instead of comma, to help the reader understand where the part describing the current state ends, and the part describing the change starts.

Quoted 3 lines

to there before calling build_qemu.

author
#2 lore raw
Quoted 8 lines · Markus Armbruster
Quoted 2 lines · Fam Zheng

Currently we configure and build under "$QEMU_SRC/tests/docker" which is dubious, create a fixed directory (to be friendly to ccache) and change

Period instead of comma, to help the reader understand where the part describing the current state ends, and the part describing the change starts.

Yes! Sorry for the confusion!

Fam

Quoted 4 lines
Quoted 4 lines

to there before calling build_qemu.

#3 lore raw
In reply to Fam Zheng
Quoted 18 lines · Fam Zheng

Currently we configure and build under "$QEMU_SRC/tests/docker" which is dubious, create a fixed directory (to be friendly to ccache) and change to there before calling build_qemu.

---
 tests/docker/common.rc  | 3 +++
 tests/docker/test-clang | 2 ++
 tests/docker/test-full  | 2 ++
 tests/docker/test-mingw | 2 ++
 tests/docker/test-quick | 2 ++
 5 files changed, 11 insertions(+)
tests/docker/common.rc +0 -0
index 510a3ad..21657e8 100755

tests/docker/common.rc line 15

Quoted 5 lines
tests/docker/common.rc +2 -0
@@ -11,6 +11,9 @@
 # or (at your option) any later version. See the COPYING file in
 # the top-level directory.
 
+BUILD_DIR=/var/tmp/qemu-build
+mkdir $BUILD_DIR

Is that safe on multi-user machines?

Also should we honour $TMPDIR if set?

Quoted 47 lines
tests/docker/common.rc +1 -0
+
 requires()
 {
     for c in $@; do
tests/docker/test-clang +2 -0
index 60e4e97..16485e6 100755
@@ -15,6 +15,8 @@
 
 requires clang
 
+cd "$BUILD_DIR"
+
 OPTS="--enable-debug --cxx=clang++ --cc=clang --host-cc=clang"
 # -fsanitize=undefined is broken on Fedora 23, skip it for now
 # See also: https://bugzilla.redhat.com/show_bug.cgi?id=1263834
tests/docker/test-full +2 -0
index fd9b798..05f0d49 100755
@@ -13,5 +13,7 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 build_qemu
 make check $MAKEFLAGS
tests/docker/test-mingw +2 -0
index c03757a..3396876 100755
@@ -15,6 +15,8 @@
 
 requires mingw dtc
 
+cd "$BUILD_DIR"
+
 for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
     TARGET_LIST=x86_64-softmmu,aarch64-softmmu \
         build_qemu --cross-prefix=$prefix \
tests/docker/test-quick +0 -0
index 7885dfa..c465dc0 100755

tests/docker/test-quick line 20

Quoted 8 lines
tests/docker/test-quick +2 -0
@@ -13,6 +13,8 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu

--
Alex Bennée

author
#4 lore raw
Quoted 24 lines · Alex Bennée
Quoted 21 lines · Fam Zheng

Currently we configure and build under "$QEMU_SRC/tests/docker" which is dubious, create a fixed directory (to be friendly to ccache) and change to there before calling build_qemu.

---
 tests/docker/common.rc  | 3 +++
 tests/docker/test-clang | 2 ++
 tests/docker/test-full  | 2 ++
 tests/docker/test-mingw | 2 ++
 tests/docker/test-quick | 2 ++
 5 files changed, 11 insertions(+)
tests/docker/common.rc +0 -0
index 510a3ad..21657e8 100755
@@ -11,6 +11,9 @@
 # or (at your option) any later version. See the COPYING file in
 # the top-level directory.
 
Quoted 6 lines

tests/docker/common.rc line 15

Quoted 2 lines
tests/docker/common.rc +2 -0
+BUILD_DIR=/var/tmp/qemu-build
+mkdir $BUILD_DIR

Is that safe on multi-user machines?

Also should we honour $TMPDIR if set?

It's not, but containers are not multi-user, at least not here in QEMU docker testing. We already use a fixed directory before this change, which is $QEMU_SRC/tests/docker, so this patch is not making it worse.

And we know $TMPDIR is not set, too.

Fam

Quoted 60 lines
Quoted 48 lines
tests/docker/common.rc +1 -0
+
 requires()
 {
     for c in $@; do
tests/docker/test-clang +2 -0
index 60e4e97..16485e6 100755
@@ -15,6 +15,8 @@
 
 requires clang
 
+cd "$BUILD_DIR"
+
 OPTS="--enable-debug --cxx=clang++ --cc=clang --host-cc=clang"
 # -fsanitize=undefined is broken on Fedora 23, skip it for now
 # See also: https://bugzilla.redhat.com/show_bug.cgi?id=1263834
tests/docker/test-full +2 -0
index fd9b798..05f0d49 100755
@@ -13,5 +13,7 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 build_qemu
 make check $MAKEFLAGS
tests/docker/test-mingw +2 -0
index c03757a..3396876 100755
@@ -15,6 +15,8 @@
 
 requires mingw dtc
 
+cd "$BUILD_DIR"
+
 for prefix in x86_64-w64-mingw32- i686-w64-mingw32-; do
     TARGET_LIST=x86_64-softmmu,aarch64-softmmu \
         build_qemu --cross-prefix=$prefix \
tests/docker/test-quick +0 -0
index 7885dfa..c465dc0 100755

tests/docker/test-quick line 20

Quoted 8 lines
tests/docker/test-quick +2 -0
@@ -13,6 +13,8 @@
 
 . common.rc
 
+cd "$BUILD_DIR"
+
 DEF_TARGET_LIST="x86_64-softmmu,aarch64-softmmu"
 TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
 build_qemu

--
Alex Bennée