All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH  v1 00/26] testing/next queue (iotests, docker, tests/vm)
@ 2019-05-30 10:15 Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts Alex Bennée
                   ` (25 more replies)
  0 siblings, 26 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée


Hi,

I've been playing catch-up with the testing patches so here is the
next set of patches for testing/next. It includes the enabling of
check-block which I dropped from my last PR due to a last minute div0
found by Peter during merging. I've added a clang undefined
behaviour job to Travis to catch this in future as well as bumped the
GCC TSan build to gcc-9. This still has stringop truncation turned
off as we still have build failures. I've updated the Ubuntu image to
the latest ubuntu for those that want to build with the latest
compilers to fix all this.

The bulk of the series includes Wainer's tests/vm clean-ups and Gerd's
work on autoinstall for the BSD's so we no longer have to rely on
magic images stored in our "infrastructure". I did drop the
caching/checksum patch as it clashed with the new approach Gerd has
taken.

I've not got Philippe's work on enabling caching to speed up Travis
but I'm looking forward to it because it looks like it makes a fair
difference.

The following patches need review
 patch 0001/editorconfig add setting for shell scripts.patch
 patch 0002/qemu io cmds use clock_gettime for benchmarking.patch
 patch 0005/tests docker Update the Fedora cross compile imag.patch
 patch 0006/tests docker Update the Ubuntu image to 19.04.patch
 patch 0007/.travis.yml bump gcc sanitiser job to gcc 9.patch
 patch 0008/.travis.yml add clang ubsan job.patch

Alex Bennée (6):
  editorconfig: add setting for shell scripts
  qemu-io-cmds: use clock_gettime for benchmarking
  tests/docker: Update the Fedora cross compile images to 30
  tests/docker: Update the Ubuntu image to 19.04
  .travis.yml: bump gcc sanitiser job to gcc-9
  .travis.yml: add clang ubsan job

Gerd Hoffmann (14):
  scripts: use git archive in archive-source
  tests/vm: python3 fixes
  tests/vm: send proxy environment variables over ssh
  tests/vm: use ssh with pty unconditionally
  tests/vm: run test builds on snapshot
  tests/vm: proper guest shutdown
  tests/vm: add vm-boot-{ssh,serial}-<guest> targets
  tests/vm: add DEBUG=1 to help text
  tests/vm: serial console support helpers
  tests/vm: openbsd autoinstall, using serial console
  tests/vm: freebsd autoinstall, using serial console
  tests/vm: netbsd autoinstall, using serial console
  tests/vm: fedora autoinstall, using serial console
  tests/vm: ubuntu.i386: apt proxy setup

Philippe Mathieu-Daudé (1):
  tests/docker: Update the Fedora image to Fedora 30

Thomas Huth (1):
  tests: Run the iotests during "make check" again

Wainer dos Santos Moschetta (4):
  tests/vm: Use python configured on build
  tests/vm: Port basevm to Python 3
  tests/vm: Fix build-centos docker-based tests run
  tests/vm: Add missing variables on help

 .editorconfig                                 |   4 +
 .travis.yml                                   |  17 +-
 qemu-io-cmds.c                                |  69 +++----
 scripts/archive-source.sh                     |  72 +++----
 tests/Makefile.include                        |   8 +-
 tests/check-block.sh                          |  44 ++++-
 .../dockerfiles/fedora-cris-cross.docker      |   2 +-
 .../dockerfiles/fedora-i386-cross.docker      |   2 +-
 tests/docker/dockerfiles/fedora.docker        |   2 +-
 tests/docker/dockerfiles/ubuntu.docker        |  19 +-
 tests/qemu-iotests-quick.sh                   |   8 -
 tests/vm/Makefile.include                     |  37 +++-
 tests/vm/basevm.py                            | 147 +++++++++++---
 tests/vm/centos                               |   6 +-
 tests/vm/fedora                               | 187 ++++++++++++++++++
 tests/vm/freebsd                              | 179 ++++++++++++++++-
 tests/vm/netbsd                               | 187 +++++++++++++++++-
 tests/vm/openbsd                              | 158 +++++++++++++--
 tests/vm/ubuntu.i386                          |   4 +
 19 files changed, 977 insertions(+), 175 deletions(-)
 delete mode 100755 tests/qemu-iotests-quick.sh
 create mode 100755 tests/vm/fedora

-- 
2.20.1



^ permalink raw reply	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 18:15   ` Richard Henderson
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking Alex Bennée
                   ` (24 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .editorconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.editorconfig b/.editorconfig
index df6db65531d..a001f340bd8 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -26,6 +26,10 @@ file_type_emacs = makefile
 indent_style = space
 indent_size = 4
 
+[*.sh]
+indent_style = space
+indent_size = 4
+
 [*.{s,S}]
 indent_style = tab
 indent_size = 8
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 18:41   ` Richard Henderson
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again Alex Bennée
                   ` (23 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Alex Bennée, open list:Block layer core, Max Reitz

The previous use of gettimeofday() ran into undefined behaviour when
we ended up doing a div 0 for a very short operation. This is because
gettimeofday only works at the microsecond level as well as being
prone to discontinuous jumps in system time. Using clock_gettime with
CLOCK_MONOTONIC gives greater precision and alleviates some of the
potential problems with time jumping around.

We could use CLOCK_MONOTONIC_RAW to avoid being tripped up by NTP and
adjtime but that is Linux specific so I decided it would do for now.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 qemu-io-cmds.c | 69 +++++++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 34 deletions(-)

diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 30a7d9a13bf..f6701e3b8a8 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -248,20 +248,21 @@ static void cvtstr(double value, char *str, size_t size)
 
 
 
-static struct timeval tsub(struct timeval t1, struct timeval t2)
+static struct timespec tsub(struct timespec t1, struct timespec t2)
 {
-    t1.tv_usec -= t2.tv_usec;
-    if (t1.tv_usec < 0) {
-        t1.tv_usec += 1000000;
+    t1.tv_nsec -= t2.tv_nsec;
+    if (t1.tv_nsec < 0) {
+        t1.tv_nsec += 1000000000;
         t1.tv_sec--;
     }
     t1.tv_sec -= t2.tv_sec;
     return t1;
 }
 
-static double tdiv(double value, struct timeval tv)
+static double tdiv(double value, struct timespec tv)
 {
-    return value / ((double)tv.tv_sec + ((double)tv.tv_usec / 1000000.0));
+    double time = (double)tv.tv_sec + ((double)tv.tv_nsec / 1000000000.0);
+    return value / time;
 }
 
 #define HOURS(sec)      ((sec) / (60 * 60))
@@ -274,16 +275,16 @@ enum {
     VERBOSE_FIXED_TIME  = 0x2,
 };
 
-static void timestr(struct timeval *tv, char *ts, size_t size, int format)
+static void timestr(struct timespec *tv, char *ts, size_t size, int format)
 {
-    double usec = (double)tv->tv_usec / 1000000.0;
+    double nsec = (double)tv->tv_nsec / 1000000000.0;
 
     if (format & TERSE_FIXED_TIME) {
         if (!HOURS(tv->tv_sec)) {
             snprintf(ts, size, "%u:%02u.%02u",
                     (unsigned int) MINUTES(tv->tv_sec),
                     (unsigned int) SECONDS(tv->tv_sec),
-                    (unsigned int) (usec * 100));
+                    (unsigned int) (nsec * 100000));
             return;
         }
         format |= VERBOSE_FIXED_TIME; /* fallback if hours needed */
@@ -294,9 +295,9 @@ static void timestr(struct timeval *tv, char *ts, size_t size, int format)
                 (unsigned int) HOURS(tv->tv_sec),
                 (unsigned int) MINUTES(tv->tv_sec),
                 (unsigned int) SECONDS(tv->tv_sec),
-                (unsigned int) (usec * 100));
+                (unsigned int) (nsec * 100000));
     } else {
-        snprintf(ts, size, "0.%04u sec", (unsigned int) (usec * 10000));
+        snprintf(ts, size, "0.%04u sec", (unsigned int) (nsec * 10000000));
     }
 }
 
@@ -376,7 +377,7 @@ static void dump_buffer(const void *buffer, int64_t offset, int64_t len)
     }
 }
 
-static void print_report(const char *op, struct timeval *t, int64_t offset,
+static void print_report(const char *op, struct timespec *t, int64_t offset,
                          int64_t count, int64_t total, int cnt, bool Cflag)
 {
     char s1[64], s2[64], ts[64];
@@ -649,7 +650,7 @@ static const cmdinfo_t read_cmd = {
 
 static int read_f(BlockBackend *blk, int argc, char **argv)
 {
-    struct timeval t1, t2;
+    struct timespec t1, t2;
     bool Cflag = false, qflag = false, vflag = false;
     bool Pflag = false, sflag = false, lflag = false, bflag = false;
     int c, cnt, ret;
@@ -758,13 +759,13 @@ static int read_f(BlockBackend *blk, int argc, char **argv)
 
     buf = qemu_io_alloc(blk, count, 0xab);
 
-    gettimeofday(&t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t1);
     if (bflag) {
         ret = do_load_vmstate(blk, buf, offset, count, &total);
     } else {
         ret = do_pread(blk, buf, offset, count, &total);
     }
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("read failed: %s\n", strerror(-ret));
@@ -836,7 +837,7 @@ static const cmdinfo_t readv_cmd = {
 
 static int readv_f(BlockBackend *blk, int argc, char **argv)
 {
-    struct timeval t1, t2;
+    struct timespec t1, t2;
     bool Cflag = false, qflag = false, vflag = false;
     int c, cnt, ret;
     char *buf;
@@ -891,9 +892,9 @@ static int readv_f(BlockBackend *blk, int argc, char **argv)
         return -EINVAL;
     }
 
-    gettimeofday(&t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t1);
     ret = do_aio_readv(blk, &qiov, offset, &total);
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("readv failed: %s\n", strerror(-ret));
@@ -972,7 +973,7 @@ static const cmdinfo_t write_cmd = {
 
 static int write_f(BlockBackend *blk, int argc, char **argv)
 {
-    struct timeval t1, t2;
+    struct timespec t1, t2;
     bool Cflag = false, qflag = false, bflag = false;
     bool Pflag = false, zflag = false, cflag = false;
     int flags = 0;
@@ -1091,7 +1092,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
         buf = qemu_io_alloc(blk, count, pattern);
     }
 
-    gettimeofday(&t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t1);
     if (bflag) {
         ret = do_save_vmstate(blk, buf, offset, count, &total);
     } else if (zflag) {
@@ -1101,7 +1102,7 @@ static int write_f(BlockBackend *blk, int argc, char **argv)
     } else {
         ret = do_pwrite(blk, buf, offset, count, flags, &total);
     }
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("write failed: %s\n", strerror(-ret));
@@ -1160,7 +1161,7 @@ static const cmdinfo_t writev_cmd = {
 
 static int writev_f(BlockBackend *blk, int argc, char **argv)
 {
-    struct timeval t1, t2;
+    struct timespec t1, t2;
     bool Cflag = false, qflag = false;
     int flags = 0;
     int c, cnt, ret;
@@ -1213,9 +1214,9 @@ static int writev_f(BlockBackend *blk, int argc, char **argv)
         return -EINVAL;
     }
 
-    gettimeofday(&t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t1);
     ret = do_aio_writev(blk, &qiov, offset, flags, &total);
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("writev failed: %s\n", strerror(-ret));
@@ -1250,15 +1251,15 @@ struct aio_ctx {
     bool zflag;
     BlockAcctCookie acct;
     int pattern;
-    struct timeval t1;
+    struct timespec t1;
 };
 
 static void aio_write_done(void *opaque, int ret)
 {
     struct aio_ctx *ctx = opaque;
-    struct timeval t2;
+    struct timespec t2;
 
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
 
     if (ret < 0) {
@@ -1288,9 +1289,9 @@ out:
 static void aio_read_done(void *opaque, int ret)
 {
     struct aio_ctx *ctx = opaque;
-    struct timeval t2;
+    struct timespec t2;
 
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("readv failed: %s\n", strerror(-ret));
@@ -1425,7 +1426,7 @@ static int aio_read_f(BlockBackend *blk, int argc, char **argv)
         return -EINVAL;
     }
 
-    gettimeofday(&ctx->t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &ctx->t1);
     block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size,
                      BLOCK_ACCT_READ);
     blk_aio_preadv(blk, ctx->offset, &ctx->qiov, 0, aio_read_done, ctx);
@@ -1570,7 +1571,7 @@ static int aio_write_f(BlockBackend *blk, int argc, char **argv)
             return -EINVAL;
         }
 
-        gettimeofday(&ctx->t1, NULL);
+        clock_gettime(CLOCK_MONOTONIC, &ctx->t1);
         block_acct_start(blk_get_stats(blk), &ctx->acct, ctx->qiov.size,
                          BLOCK_ACCT_WRITE);
 
@@ -1746,7 +1747,7 @@ static const cmdinfo_t discard_cmd = {
 
 static int discard_f(BlockBackend *blk, int argc, char **argv)
 {
-    struct timeval t1, t2;
+    struct timespec t1, t2;
     bool Cflag = false, qflag = false;
     int c, ret;
     int64_t offset, bytes;
@@ -1787,9 +1788,9 @@ static int discard_f(BlockBackend *blk, int argc, char **argv)
         return -EINVAL;
     }
 
-    gettimeofday(&t1, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t1);
     ret = blk_pdiscard(blk, offset, bytes);
-    gettimeofday(&t2, NULL);
+    clock_gettime(CLOCK_MONOTONIC, &t2);
 
     if (ret < 0) {
         printf("discard failed: %s\n", strerror(-ret));
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-06-07  9:33   ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 04/26] tests/docker: Update the Fedora image to Fedora 30 Alex Bennée
                   ` (22 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée

From: Thomas Huth <thuth@redhat.com>

People often forget to run the iotests before submitting patches or
pull requests - this is likely due to the fact that we do not run the
tests during our mandatory "make check" tests yet. Now that we've got
a proper "auto" group of iotests that should be fine to run in every
environment, we can enable the iotests during "make check" again by
running the "auto" tests by default from the check-block.sh script.

Some cases still need to be checked first, though: iotests need bash
and GNU sed (otherwise they fail), and if gprof is enabled, it spoils
the output of some test cases causing them to fail. So if we detect
that one of the required programs is missing or that gprof is enabled,
we still have to skip the iotests to avoid failures.

And finally, since we are using check-block.sh now again, this patch also
removes the qemu-iotests-quick.sh script since we do not need that anymore
(and having two shell wrapper scripts around the block tests seem
rather confusing than helpful).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190502084506.8009-8-thuth@redhat.com>
[AJB: -makecheck to check-block.sh, move check-block to start&gate it]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/Makefile.include      |  8 +++----
 tests/check-block.sh        | 44 ++++++++++++++++++++++++++++---------
 tests/qemu-iotests-quick.sh |  8 -------
 3 files changed, 38 insertions(+), 22 deletions(-)
 delete mode 100755 tests/qemu-iotests-quick.sh

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 1865f6b3222..0c6d8c75941 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -140,7 +140,7 @@ check-unit-y += tests/test-uuid$(EXESUF)
 check-unit-y += tests/ptimer-test$(EXESUF)
 check-unit-y += tests/test-qapi-util$(EXESUF)
 
-check-block-$(CONFIG_POSIX) += tests/qemu-iotests-quick.sh
+check-block-$(call land,$(CONFIG_POSIX),$(CONFIG_SOFTMMU)) += tests/check-block.sh
 
 # All QTests for now are POSIX-only, but the dependencies are
 # really in libqtest, not in the testcases themselves.
@@ -1077,8 +1077,8 @@ clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 
 QEMU_IOTESTS_HELPERS-$(call land,$(CONFIG_SOFTMMU),$(CONFIG_LINUX)) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
 
-.PHONY: check-tests/qemu-iotests-quick.sh
-check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
+.PHONY: check-tests/check-block.sh
+check-tests/check-block.sh: tests/check-block.sh qemu-img$(EXESUF) qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
 	$<
 
 .PHONY: $(patsubst %, check-%, $(check-qapi-schema-y))
@@ -1152,7 +1152,7 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR)
 check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y)) check-tests/qapi-schema/doc-good.texi
 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
 check-block: $(patsubst %,check-%, $(check-block-y))
-check: check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
+check: check-block check-qapi-schema check-unit check-softfloat check-qtest check-decodetree
 check-clean:
 	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
 	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
diff --git a/tests/check-block.sh b/tests/check-block.sh
index f3d12fd602d..c8b6cec3f68 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -1,24 +1,48 @@
 #!/bin/sh
 
-FORMAT_LIST="raw qcow2 qed vmdk vpc"
+# Honor the SPEED environment variable, just like we do it for the qtests.
+if [ "$SPEED" = "slow" ]; then
+    format_list="raw qcow2"
+    group=
+elif [ "$SPEED" = "thorough" ]; then
+    format_list="raw qcow2 qed vmdk vpc"
+    group=
+else
+    format_list=qcow2
+    group="-g auto"
+fi
+
 if [ "$#" -ne 0 ]; then
-    FORMAT_LIST="$@"
+    format_list="$@"
+fi
+
+if grep -q "TARGET_GPROF=y" *-softmmu/config-target.mak 2>/dev/null ; then
+    echo "GPROF is enabled ==> Not running the qemu-iotests."
+    exit 0
 fi
 
-export QEMU_PROG="$PWD/x86_64-softmmu/qemu-system-x86_64"
-export QEMU_IMG_PROG="$PWD/qemu-img"
-export QEMU_IO_PROG="$PWD/qemu-io"
+if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then
+    echo "No qemu-system binary available ==> Not running the qemu-iotests."
+    exit 0
+fi
+
+if ! command -v bash >/dev/null 2>&1 ; then
+    echo "bash not available ==> Not running the qemu-iotests."
+    exit 0
+fi
 
-if [ ! -x $QEMU_PROG ]; then
-    echo "'make check-block' requires qemu-system-x86_64"
-    exit 1
+if ! (sed --version | grep 'GNU sed') > /dev/null 2>&1 ; then
+    if ! command -v gsed >/dev/null 2>&1; then
+        echo "GNU sed not available ==> Not running the qemu-iotests."
+        exit 0
+    fi
 fi
 
 cd tests/qemu-iotests
 
 ret=0
-for FMT in $FORMAT_LIST ; do
-    ./check -T -nocache -$FMT || ret=1
+for fmt in $format_list ; do
+    ./check -makecheck -$fmt $group || ret=1
 done
 
 exit $ret
diff --git a/tests/qemu-iotests-quick.sh b/tests/qemu-iotests-quick.sh
deleted file mode 100755
index 0e554bb9724..00000000000
--- a/tests/qemu-iotests-quick.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-cd tests/qemu-iotests
-
-ret=0
-TEST_DIR=${TEST_DIR:-/tmp/qemu-iotests-quick-$$} ./check -T -qcow2 -g quick || ret=1
-
-exit $ret
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 04/26] tests/docker: Update the Fedora image to Fedora 30
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (2 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30 Alex Bennée
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Marc-André Lureau, Fam Zheng,
	Philippe Mathieu-Daudé,
	Stefano Garzarella

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Fedora 30 got released:

  https://fedoramagazine.org/announcing-fedora-30/

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-Id: <20190528153304.27157-1-philmd@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/fedora.docker | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker
index afbba29adaa..12c460597ed 100644
--- a/tests/docker/dockerfiles/fedora.docker
+++ b/tests/docker/dockerfiles/fedora.docker
@@ -1,4 +1,4 @@
-FROM fedora:29
+FROM fedora:30
 ENV PACKAGES \
     bc \
     bison \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (3 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 04/26] tests/docker: Update the Fedora image to Fedora 30 Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 18:43   ` Richard Henderson
  2019-05-31  6:54   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04 Alex Bennée
                   ` (20 subsequent siblings)
  25 siblings, 2 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé, Alex Bennée

While at it remove the bogus :latest tag for cris cross compiler. It
tends to break caching and cause confusion.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/fedora-cris-cross.docker | 2 +-
 tests/docker/dockerfiles/fedora-i386-cross.docker | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/docker/dockerfiles/fedora-cris-cross.docker b/tests/docker/dockerfiles/fedora-cris-cross.docker
index b168ada615a..09e7e449f9b 100644
--- a/tests/docker/dockerfiles/fedora-cris-cross.docker
+++ b/tests/docker/dockerfiles/fedora-cris-cross.docker
@@ -2,7 +2,7 @@
 # Cross compiler for cris system tests
 #
 
-FROM fedora:latest
+FROM fedora:30
 ENV PACKAGES gcc-cris-linux-gnu
 RUN dnf install -y $PACKAGES
 RUN rpm -q $PACKAGES | sort > /packages.txt
diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker
index eb8108d1185..9106cf9ebed 100644
--- a/tests/docker/dockerfiles/fedora-i386-cross.docker
+++ b/tests/docker/dockerfiles/fedora-i386-cross.docker
@@ -1,4 +1,4 @@
-FROM fedora:29
+FROM fedora:30
 ENV PACKAGES \
     gcc \
     glib2-devel.i686 \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (4 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30 Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 18:44   ` Richard Henderson
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9 Alex Bennée
                   ` (19 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé, Alex Bennée

This has aged a little and we have a separate LTS image for testing on
the older distros. Update it to a more recent release like its Fedora
cousin.

Besides it is useful to have something with gcc-9 on it for squashing
those stringop truncation errors.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/ubuntu.docker | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/tests/docker/dockerfiles/ubuntu.docker b/tests/docker/dockerfiles/ubuntu.docker
index 36e2b17de59..8d256961f06 100644
--- a/tests/docker/dockerfiles/ubuntu.docker
+++ b/tests/docker/dockerfiles/ubuntu.docker
@@ -1,6 +1,15 @@
-FROM ubuntu:16.04
-RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty universe multiverse" >> \
-    /etc/apt/sources.list
+#
+# Latest Ubuntu Release
+#
+# Useful for testing against relatively bleeding edge libraries and
+# compilers. We also have seperate recipe for the most recent LTS
+# release.
+#
+# When updating use the full tag not :latest otherwise the build
+# system won't pick up that it has changed.
+#
+
+FROM ubuntu:19.04
 ENV PACKAGES flex bison \
     ccache \
     clang \
@@ -21,7 +30,7 @@ ENV PACKAGES flex bison \
     libepoxy-dev \
     libfdt-dev \
     libgbm-dev \
-    libgnutls-dev \
+    libgnutls28-dev \
     libgtk-3-dev \
     libibverbs-dev \
     libiscsi-dev \
@@ -34,7 +43,7 @@ ENV PACKAGES flex bison \
     libnss3-dev \
     libnuma-dev \
     libpixman-1-dev \
-    libpng12-dev \
+    libpng-dev \
     librados-dev \
     librbd-dev \
     librdmacm-dev \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (5 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04 Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  7:56   ` Stefano Garzarella
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job Alex Bennée
                   ` (18 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé, Alex Bennée

The toolchain PPA has it so we might as well use it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .travis.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index b053a836a32..f0aa37f2d12 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -240,8 +240,8 @@ matrix:
             - ubuntu-toolchain-r-test
           packages:
             # Extra toolchains
-            - gcc-7
-            - g++-7
+            - gcc-9
+            - g++-9
             # Build dependencies
             - libaio-dev
             - libattr1-dev
@@ -270,11 +270,11 @@ matrix:
       language: generic
       compiler: none
       env:
-        - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7
-        - CONFIG="--cc=gcc-7 --cxx=g++-7 --disable-pie --disable-linux-user"
+        - COMPILER_NAME=gcc CXX=g++-9 CC=gcc-9
+        - CONFIG="--cc=gcc-9 --cxx=g++-9 --disable-pie --disable-linux-user"
         - TEST_CMD=""
       before_script:
-        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
+        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -Wno-error=stringop-truncation -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
 
 
     # Run check-tcg against linux-user
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 08/26] .travis.yml: add clang ubsan job
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (6 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9 Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  6:21   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build Alex Bennée
                   ` (17 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé, Alex Bennée

We document this on our wiki and we might as well catch it in our CI
rather than waiting for it to be picked up on merge:

  https://wiki.qemu.org/Testing#clang_UBSan

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .travis.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.travis.yml b/.travis.yml
index f0aa37f2d12..2f1658602ed 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -152,6 +152,13 @@ matrix:
       compiler: clang
 
 
+    - env:
+        - CONFIG="--target-list=${MAIN_SOFTMMU_TARGETS} "
+      compiler: clang
+      before_script:
+        - ./configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log && exit 1; }
+
+
     - env:
         - CONFIG="--disable-user --target-list-exclude=${MAIN_SOFTMMU_TARGETS}"
       compiler: clang
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (7 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  6:22   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3 Alex Bennée
                   ` (16 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Alex Bennée, Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

Changed the vm-test makefile to execute python scripts
with the interpreter configured on build. This allows to
run vm-test targets properly in Linux distros with Python 3
only support.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-2-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 992d823f6bd..6f82676306d 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -35,7 +35,7 @@ $(IMAGES_DIR)/%.img:	$(SRC_PATH)/tests/vm/% \
 			$(SRC_PATH)/tests/vm/Makefile.include
 	@mkdir -p $(IMAGES_DIR)
 	$(call quiet-command, \
-		$< \
+		$(PYTHON) $< \
 		$(if $(V)$(DEBUG), --debug) \
 		--image "$@" \
 		--force \
@@ -46,7 +46,7 @@ $(IMAGES_DIR)/%.img:	$(SRC_PATH)/tests/vm/% \
 # Build in VM $(IMAGE)
 vm-build-%: $(IMAGES_DIR)/%.img
 	$(call quiet-command, \
-		$(SRC_PATH)/tests/vm/$* \
+		$(PYTHON) $(SRC_PATH)/tests/vm/$* \
 		$(if $(V)$(DEBUG), --debug) \
 		$(if $(DEBUG), --interactive) \
 		$(if $(J),--jobs $(J)) \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 10/26] tests/vm: Port basevm to Python 3
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (8 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  6:22   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run Alex Bennée
                   ` (15 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

Fixed tests/vm/basevm.py to run with Python 3:
 - hashlib.sha1() requires an binary encoded object.
 - uses floor division ("//") (PEP 238).
 - decode bytes to unicode when needed.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190329210804.22121-3-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/basevm.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 0556bdcf9e9..083befce9f5 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -85,12 +85,12 @@ class BaseVM(object):
             if not sha256sum:
                 return True
             checksum = subprocess.check_output(["sha256sum", fname]).split()[0]
-            return sha256sum == checksum
+            return sha256sum == checksum.decode()
 
         cache_dir = os.path.expanduser("~/.cache/qemu-vm/download")
         if not os.path.exists(cache_dir):
             os.makedirs(cache_dir)
-        fname = os.path.join(cache_dir, hashlib.sha1(url).hexdigest())
+        fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest())
         if os.path.exists(fname) and check_sha256sum(fname):
             return fname
         logging.debug("Downloading %s to %s...", url, fname)
@@ -134,7 +134,7 @@ class BaseVM(object):
         raise NotImplementedError
 
     def add_source_dir(self, src_dir):
-        name = "data-" + hashlib.sha1(src_dir).hexdigest()[:5]
+        name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5]
         tarfile = os.path.join(self._tmpdir, name + ".tar")
         logging.debug("Creating archive %s for src_dir dir: %s", tarfile, src_dir)
         subprocess.check_call(["./scripts/archive-source.sh", tarfile],
@@ -204,7 +204,7 @@ def parse_args(vmcls):
 
     def get_default_jobs():
         if kvm_available(vmcls.arch):
-            return multiprocessing.cpu_count() / 2
+            return multiprocessing.cpu_count() // 2
         else:
             return 1
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (9 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3 Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help Alex Bennée
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Alex Bennée, Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

`make vm-build-centos` run docker-based tests on CentOS. The
created containers should have network otherwise some tests
fail. Also fixed the BUILD_SCRIPT template to correctly
evaluate "V=1" for verbose output.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-5-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/centos | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/vm/centos b/tests/vm/centos
index ba133ea429a..7417b50af4a 100755
--- a/tests/vm/centos
+++ b/tests/vm/centos
@@ -26,9 +26,9 @@ class CentosVM(basevm.BaseVM):
         export SRC_ARCHIVE=/dev/vdb;
         sudo chmod a+r $SRC_ARCHIVE;
         tar -xf $SRC_ARCHIVE;
-        make docker-test-block@centos7 V={verbose} J={jobs};
-        make docker-test-quick@centos7 V={verbose} J={jobs};
-        make docker-test-mingw@fedora V={verbose} J={jobs};
+        make docker-test-block@centos7 {verbose} J={jobs} NETWORK=1;
+        make docker-test-quick@centos7 {verbose} J={jobs} NETWORK=1;
+        make docker-test-mingw@fedora  {verbose} J={jobs} NETWORK=1;
     """
 
     def _gen_cloud_init_iso(self):
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (10 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  6:45   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source Alex Bennée
                   ` (13 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Alex Bennée, Wainer dos Santos Moschetta

From: Wainer dos Santos Moschetta <wainersm@redhat.com>

Added description of variables missing on vm-test help.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20190329210804.22121-6-wainersm@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 6f82676306d..c59411bee01 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -21,9 +21,13 @@ vm-test:
 	@echo "  vm-clean-all                    - Clean up VM images"
 	@echo
 	@echo "Special variables:"
-	@echo "    BUILD_TARGET=foo		 - override the build target"
-	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds."
+	@echo "    BUILD_TARGET=foo		 - Override the build target"
+	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
 	@echo '    EXTRA_CONFIGURE_OPTS="..."'
+	@echo "    J=[0..9]*            	 - Override the -jN parameter for make commands"
+	@echo "    DEBUG=1              	 - Enable verbose output on host and interactive debugging"
+	@echo "    V=1				 - Enable verbose ouput on host and guest commands"
+	@echo "    QEMU=/path/to/qemu		 - Change path to QEMU binary"
 
 vm-build-all: $(addprefix vm-build-, $(IMAGES))
 
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (11 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes Alex Bennée
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Use git archive to create tarballs of qemu and submodules instead of
cloning the repository and the submodules.  This is a order of magnitude
faster because it doesn't fetch the submodules from the internet each
time the script runs.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-2-kraxel@redhat.com>
[AJB: fixed up tabs]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 scripts/archive-source.sh | 72 +++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 41 deletions(-)

diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 8b899482600..ca94e49978f 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -19,16 +19,25 @@ if test $# -lt 1; then
 fi
 
 tar_file=$(realpath "$1")
-list_file="${tar_file}.list"
-vroot_dir="${tar_file}.vroot"
+sub_tdir=$(mktemp -d "${tar_file%.tar}.sub.XXXXXXXX")
+sub_file="${sub_tdir}/submodule.tar"
 
 # We want a predictable list of submodules for builds, that is
 # independent of what the developer currently has initialized
 # in their checkout, because the build environment is completely
 # different to the host OS.
 submodules="dtc slirp ui/keycodemapdb tests/fp/berkeley-softfloat-3 tests/fp/berkeley-testfloat-3"
+sub_deinit=""
 
-trap "status=$?; rm -rf \"$list_file\" \"$vroot_dir\"; exit \$status" 0 1 2 3 15
+function cleanup() {
+    local status=$?
+    rm -rf "$sub_tdir"
+    if test "$sub_deinit" != ""; then
+        git submodule deinit $sub_deinit
+    fi
+    exit $status
+}
+trap "cleanup" 0 1 2 3 15
 
 if git diff-index --quiet HEAD -- &>/dev/null
 then
@@ -36,45 +45,26 @@ then
 else
     HEAD=$(git stash create)
 fi
-git clone --shared . "$vroot_dir"
-test $? -ne 0 && error "failed to clone into '$vroot_dir'"
-for sm in $submodules; do
-    if test -d "$sm/.git"
-    then
-       git clone --shared "$sm" "$vroot_dir/$sm"
-       test $? -ne 0 && error "failed to clone submodule $sm"
-    fi
-done
-
-cd "$vroot_dir"
-test $? -ne 0 && error "failed to change into '$vroot_dir'"
-
-git checkout $HEAD
-test $? -ne 0 && error "failed to checkout $HEAD revision"
 
+git archive --format tar $HEAD > "$tar_file"
+test $? -ne 0 && error "failed to archive qemu"
 for sm in $submodules; do
-    git submodule update --init $sm
-    test $? -ne 0 && error "failed to init submodule $sm"
+    status="$(git submodule status "$sm")"
+    smhash="${status#[ +-]}"
+    smhash="${smhash%% *}"
+    case "$status" in
+        -*)
+            sub_deinit="$sub_deinit $sm"
+            git submodule update --init "$sm"
+            test $? -ne 0 && error "failed to update submodule $sm"
+            ;;
+        +*)
+            echo "WARNING: submodule $sm is out of sync"
+            ;;
+    esac
+    (cd $sm; git archive --format tar --prefix "$sm/" $smhash) > "$sub_file"
+    test $? -ne 0 && error "failed to archive submodule $sm ($smhash)"
+    tar --concatenate --file "$tar_file" "$sub_file"
+    test $? -ne 0 && error "failed append submodule $sm to $tar_file"
 done
-
-if test -n "$submodules"; then
-    {
-        git ls-files || error "git ls-files failed"
-        for sm in $submodules; do
-            (cd $sm; git ls-files) | sed "s:^:$sm/:"
-            if test "${PIPESTATUS[*]}" != "0 0"; then
-                error "git ls-files in submodule $sm failed"
-            fi
-        done
-    } | grep -x -v $(for sm in $submodules; do echo "-e $sm"; done) > "$list_file"
-else
-    git ls-files > "$list_file"
-fi
-
-if test $? -ne 0; then
-    error "failed to generate list file"
-fi
-
-tar -cf "$tar_file" -T "$list_file" || error "failed to create tar file"
-
 exit 0
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 14/26] tests/vm: python3 fixes
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (12 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh Alex Bennée
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Philippe Mathieu-Daudé, Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Add proper unicode handling when processing strings.
Also need to explicitly say we want int not float.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-3-kraxel@redhat.com>
[AJB: fix conflicts with tests/vm: Port basevm to Python 3]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/basevm.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 083befce9f5..4847549592d 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -73,7 +73,7 @@ class BaseVM(object):
             "-vnc", "127.0.0.1:0,to=20",
             "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")]
         if vcpus and vcpus > 1:
-            self._args += ["-smp", str(vcpus)]
+            self._args += ["-smp", "%d" % vcpus]
         if kvm_available(self.arch):
             self._args += ["-enable-kvm"]
         else:
@@ -85,12 +85,13 @@ class BaseVM(object):
             if not sha256sum:
                 return True
             checksum = subprocess.check_output(["sha256sum", fname]).split()[0]
-            return sha256sum == checksum.decode()
+            return sha256sum == checksum.decode("utf-8")
 
         cache_dir = os.path.expanduser("~/.cache/qemu-vm/download")
         if not os.path.exists(cache_dir):
             os.makedirs(cache_dir)
-        fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest())
+        fname = os.path.join(cache_dir,
+                             hashlib.sha1(url.encode("utf-8")).hexdigest())
         if os.path.exists(fname) and check_sha256sum(fname):
             return fname
         logging.debug("Downloading %s to %s...", url, fname)
@@ -134,7 +135,7 @@ class BaseVM(object):
         raise NotImplementedError
 
     def add_source_dir(self, src_dir):
-        name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5]
+        name = "data-" + hashlib.sha1(src_dir.encode("utf-8")).hexdigest()[:5]
         tarfile = os.path.join(self._tmpdir, name + ".tar")
         logging.debug("Creating archive %s for src_dir dir: %s", tarfile, src_dir)
         subprocess.check_call(["./scripts/archive-source.sh", tarfile],
@@ -256,7 +257,7 @@ def main(vmcls):
             vm.add_source_dir(args.build_qemu)
             cmd = [vm.BUILD_SCRIPT.format(
                    configure_opts = " ".join(argv),
-                   jobs=args.jobs,
+                   jobs=int(args.jobs),
                    target=args.build_target,
                    verbose = "V=1" if args.verbose else "")]
         else:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (13 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally Alex Bennée
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Packages are fetched via proxy that way, if configured on the host.
That might be required to pass firewalls, and it allows to route
package downloads through a caching proxy server.

Needs AcceptEnv setup in sshd_config on the guest side to work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190520124716.30472-4-kraxel@redhat.com>
---
 tests/vm/basevm.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 4847549592d..5e30bac6615 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -38,6 +38,13 @@ class BaseVM(object):
     GUEST_PASS = "qemupass"
     ROOT_PASS = "qemupass"
 
+    envvars = [
+        "https_proxy",
+        "http_proxy",
+        "ftp_proxy",
+        "no_proxy",
+    ]
+
     # The script to run in the guest that builds QEMU
     BUILD_SCRIPT = ""
     # The guest name, to be overridden by subclasses
@@ -106,6 +113,8 @@ class BaseVM(object):
                    "-o", "UserKnownHostsFile=" + os.devnull,
                    "-o", "ConnectTimeout=1",
                    "-p", self.ssh_port, "-i", self._ssh_key_file]
+        for var in self.envvars:
+            ssh_cmd += ['-o', "SendEnv=%s" % var ]
         if interactive:
             ssh_cmd += ['-t']
         assert not isinstance(cmd, str)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (14 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot Alex Bennée
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Allways ask ssh to run with a pseudo terminal.
Not having a terminal causes problems now and then.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-5-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/basevm.py | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 5e30bac6615..395eefaec94 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -107,16 +107,14 @@ class BaseVM(object):
         os.rename(fname + ".download", fname)
         return fname
 
-    def _ssh_do(self, user, cmd, check, interactive=False):
-        ssh_cmd = ["ssh", "-q",
+    def _ssh_do(self, user, cmd, check):
+        ssh_cmd = ["ssh", "-q", "-t",
                    "-o", "StrictHostKeyChecking=no",
                    "-o", "UserKnownHostsFile=" + os.devnull,
                    "-o", "ConnectTimeout=1",
                    "-p", self.ssh_port, "-i", self._ssh_key_file]
         for var in self.envvars:
             ssh_cmd += ['-o', "SendEnv=%s" % var ]
-        if interactive:
-            ssh_cmd += ['-t']
         assert not isinstance(cmd, str)
         ssh_cmd += ["%s@127.0.0.1" % user] + list(cmd)
         logging.debug("ssh_cmd: %s", " ".join(ssh_cmd))
@@ -128,9 +126,6 @@ class BaseVM(object):
     def ssh(self, *cmd):
         return self._ssh_do(self.GUEST_USER, cmd, False)
 
-    def ssh_interactive(self, *cmd):
-        return self._ssh_do(self.GUEST_USER, cmd, False, True)
-
     def ssh_root(self, *cmd):
         return self._ssh_do("root", cmd, False)
 
@@ -284,9 +279,9 @@ def main(vmcls):
         return 2
 
     if args.interactive:
-        if vm.ssh_interactive(*cmd) == 0:
+        if vm.ssh(*cmd) == 0:
             return 0
-        vm.ssh_interactive()
+        vm.ssh()
         return 3
     else:
         if vm.ssh(*cmd) != 0:
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (15 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown Alex Bennée
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Thomas Huth, Ed Maste, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Alex Bennée

From: Gerd Hoffmann <kraxel@redhat.com>

The build script doesn't shutdown the guest VMs properly,
which results in filesystem corruption and guest boot
failures sooner or later.

Use the --snapshot to run builds on a snapshot,
That way killing the VM doesn't corrupt the base image.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Ed Maste <emaste@freebsd.org>
Message-Id: <20190520124716.30472-6-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index c59411bee01..276b870216c 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -57,6 +57,7 @@ vm-build-%: $(IMAGES_DIR)/%.img
 		$(if $(V),--verbose) \
 		--image "$<" \
 		$(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \
+		--snapshot \
 		--build-qemu $(SRC_PATH) -- \
 		$(if $(TARGET_LIST),--target-list=$(TARGET_LIST)) \
 		$(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 18/26] tests/vm: proper guest shutdown
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (16 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets Alex Bennée
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

When not running in snapshot mode ask the guest to poweroff and wait for
this to finish instead of simply quitting qemu, so the guest can flush
pending updates to disk.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-7-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/basevm.py | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 395eefaec94..f27178f3c7c 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -51,6 +51,8 @@ class BaseVM(object):
     name = "#base"
     # The guest architecture, to be overridden by subclasses
     arch = "#arch"
+    # command to halt the guest, can be overridden by subclasses
+    poweroff = "poweroff"
     def __init__(self, debug=False, vcpus=None):
         self._guest = None
         self._tmpdir = os.path.realpath(tempfile.mkdtemp(prefix="vm-test-",
@@ -202,6 +204,10 @@ class BaseVM(object):
     def wait(self):
         self._guest.wait()
 
+    def graceful_shutdown(self):
+        self.ssh_root(self.poweroff)
+        self._guest.wait()
+
     def qmp(self, *args, **kwargs):
         return self._guest.qmp(*args, **kwargs)
 
@@ -278,11 +284,13 @@ def main(vmcls):
         traceback.print_exc()
         return 2
 
-    if args.interactive:
-        if vm.ssh(*cmd) == 0:
-            return 0
+    exitcode = 0
+    if vm.ssh(*cmd) != 0:
+        exitcode = 3
+    if exitcode != 0 and args.interactive:
         vm.ssh()
-        return 3
-    else:
-        if vm.ssh(*cmd) != 0:
-            return 3
+
+    if not args.snapshot:
+        vm.graceful_shutdown()
+
+    return exitcode
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (17 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text Alex Bennée
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

For testing/troubleshooting convinience.

make vm-boot-serial-<guest>
  Boot guest, with the serial console on stdio.

make vm-boot-ssh-<guest>
  Boot guest, login via ssh.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-8-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 276b870216c..e329129bd65 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -20,6 +20,10 @@ vm-test:
 	@echo "  vm-build-all                    - Build QEMU in all VMs"
 	@echo "  vm-clean-all                    - Clean up VM images"
 	@echo
+	@echo "For trouble-shooting:"
+	@echo "  vm-boot-serial-<guest>          - Boot guest, serial console on stdio"
+	@echo "  vm-boot-ssh-<guest>             - Boot guest and login via ssh"
+	@echo
 	@echo "Special variables:"
 	@echo "    BUILD_TARGET=foo		 - Override the build target"
 	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
@@ -63,3 +67,18 @@ vm-build-%: $(IMAGES_DIR)/%.img
 		$(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \
 		"  VM-BUILD $*")
 
+vm-boot-serial-%: $(IMAGES_DIR)/%.img
+	qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -nographic \
+		-drive if=none,id=vblk,cache=writeback,file="$<" \
+		-netdev user,id=vnet \
+		-device virtio-blk-pci,drive=vblk \
+		-device virtio-net-pci,netdev=vnet \
+	|| true
+
+vm-boot-ssh-%: $(IMAGES_DIR)/%.img
+	$(call quiet-command, \
+		$(SRC_PATH)/tests/vm/$* \
+		--image "$<" \
+		--interactive \
+		false, \
+		"  VM-BOOT-SSH $*")
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 20/26] tests/vm: add DEBUG=1 to help text
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (18 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-31  6:49   ` Philippe Mathieu-Daudé
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 21/26] tests/vm: serial console support helpers Alex Bennée
                   ` (5 subsequent siblings)
  25 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190520124716.30472-9-kraxel@redhat.com>
[AJB: fix minor conflict]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index e329129bd65..628eecade78 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -25,6 +25,8 @@ vm-test:
 	@echo "  vm-boot-ssh-<guest>             - Boot guest and login via ssh"
 	@echo
 	@echo "Special variables:"
+	@echo "    DEBUG=1                       - be verbose, also start interactive"
+	@echo "	                                   shell on build failures"
 	@echo "    BUILD_TARGET=foo		 - Override the build target"
 	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
 	@echo '    EXTRA_CONFIGURE_OPTS="..."'
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 21/26] tests/vm: serial console support helpers
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (19 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 22/26] tests/vm: openbsd autoinstall, using serial console Alex Bennée
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Add a bunch of helpers to talk to the guest using the
serial console.

Also drop the hard-coded -serial parameter for the vm
so QEMUMachine.set_console() actually works.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-10-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/basevm.py | 85 ++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 82 insertions(+), 3 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index f27178f3c7c..8894267f078 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -2,10 +2,11 @@
 #
 # VM testing base class
 #
-# Copyright 2017 Red Hat Inc.
+# Copyright 2017-2019 Red Hat Inc.
 #
 # Authors:
 #  Fam Zheng <famz@redhat.com>
+#  Gerd Hoffmann <kraxel@redhat.com>
 #
 # This code is licensed under the GPL version 2 or later.  See
 # the COPYING file in the top-level directory.
@@ -13,7 +14,9 @@
 
 from __future__ import print_function
 import os
+import re
 import sys
+import socket
 import logging
 import time
 import datetime
@@ -79,8 +82,7 @@ class BaseVM(object):
             "-cpu", "max",
             "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22",
             "-device", "virtio-net-pci,netdev=vnet",
-            "-vnc", "127.0.0.1:0,to=20",
-            "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")]
+            "-vnc", "127.0.0.1:0,to=20"]
         if vcpus and vcpus > 1:
             self._args += ["-smp", "%d" % vcpus]
         if kvm_available(self.arch):
@@ -162,6 +164,8 @@ class BaseVM(object):
         logging.debug("QEMU args: %s", " ".join(args))
         qemu_bin = os.environ.get("QEMU", "qemu-system-" + self.arch)
         guest = QEMUMachine(binary=qemu_bin, args=args)
+        guest.set_machine('pc')
+        guest.set_console()
         try:
             guest.launch()
         except:
@@ -184,6 +188,81 @@ class BaseVM(object):
             raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
                             usernet_info)
 
+    def console_init(self, timeout = 120):
+        vm = self._guest
+        vm.console_socket.settimeout(timeout)
+
+    def console_log(self, text):
+        for line in re.split("[\r\n]", text):
+            # filter out terminal escape sequences
+            line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line)
+            line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line)
+            # replace unprintable chars
+            line = re.sub("\x1b", "<esc>", line)
+            line = re.sub("[\x00-\x1f]", ".", line)
+            if line == "":
+                continue
+            # log console line
+            sys.stderr.write("con recv: %s\n" % line)
+
+    def console_wait(self, expect):
+        vm = self._guest
+        output = ""
+        while True:
+            try:
+                chars = vm.console_socket.recv(1024)
+            except socket.timeout:
+                sys.stderr.write("console: *** read timeout ***\n")
+                sys.stderr.write("console: waiting for: '%s'\n" % expect)
+                sys.stderr.write("console: line buffer:\n")
+                sys.stderr.write("\n")
+                self.console_log(output.rstrip())
+                sys.stderr.write("\n")
+                raise
+            output += chars.decode("latin1")
+            if expect in output:
+                break
+            if "\r" in output or "\n" in output:
+                lines = re.split("[\r\n]", output)
+                output = lines.pop()
+                if self.debug:
+                    self.console_log("\n".join(lines))
+        if self.debug:
+            self.console_log(output)
+
+    def console_send(self, command):
+        vm = self._guest
+        if self.debug:
+            logline = re.sub("\n", "<enter>", command)
+            logline = re.sub("[\x00-\x1f]", ".", logline)
+            sys.stderr.write("con send: %s\n" % logline)
+        for char in list(command):
+            vm.console_socket.send(char.encode("utf-8"))
+            time.sleep(0.01)
+
+    def console_wait_send(self, wait, command):
+        self.console_wait(wait)
+        self.console_send(command)
+
+    def console_ssh_init(self, prompt, user, pw):
+        sshkey_cmd = "echo '%s' > .ssh/authorized_keys\n" % SSH_PUB_KEY.rstrip()
+        self.console_wait_send("login:",    "%s\n" % user)
+        self.console_wait_send("Password:", "%s\n" % pw)
+        self.console_wait_send(prompt,      "mkdir .ssh\n")
+        self.console_wait_send(prompt,      sshkey_cmd)
+        self.console_wait_send(prompt,      "chmod 755 .ssh\n")
+        self.console_wait_send(prompt,      "chmod 644 .ssh/authorized_keys\n")
+
+    def console_sshd_config(self, prompt):
+        self.console_wait(prompt)
+        self.console_send("echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config\n")
+        for var in self.envvars:
+            self.console_wait(prompt)
+            self.console_send("echo 'AcceptEnv %s' >> /etc/ssh/sshd_config\n" % var)
+
+    def print_step(self, text):
+        sys.stderr.write("### %s ...\n" % text)
+
     def wait_ssh(self, seconds=300):
         starttime = datetime.datetime.now()
         endtime = starttime + datetime.timedelta(seconds=seconds)
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 22/26] tests/vm: openbsd autoinstall, using serial console
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (20 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 21/26] tests/vm: serial console support helpers Alex Bennée
@ 2019-05-30 10:15 ` Alex Bennée
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 23/26] tests/vm: freebsd " Alex Bennée
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:15 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Brad Smith

From: Gerd Hoffmann <kraxel@redhat.com>

Instead of fetching the prebuilt image from patchew download the install
iso and prepare the image locally.  Install to disk, using the serial
console.  Create qemu user, configure ssh login.  Install packages
needed for qemu builds.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-11-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/openbsd | 158 +++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 145 insertions(+), 13 deletions(-)

diff --git a/tests/vm/openbsd b/tests/vm/openbsd
index 2105c01a267..c5f0a152183 100755
--- a/tests/vm/openbsd
+++ b/tests/vm/openbsd
@@ -2,10 +2,11 @@
 #
 # OpenBSD VM image
 #
-# Copyright 2017 Red Hat Inc.
+# Copyright 2017-2019 Red Hat Inc.
 #
 # Authors:
 #  Fam Zheng <famz@redhat.com>
+#  Gerd Hoffmann <kraxel@redhat.com>
 #
 # This code is licensed under the GPL version 2 or later.  See
 # the COPYING file in the top-level directory.
@@ -13,34 +14,165 @@
 
 import os
 import sys
+import socket
 import subprocess
 import basevm
 
 class OpenBSDVM(basevm.BaseVM):
     name = "openbsd"
     arch = "x86_64"
+
+    link = "https://cdn.openbsd.org/pub/OpenBSD/6.5/amd64/install65.iso"
+    csum = "38d1f8cadd502f1c27bf05c5abde6cc505dd28f3f34f8a941048ff9a54f9f608"
+    size = "20G"
+    pkgs = [
+        # tools
+        "git",
+        "pkgconf",
+        "bzip2", "xz",
+
+        # gnu tools
+        "bash",
+        "gmake",
+        "gsed",
+        "bison",
+
+        # libs: usb
+        "libusb1",
+
+        # libs: crypto
+        "gnutls",
+
+        # libs: images
+        "jpeg",
+        "png",
+
+	# libs: ui
+        "sdl2",
+        "gtk+3",
+        "libxkbcommon",
+    ]
+
     BUILD_SCRIPT = """
         set -e;
-        rm -rf /var/tmp/qemu-test.*
-        cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
+        rm -rf /home/qemu/qemu-test.*
+        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
+        mkdir src build; cd src;
         tar -xf /dev/rsd1c;
-        ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts};
-        gmake --output-sync -j{jobs} {verbose};
-        # XXX: "gmake check" seems to always hang or fail
-        #gmake --output-sync -j{jobs} check {verbose};
+        cd ../build
+        ../src/configure --cc=cc --python=python3 {configure_opts};
+        gmake --output-sync -j{jobs} {target} {verbose};
     """
+    poweroff = "halt -p"
 
     def build_image(self, img):
-        cimg = self._download_with_cache("http://download.patchew.org/openbsd-6.1-amd64.img.xz",
-                sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf')
-        img_tmp_xz = img + ".tmp.xz"
+        self.print_step("Downloading install iso")
+        cimg = self._download_with_cache(self.link, sha256sum=self.csum)
         img_tmp = img + ".tmp"
-        sys.stderr.write("Extracting the image...\n")
-        subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
+        iso = img + ".install.iso"
+
+        self.print_step("Preparing iso and disk image")
+        subprocess.check_call(["cp", "-f", cimg, iso])
+        subprocess.check_call(["qemu-img", "create", "-f", "qcow2",
+                               img_tmp, self.size])
+
+        self.print_step("Booting installer")
+        self.boot(img_tmp, extra_args = [
+            "-machine", "graphics=off",
+            "-cdrom", iso
+        ])
+        self.console_init()
+        self.console_wait_send("boot>", "set tty com0\n")
+        self.console_wait_send("boot>", "\n")
+
+        # pre-install configuration
+        self.console_wait_send("(I)nstall",               "i\n")
+        self.console_wait_send("Terminal type",           "xterm\n")
+        self.console_wait_send("System hostname",         "openbsd\n")
+        self.console_wait_send("Which network interface", "vio0\n")
+        self.console_wait_send("IPv4 address",            "dhcp\n")
+        self.console_wait_send("IPv6 address",            "none\n")
+        self.console_wait_send("Which network interface", "done\n")
+        self.console_wait_send("DNS domain name",         "localnet\n")
+        self.console_wait("Password for root account")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait("Password for root account")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait_send("Start sshd(8)",           "yes\n")
+        self.console_wait_send("X Window System",         "\n")
+        self.console_wait_send("xenodm",                  "\n")
+        self.console_wait_send("console to com0",         "\n")
+        self.console_wait_send("Which speed",             "\n")
+
+        self.console_wait("Setup a user")
+        self.console_send("%s\n" % self.GUEST_USER)
+        self.console_wait("Full name")
+        self.console_send("%s\n" % self.GUEST_USER)
+        self.console_wait("Password")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait("Password")
+        self.console_send("%s\n" % self.GUEST_PASS)
+
+        self.console_wait_send("Allow root ssh login",    "yes\n")
+        self.console_wait_send("timezone",                "UTC\n")
+        self.console_wait_send("root disk",               "\n")
+        self.console_wait_send("(W)hole disk",            "\n")
+        self.console_wait_send("(A)uto layout",           "\n")
+        self.console_wait_send("Location of sets",        "cd0\n")
+        self.console_wait_send("Pathname to the sets",    "\n")
+        self.console_wait_send("Set name(s)",             "\n")
+        self.console_wait_send("without verification",    "yes\n")
+
+        self.print_step("Installation started now, this will take a while")
+        self.console_wait_send("Location of sets",        "done\n")
+
+        self.console_wait("successfully completed")
+        self.print_step("Installation finished, rebooting")
+        self.console_wait_send("(R)eboot",                "reboot\n")
+
+        # setup qemu user
+        prompt = "$"
+        self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
+        self.console_wait_send(prompt, "exit\n")
+
+        # setup root user
+        prompt = "openbsd#"
+        self.console_ssh_init(prompt, "root", self.ROOT_PASS)
+        self.console_sshd_config(prompt)
+
+        # setup virtio-blk #1 (tarfile)
+        self.console_wait(prompt)
+        self.console_send("echo 'chmod 666 /dev/rsd1c' >> /etc/rc.local\n")
+
+        # enable w+x for /home
+        self.console_wait(prompt)
+        self.console_send("sed -i -e '/home/s/rw,/rw,wxallowed,/' /etc/fstab\n")
+
+        # tweak datasize limit
+        self.console_wait(prompt)
+        self.console_send("sed -i -e 's/\\(datasize[^=]*\\)=[^:]*/\\1=infinity/' /etc/login.conf\n")
+
+        # use http (be proxy cache friendly)
+        self.console_wait(prompt)
+        self.console_send("sed -i -e 's/https/http/' /etc/installurl\n")
+
+        self.print_step("Configuration finished, rebooting")
+        self.console_wait_send(prompt, "reboot\n")
+        self.console_wait("login:")
+        self.wait_ssh()
+
+        self.print_step("Installing packages")
+        self.ssh_root_check("pkg_add %s\n" % " ".join(self.pkgs))
+
+        # shutdown
+        self.ssh_root(self.poweroff)
+        self.wait()
+
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
+        os.remove(iso)
+        self.print_step("All done")
 
 if __name__ == "__main__":
     sys.exit(basevm.main(OpenBSDVM))
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 23/26] tests/vm: freebsd autoinstall, using serial console
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (21 preceding siblings ...)
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 22/26] tests/vm: openbsd autoinstall, using serial console Alex Bennée
@ 2019-05-30 10:16 ` Alex Bennée
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 24/26] tests/vm: netbsd " Alex Bennée
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Instead of fetching the prebuilt image from patchew download the install
iso and prepare the image locally.  Install to disk, using the serial
console.  Create qemu user, configure ssh login.  Install packages
needed for qemu builds.

Note that freebsd package downloads are delivered as non-cachable
content, so I had to configure squid with "ignore-no-store
ignore-private ignore-reload" for pkgmir.geo.freebsd.org to make the
caching actually work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20190520124716.30472-12-kraxel@redhat.com>
---
 tests/vm/freebsd | 179 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 169 insertions(+), 10 deletions(-)

diff --git a/tests/vm/freebsd b/tests/vm/freebsd
index b0066017a61..eb029bdfede 100755
--- a/tests/vm/freebsd
+++ b/tests/vm/freebsd
@@ -2,43 +2,202 @@
 #
 # FreeBSD VM image
 #
-# Copyright 2017 Red Hat Inc.
+# Copyright 2017-2019 Red Hat Inc.
 #
 # Authors:
 #  Fam Zheng <famz@redhat.com>
+#  Gerd Hoffmann <kraxel@redhat.com>
 #
 # This code is licensed under the GPL version 2 or later.  See
 # the COPYING file in the top-level directory.
 #
 
 import os
+import re
 import sys
+import time
+import socket
 import subprocess
 import basevm
 
 class FreeBSDVM(basevm.BaseVM):
     name = "freebsd"
     arch = "x86_64"
+
+    link = "https://download.freebsd.org/ftp/releases/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-disc1.iso.xz"
+    csum = "1d40015bea89d05b8bd13e2ed80c40b522a9ec1abd8e7c8b80954fb485fb99db"
+    size = "20G"
+    pkgs = [
+        # build tools
+        "git",
+        "pkgconf",
+        "bzip2",
+
+        # gnu tools
+        "bash",
+        "gmake",
+        "gsed",
+        "flex", "bison",
+
+        # libs: crypto
+        "gnutls",
+
+        # libs: images
+        "jpeg-turbo",
+        "png",
+
+        # libs: ui
+        "sdl2",
+        "gtk3",
+        "libxkbcommon",
+
+        # libs: opengl
+        "libepoxy",
+        "mesa-libs",
+    ]
+
     BUILD_SCRIPT = """
         set -e;
-        rm -rf /var/tmp/qemu-test.*
-        cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
+        rm -rf /home/qemu/qemu-test.*
+        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
+        mkdir src build; cd src;
         tar -xf /dev/vtbd1;
-        ./configure {configure_opts};
+        cd ../build
+        ../src/configure --python=python3.6 {configure_opts};
         gmake --output-sync -j{jobs} {target} {verbose};
     """
 
+    def console_boot_serial(self):
+        self.console_wait_send("Autoboot", "3")
+        self.console_wait_send("OK", "set console=comconsole\n")
+        self.console_wait_send("OK", "boot\n")
+
     def build_image(self, img):
-        cimg = self._download_with_cache("http://download.patchew.org/freebsd-11.1-amd64.img.xz",
-                sha256sum='adcb771549b37bc63826c501f05121a206ed3d9f55f49145908f7e1432d65891')
-        img_tmp_xz = img + ".tmp.xz"
+        self.print_step("Downloading install iso")
+        cimg = self._download_with_cache(self.link, sha256sum=self.csum)
         img_tmp = img + ".tmp"
-        sys.stderr.write("Extracting the image...\n")
-        subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
+        iso = img + ".install.iso"
+        iso_xz = iso + ".xz"
+
+        self.print_step("Preparing iso and disk image")
+        subprocess.check_call(["cp", "-f", cimg, iso_xz])
+        subprocess.check_call(["xz", "-dvf", iso_xz])
+        subprocess.check_call(["qemu-img", "create", "-f", "qcow2",
+                               img_tmp, self.size])
+
+        self.print_step("Booting installer")
+        self.boot(img_tmp, extra_args = [
+            "-machine", "graphics=off",
+            "-cdrom", iso
+        ])
+        self.console_init()
+        self.console_boot_serial()
+        self.console_wait_send("Console type",          "xterm\n")
+
+        # pre-install configuration
+        self.console_wait_send("Welcome",               "\n")
+        self.console_wait_send("Keymap Selection",      "\n")
+        self.console_wait_send("Set Hostname",          "freebsd\n")
+        self.console_wait_send("Distribution Select",   "\n")
+        self.console_wait_send("Partitioning",          "\n")
+        self.console_wait_send("Partition",             "\n")
+        self.console_wait_send("Scheme",                "\n")
+        self.console_wait_send("Editor",                "f")
+        self.console_wait_send("Confirmation",          "c")
+
+        self.print_step("Installation started now, this will take a while")
+
+        # post-install configuration
+        self.console_wait("New Password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait("Retype New Password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+
+        self.console_wait_send("Network Configuration", "\n")
+        self.console_wait_send("IPv4",                  "y")
+        self.console_wait_send("DHCP",                  "y")
+        self.console_wait_send("IPv6",                  "n")
+        self.console_wait_send("Resolver",              "\n")
+
+        self.console_wait_send("Time Zone Selector",    "a\n")
+        self.console_wait_send("Confirmation",          "y")
+        self.console_wait_send("Time & Date",           "\n")
+        self.console_wait_send("Time & Date",           "\n")
+
+        self.console_wait_send("System Configuration",  "\n")
+        self.console_wait_send("System Hardening",      "\n")
+
+        # qemu user
+        self.console_wait_send("Add User Accounts", "y")
+        self.console_wait("Username")
+        self.console_send("%s\n" % self.GUEST_USER)
+        self.console_wait("Full name")
+        self.console_send("%s\n" % self.GUEST_USER)
+        self.console_wait_send("Uid",                   "\n")
+        self.console_wait_send("Login group",           "\n")
+        self.console_wait_send("Login group",           "\n")
+        self.console_wait_send("Login class",           "\n")
+        self.console_wait_send("Shell",                 "\n")
+        self.console_wait_send("Home directory",        "\n")
+        self.console_wait_send("Home directory perm",   "\n")
+        self.console_wait_send("Use password",          "\n")
+        self.console_wait_send("Use an empty password", "\n")
+        self.console_wait_send("Use a random password", "\n")
+        self.console_wait("Enter password:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait("Enter password again:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait_send("Lock out",              "\n")
+        self.console_wait_send("OK",                    "yes\n")
+        self.console_wait_send("Add another user",      "no\n")
+
+        self.console_wait_send("Final Configuration",   "\n")
+        self.console_wait_send("Manual Configuration",  "\n")
+        self.console_wait_send("Complete",              "\n")
+
+        self.print_step("Installation finished, rebooting")
+        self.console_boot_serial()
+
+        # setup qemu user
+        prompt = "$"
+        self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
+        self.console_wait_send(prompt, "exit\n")
+
+        # setup root user
+        prompt = "root@freebsd:~ #"
+        self.console_ssh_init(prompt, "root", self.ROOT_PASS)
+        self.console_sshd_config(prompt)
+
+        # setup serial console
+        self.console_wait(prompt)
+        self.console_send("echo 'console=comconsole' >> /boot/loader.conf\n")
+
+        # setup boot delay
+        self.console_wait(prompt)
+        self.console_send("echo 'autoboot_delay=1' >> /boot/loader.conf\n")
+
+        # setup virtio-blk #1 (tarfile)
+        self.console_wait(prompt)
+        self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n")
+
+        self.print_step("Configuration finished, rebooting")
+        self.console_wait_send(prompt, "reboot\n")
+        self.console_wait("login:")
+        self.wait_ssh()
+
+        self.print_step("Installing packages")
+        self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs))
+
+        # shutdown
+        self.ssh_root(self.poweroff)
+        self.console_wait("Uptime:")
+        self.wait()
+
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
+        os.remove(iso)
+        self.print_step("All done")
 
 if __name__ == "__main__":
     sys.exit(basevm.main(FreeBSDVM))
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 24/26] tests/vm: netbsd autoinstall, using serial console
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (22 preceding siblings ...)
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 23/26] tests/vm: freebsd " Alex Bennée
@ 2019-05-30 10:16 ` Alex Bennée
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 25/26] tests/vm: fedora " Alex Bennée
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup Alex Bennée
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Thomas Huth, Philippe Mathieu-Daudé,
	Kamil Rytarowski, Gerd Hoffmann, Kamil Rytarowski,
	Alex Bennée

From: Gerd Hoffmann <kraxel@redhat.com>

Instead of fetching the prebuilt image from patchew download the install
iso and prepare the image locally.  Install to disk, using the serial
console.  Create qemu user, configure ssh login.  Install packages
needed for qemu builds.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Kamil Rytarowski <n54@gmx.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-13-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/netbsd | 187 +++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 177 insertions(+), 10 deletions(-)

diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index 4c6624ea5ed..6dbfc1b0fbe 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -2,10 +2,11 @@
 #
 # NetBSD VM image
 #
-# Copyright 2017 Red Hat Inc.
+# Copyright 2017-2019 Red Hat Inc.
 #
 # Authors:
 #  Fam Zheng <famz@redhat.com>
+#  Gerd Hoffmann <kraxel@redhat.com>
 #
 # This code is licensed under the GPL version 2 or later.  See
 # the COPYING file in the top-level directory.
@@ -13,32 +14,198 @@
 
 import os
 import sys
+import time
 import subprocess
 import basevm
 
 class NetBSDVM(basevm.BaseVM):
     name = "netbsd"
     arch = "x86_64"
+
+    link = "https://cdn.netbsd.org/pub/NetBSD/NetBSD-8.0/images/NetBSD-8.0-amd64.iso"
+    size = "20G"
+    pkgs = [
+        # tools
+        "git-base",
+        "pkgconf",
+        "xz",
+        "python37",
+
+        # gnu tools
+        "bash",
+        "gmake",
+        "gsed",
+        "flex", "bison",
+
+        # libs: crypto
+        "gnutls",
+
+        # libs: images
+        "jpeg",
+        "png",
+
+	# libs: ui
+        "SDL2",
+        "gtk3+",
+        "libxkbcommon",
+    ]
+
     BUILD_SCRIPT = """
         set -e;
-        rm -rf /var/tmp/qemu-test.*
-        cd $(mktemp -d /var/tmp/qemu-test.XXXXXX);
+        rm -rf /home/qemu/qemu-test.*
+        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
+        mkdir src build; cd src;
         tar -xf /dev/rld1a;
-        ./configure --python=python2.7 {configure_opts};
+        cd ../build
+        ../src/configure --python=python3.7 --disable-opengl {configure_opts};
         gmake --output-sync -j{jobs} {target} {verbose};
     """
+    poweroff = "/sbin/poweroff"
 
     def build_image(self, img):
-        cimg = self._download_with_cache("http://download.patchew.org/netbsd-7.1-amd64.img.xz",
-                                         sha256sum='b633d565b0eac3d02015cd0c81440bd8a7a8df8512615ac1ee05d318be015732')
-        img_tmp_xz = img + ".tmp.xz"
+        cimg = self._download_with_cache(self.link)
         img_tmp = img + ".tmp"
-        sys.stderr.write("Extracting the image...\n")
-        subprocess.check_call(["cp", "-f", cimg, img_tmp_xz])
-        subprocess.check_call(["xz", "-dvf", img_tmp_xz])
+        iso = img + ".install.iso"
+
+        self.print_step("Preparing iso and disk image")
+        subprocess.check_call(["cp", "-f", cimg, iso])
+        subprocess.check_call(["qemu-img", "create", "-f", "qcow2",
+                               img_tmp, self.size])
+
+        self.print_step("Booting installer")
+        self.boot(img_tmp, extra_args = [
+            "-device", "VGA",
+            "-machine", "graphics=off",
+            "-cdrom", iso
+        ])
+        self.console_init()
+        self.console_wait("Primary Bootstrap")
+
+        # serial console boot menu output doesn't work for some
+        # reason, so we have to fly blind ...
+        for char in list("5consdev com0\n"):
+            time.sleep(0.2)
+            self.console_send(char)
+            self.console_wait("")
+        self.console_wait_send("> ", "boot\n")
+
+        self.console_wait_send("Terminal type",            "xterm\n")
+        self.console_wait_send("a: Installation messages", "a\n")
+        self.console_wait_send("b: US-English",            "b\n")
+        self.console_wait_send("a: Install NetBSD",        "a\n")
+        self.console_wait("Shall we continue?")
+        self.console_wait_send("b: Yes",                   "b\n")
+
+        self.console_wait_send("a: ld0",                   "a\n")
+        self.console_wait_send("a: This is the correct",   "a\n")
+        self.console_wait_send("b: Use the entire disk",   "b\n")
+        self.console_wait("NetBSD bootcode")
+        self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait_send("b: Use existing part",     "b\n")
+        self.console_wait_send("x: Partition sizes ok",    "x\n")
+        self.console_wait_send("for your NetBSD disk",     "\n")
+        self.console_wait("Shall we continue?")
+        self.console_wait_send("b: Yes",                   "b\n")
+
+        self.console_wait_send("b: Use serial port com0",  "b\n")
+        self.console_wait_send("f: Set serial baud rate",  "f\n")
+        self.console_wait_send("a: 9600",                  "a\n")
+        self.console_wait_send("x: Exit",                  "x\n")
+
+        self.console_wait_send("a: Full installation",     "a\n")
+        self.console_wait_send("a: CD-ROM",                "a\n")
+
+        self.print_step("Installation started now, this will take a while")
+        self.console_wait_send("Hit enter to continue",    "\n")
+
+        self.console_wait_send("d: Change root password",  "d\n")
+        self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait("New password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait("New password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait("Retype new password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+
+        self.console_wait_send("o: Add a user",            "o\n")
+        self.console_wait("username")
+        self.console_send("%s\n" % self.GUEST_USER)
+        self.console_wait("to group wheel")
+        self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait_send("a: /bin/sh",               "a\n")
+        self.console_wait("New password:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait("New password:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait("Retype new password:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+
+        self.console_wait_send("a: Configure network",     "a\n")
+        self.console_wait_send("a: vioif0",                "a\n")
+        self.console_wait_send("Network media type",       "\n")
+        self.console_wait("autoconfiguration")
+        self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait_send("DNS domain",               "localnet\n")
+        self.console_wait("Are they OK?")
+        self.console_wait_send("a: Yes",                   "a\n")
+        self.console_wait("installed in /etc")
+        self.console_wait_send("a: Yes",                   "a\n")
+
+        self.console_wait_send("e: Enable install",        "e\n")
+        proxy = os.environ.get("http_proxy")
+        if not proxy is None:
+            self.console_wait_send("f: Proxy",             "f\n")
+            self.console_wait("Proxy")
+            self.console_send("%s\n" % proxy)
+        self.console_wait_send("x: Install pkgin",         "x\n")
+        self.console_init(1200)
+        self.console_wait_send("Hit enter to continue", "\n")
+        self.console_init()
+
+        self.console_wait_send("g: Enable sshd",           "g\n")
+        self.console_wait_send("x: Finished conf",         "x\n")
+        self.console_wait_send("Hit enter to continue",    "\n")
+
+        self.print_step("Installation finished, rebooting")
+        self.console_wait_send("d: Reboot the computer",   "d\n")
+
+        # setup qemu user
+        prompt = "localhost$"
+        self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
+        self.console_wait_send(prompt, "exit\n")
+
+        # setup root user
+        prompt = "localhost#"
+        self.console_ssh_init(prompt, "root", self.ROOT_PASS)
+        self.console_sshd_config(prompt)
+
+        # setup virtio-blk #1 (tarfile)
+        self.console_wait(prompt)
+        self.console_send("echo 'chmod 666 /dev/rld1a' >> /etc/rc.local\n")
+
+        # turn off mprotect (conflicts with tcg)
+        self.console_wait(prompt)
+        self.console_send("echo security.pax.mprotect.enabled=0 >> /etc/sysctl.conf\n")
+
+        self.print_step("Configuration finished, rebooting")
+        self.console_wait_send(prompt, "reboot\n")
+        self.console_wait("login:")
+        self.wait_ssh()
+
+        self.print_step("Installing packages")
+        self.ssh_root_check("pkgin update\n")
+        self.ssh_root_check("pkgin -y install %s\n" % " ".join(self.pkgs))
+
+        # shutdown
+        self.ssh_root(self.poweroff)
+        self.console_wait("entering state S5")
+        self.wait()
+
         if os.path.exists(img):
             os.remove(img)
         os.rename(img_tmp, img)
+        os.remove(iso)
+        self.print_step("All done")
 
 if __name__ == "__main__":
     sys.exit(basevm.main(NetBSDVM))
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH  v1 25/26] tests/vm: fedora autoinstall, using serial console
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (23 preceding siblings ...)
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 24/26] tests/vm: netbsd " Alex Bennée
@ 2019-05-30 10:16 ` Alex Bennée
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup Alex Bennée
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Download the install iso and prepare the image locally.  Install to
disk, using the serial console.  Create qemu user, configure ssh login.
Install packages needed for qemu builds.

Yes, we have docker images for fedora.  But for trouble-shooting it
might be helpful to have a vm too.  When vm builds fail you can use
it to figure whenever the vm setup or the guest os is the problem.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-14-kraxel@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/vm/Makefile.include |   3 +-
 tests/vm/basevm.py        |   9 +-
 tests/vm/fedora           | 187 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 197 insertions(+), 2 deletions(-)
 create mode 100755 tests/vm/fedora

diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
index 628eecade78..5e37063d32d 100644
--- a/tests/vm/Makefile.include
+++ b/tests/vm/Makefile.include
@@ -2,7 +2,7 @@
 
 .PHONY: vm-build-all vm-clean-all
 
-IMAGES := ubuntu.i386 freebsd netbsd openbsd centos
+IMAGES := ubuntu.i386 freebsd netbsd openbsd centos fedora
 IMAGES_DIR := $(HOME)/.cache/qemu-vm/images
 IMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES))
 
@@ -16,6 +16,7 @@ vm-test:
 	@echo "  vm-build-netbsd                 - Build QEMU in NetBSD VM"
 	@echo "  vm-build-openbsd                - Build QEMU in OpenBSD VM"
 	@echo "  vm-build-centos                 - Build QEMU in CentOS VM, with Docker"
+	@echo "  vm-build-fedora                 - Build QEMU in Fedora VM"
 	@echo ""
 	@echo "  vm-build-all                    - Build QEMU in all VMs"
 	@echo "  vm-clean-all                    - Clean up VM images"
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 8894267f078..d4b816be14d 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -205,7 +205,7 @@ class BaseVM(object):
             # log console line
             sys.stderr.write("con recv: %s\n" % line)
 
-    def console_wait(self, expect):
+    def console_wait(self, expect, expectalt = None):
         vm = self._guest
         output = ""
         while True:
@@ -214,6 +214,8 @@ class BaseVM(object):
             except socket.timeout:
                 sys.stderr.write("console: *** read timeout ***\n")
                 sys.stderr.write("console: waiting for: '%s'\n" % expect)
+                if not expectalt is None:
+                    sys.stderr.write("console: waiting for: '%s' (alt)\n" % expectalt)
                 sys.stderr.write("console: line buffer:\n")
                 sys.stderr.write("\n")
                 self.console_log(output.rstrip())
@@ -222,6 +224,8 @@ class BaseVM(object):
             output += chars.decode("latin1")
             if expect in output:
                 break
+            if not expectalt is None and expectalt in output:
+                break
             if "\r" in output or "\n" in output:
                 lines = re.split("[\r\n]", output)
                 output = lines.pop()
@@ -229,6 +233,9 @@ class BaseVM(object):
                     self.console_log("\n".join(lines))
         if self.debug:
             self.console_log(output)
+        if not expectalt is None and expectalt in output:
+            return False
+        return True
 
     def console_send(self, command):
         vm = self._guest
diff --git a/tests/vm/fedora b/tests/vm/fedora
new file mode 100755
index 00000000000..c5621d08322
--- /dev/null
+++ b/tests/vm/fedora
@@ -0,0 +1,187 @@
+#!/usr/bin/env python
+#
+# Fedora VM image
+#
+# Copyright 2019 Red Hat Inc.
+#
+# Authors:
+#  Gerd Hoffmann <kraxel@redhat.com>
+#
+# This code is licensed under the GPL version 2 or later.  See
+# the COPYING file in the top-level directory.
+#
+
+import os
+import re
+import sys
+import time
+import socket
+import subprocess
+import basevm
+
+class FedoraVM(basevm.BaseVM):
+    name = "fedora"
+    arch = "x86_64"
+
+    base = "http://dl.fedoraproject.org/pub/fedora/linux/releases/30/"
+    link = base + "Server/x86_64/iso/Fedora-Server-netinst-x86_64-30-1.2.iso"
+    repo = base + "Server/x86_64/os/"
+    full = base + "Everything/x86_64/os/"
+    csum = "5e4eac4566d8c572bfb3bcf54b7d6c82006ec3c6c882a2c9235c6d3494d7b100"
+    size = "20G"
+    pkgs = [
+        # tools
+        'git-core',
+        'flex', 'bison',
+        'gcc', 'binutils', 'make',
+
+        # perl
+        'perl-Test-Harness',
+
+        # libs: usb
+        '"pkgconfig(libusb-1.0)"',
+        '"pkgconfig(libusbredirparser-0.5)"',
+
+        # libs: crypto
+        '"pkgconfig(gnutls)"',
+
+        # libs: ui
+        '"pkgconfig(sdl2)"',
+        '"pkgconfig(gtk+-3.0)"',
+        '"pkgconfig(ncursesw)"',
+
+        # libs: audio
+        '"pkgconfig(libpulse)"',
+        '"pkgconfig(alsa)"',
+    ]
+
+    BUILD_SCRIPT = """
+        set -e;
+        rm -rf /home/qemu/qemu-test.*
+        cd $(mktemp -d /home/qemu/qemu-test.XXXXXX);
+        mkdir src build; cd src;
+        tar -xf /dev/vdb;
+        cd ../build
+        ../src/configure --python=python3 {configure_opts};
+        gmake --output-sync -j{jobs} {target} {verbose};
+    """
+
+    def build_image(self, img):
+        self.print_step("Downloading install iso")
+        cimg = self._download_with_cache(self.link, sha256sum=self.csum)
+        img_tmp = img + ".tmp"
+        iso = img + ".install.iso"
+
+        self.print_step("Preparing iso and disk image")
+        subprocess.check_call(["cp", "-f", cimg, iso])
+        subprocess.check_call(["qemu-img", "create", "-f", "qcow2",
+                               img_tmp, self.size])
+
+        self.print_step("Booting installer")
+        self.boot(img_tmp, extra_args = [
+            "-machine", "graphics=off",
+            "-cdrom", iso
+        ])
+        self.console_init(300)
+        self.console_wait("installation process.")
+        time.sleep(0.3)
+        self.console_send("\t")
+        time.sleep(0.3)
+        self.console_send(" console=ttyS0")
+        proxy = os.environ.get("http_proxy")
+        if not proxy is None:
+            self.console_send(" proxy=%s" % proxy)
+        self.console_send(" inst.repo=%s" % self.repo)
+        self.console_send("\n")
+
+        self.console_wait_send("2) Use text mode",         "2\n")
+
+        self.console_wait_send("5) [!] Installation Dest", "5\n")
+        self.console_wait_send("1) [x]",                   "c\n")
+        self.console_wait_send("2) [ ] Use All Space",     "2\n")
+        self.console_wait_send("2) [x] Use All Space",     "c\n")
+        self.console_wait_send("1) [ ] Standard Part",     "1\n")
+        self.console_wait_send("1) [x] Standard Part",     "c\n")
+
+        self.console_wait_send("7) [!] Root password",     "7\n")
+        self.console_wait("Password:")
+        self.console_send("%s\n" % self.ROOT_PASS)
+        self.console_wait("Password (confirm):")
+        self.console_send("%s\n" % self.ROOT_PASS)
+
+        self.console_wait_send("8) [ ] User creation",     "8\n")
+        self.console_wait_send("1) [ ] Create user",       "1\n")
+        self.console_wait_send("3) User name",             "3\n")
+        self.console_wait_send("ENTER:", "%s\n" % self.GUEST_USER)
+        self.console_wait_send("4) [ ] Use password",      "4\n")
+        self.console_wait_send("5) Password",              "5\n")
+        self.console_wait("Password:")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait("Password (confirm):")
+        self.console_send("%s\n" % self.GUEST_PASS)
+        self.console_wait_send("7) Groups",                "c\n")
+
+        while True:
+            good = self.console_wait("3) [x] Installation",
+                                     "3) [!] Installation")
+            self.console_send("r\n")
+            if good:
+                break
+            time.sleep(10)
+
+        while True:
+            good = self.console_wait("4) [x] Software",
+                                     "4) [!] Software")
+            self.console_send("r\n")
+            if good:
+                break
+            time.sleep(10)
+            self.console_send("r\n" % self.GUEST_PASS)
+
+        self.console_wait_send("'b' to begin install",     "b\n")
+
+        self.print_step("Installation started now, this will take a while")
+
+        self.console_wait_send("Installation complete",    "\n")
+        self.print_step("Installation finished, rebooting")
+
+        # setup qemu user
+        prompt = " ~]$"
+        self.console_ssh_init(prompt, self.GUEST_USER, self.GUEST_PASS)
+        self.console_wait_send(prompt, "exit\n")
+
+        # setup root user
+        prompt = " ~]#"
+        self.console_ssh_init(prompt, "root", self.ROOT_PASS)
+        self.console_sshd_config(prompt)
+
+        # setup virtio-blk #1 (tarfile)
+        self.console_wait(prompt)
+        self.console_send("echo 'KERNEL==\"vdb\" MODE=\"666\"' >> %s\n" %
+                          "/etc/udev/rules.d/99-qemu.rules")
+
+        self.print_step("Configuration finished, rebooting")
+        self.console_wait_send(prompt, "reboot\n")
+        self.console_wait("login:")
+        self.wait_ssh()
+
+        self.print_step("Installing packages")
+        self.ssh_root_check("rm -vf /etc/yum.repos.d/fedora*.repo\n")
+        self.ssh_root_check("echo '[fedora]' >> /etc/yum.repos.d/qemu.repo\n")
+        self.ssh_root_check("echo 'baseurl=%s' >> /etc/yum.repos.d/qemu.repo\n" % self.full)
+        self.ssh_root_check("echo 'gpgcheck=0' >> /etc/yum.repos.d/qemu.repo\n")
+        self.ssh_root_check("dnf install -y %s\n" % " ".join(self.pkgs))
+
+        # shutdown
+        self.ssh_root(self.poweroff)
+        self.console_wait("sleep state S5")
+        self.wait()
+
+        if os.path.exists(img):
+            os.remove(img)
+        os.rename(img_tmp, img)
+        os.remove(iso)
+        self.print_step("All done")
+
+if __name__ == "__main__":
+    sys.exit(basevm.main(FedoraVM))
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup
  2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
                   ` (24 preceding siblings ...)
  2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 25/26] tests/vm: fedora " Alex Bennée
@ 2019-05-30 10:16 ` Alex Bennée
  25 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-30 10:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Alex Bennée, Philippe Mathieu-Daudé, Gerd Hoffmann

From: Gerd Hoffmann <kraxel@redhat.com>

Configure apt proxy so package downloads
can be cached and can pass firewalls.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190520124716.30472-15-kraxel@redhat.com>
---
 tests/vm/ubuntu.i386 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/vm/ubuntu.i386 b/tests/vm/ubuntu.i386
index a22d137e76d..b869afd212f 100755
--- a/tests/vm/ubuntu.i386
+++ b/tests/vm/ubuntu.i386
@@ -51,6 +51,10 @@ class UbuntuX86VM(basevm.BaseVM):
                           "    ssh-authorized-keys:\n",
                           "    - %s\n" % basevm.SSH_PUB_KEY,
                           "locale: en_US.UTF-8\n"])
+        proxy = os.environ.get("http_proxy")
+        if not proxy is None:
+            udata.writelines(["apt:\n",
+                              "  proxy: %s" % proxy])
         udata.close()
         subprocess.check_call(["genisoimage", "-output", "cloud-init.iso",
                                "-volid", "cidata", "-joliet", "-rock",
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts Alex Bennée
@ 2019-05-30 18:15   ` Richard Henderson
  0 siblings, 0 replies; 43+ messages in thread
From: Richard Henderson @ 2019-05-30 18:15 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 5/30/19 5:15 AM, Alex Bennée wrote:
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  .editorconfig | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking Alex Bennée
@ 2019-05-30 18:41   ` Richard Henderson
  0 siblings, 0 replies; 43+ messages in thread
From: Richard Henderson @ 2019-05-30 18:41 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Kevin Wolf, open list:Block layer core, Max Reitz

On 5/30/19 5:15 AM, Alex Bennée wrote:
> -static struct timeval tsub(struct timeval t1, struct timeval t2)
> +static struct timespec tsub(struct timespec t1, struct timespec t2)
>  {
> -    t1.tv_usec -= t2.tv_usec;
> -    if (t1.tv_usec < 0) {
> -        t1.tv_usec += 1000000;
> +    t1.tv_nsec -= t2.tv_nsec;
> +    if (t1.tv_nsec < 0) {
> +        t1.tv_nsec += 1000000000;

Rather than counting zeros, should we move or copy NANOSECONDS_PER_SECOND?

> +    double time = (double)tv.tv_sec + ((double)tv.tv_nsec / 1000000000.0);

On that same vein, I'll note this can also be spelled "1e9".
Also, the casts to double are superfluous, once we have one FP constant.

> +static void timestr(struct timespec *tv, char *ts, size_t size, int format)
>  {
> -    double usec = (double)tv->tv_usec / 1000000.0;
> +    double nsec = (double)tv->tv_nsec / 1000000000.0;

Similarly.

>  
>      if (format & TERSE_FIXED_TIME) {
>          if (!HOURS(tv->tv_sec)) {
>              snprintf(ts, size, "%u:%02u.%02u",
>                      (unsigned int) MINUTES(tv->tv_sec),
>                      (unsigned int) SECONDS(tv->tv_sec),
> -                    (unsigned int) (usec * 100));
> +                    (unsigned int) (nsec * 100000));

The multiplier here is wrong.

The existing formatting here is bonkers, which doesn't help.  Why should we
convert to double, divide into a fraction of a second, shift the decimal place,
and truncate conversion to integer?

The formatting should clearly be

  snprintf(ts, size, "%u:%05.2f",
           (unsigned int) MINUTES(tv->tv_sec),
           SECONDS(tv->tv_sec) + nsec);

so that the complete seconds plus fraction of a second is rounded to two digits
after the decimal point, and is left-padded with 0's so that the entire number
fits in 5 characters, not forgetting the decimal point itself (i.e. 00.00).

Likewise to the other two occurrences in this function.


r~


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30 Alex Bennée
@ 2019-05-30 18:43   ` Richard Henderson
  2019-05-31  6:54   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 43+ messages in thread
From: Richard Henderson @ 2019-05-30 18:43 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé

On 5/30/19 5:15 AM, Alex Bennée wrote:
> While at it remove the bogus :latest tag for cris cross compiler. It
> tends to break caching and cause confusion.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/docker/dockerfiles/fedora-cris-cross.docker | 2 +-
>  tests/docker/dockerfiles/fedora-i386-cross.docker | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04 Alex Bennée
@ 2019-05-30 18:44   ` Richard Henderson
  0 siblings, 0 replies; 43+ messages in thread
From: Richard Henderson @ 2019-05-30 18:44 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng, Philippe Mathieu-Daudé

On 5/30/19 5:15 AM, Alex Bennée wrote:
> This has aged a little and we have a separate LTS image for testing on
> the older distros. Update it to a more recent release like its Fedora
> cousin.
> 
> Besides it is useful to have something with gcc-9 on it for squashing
> those stringop truncation errors.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/docker/dockerfiles/ubuntu.docker | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job Alex Bennée
@ 2019-05-31  6:21   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:21 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng

On 5/30/19 12:15 PM, Alex Bennée wrote:
> We document this on our wiki and we might as well catch it in our CI
> rather than waiting for it to be picked up on merge:
> 
>   https://wiki.qemu.org/Testing#clang_UBSan
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  .travis.yml | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/.travis.yml b/.travis.yml
> index f0aa37f2d12..2f1658602ed 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -152,6 +152,13 @@ matrix:
>        compiler: clang
>  
>  
> +    - env:
> +        - CONFIG="--target-list=${MAIN_SOFTMMU_TARGETS} "
> +      compiler: clang
> +      before_script:
> +        - ./configure ${CONFIG} --extra-cflags="-fsanitize=undefined -Werror" || { cat config.log && exit 1; }
> +
> +
>      - env:
>          - CONFIG="--disable-user --target-list-exclude=${MAIN_SOFTMMU_TARGETS}"
>        compiler: clang
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build Alex Bennée
@ 2019-05-31  6:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:22 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng, Wainer dos Santos Moschetta

On 5/30/19 12:15 PM, Alex Bennée wrote:
> From: Wainer dos Santos Moschetta <wainersm@redhat.com>
> 
> Changed the vm-test makefile to execute python scripts
> with the interpreter configured on build. This allows to
> run vm-test targets properly in Linux distros with Python 3
> only support.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Message-Id: <20190329210804.22121-2-wainersm@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  tests/vm/Makefile.include | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
> index 992d823f6bd..6f82676306d 100644
> --- a/tests/vm/Makefile.include
> +++ b/tests/vm/Makefile.include
> @@ -35,7 +35,7 @@ $(IMAGES_DIR)/%.img:	$(SRC_PATH)/tests/vm/% \
>  			$(SRC_PATH)/tests/vm/Makefile.include
>  	@mkdir -p $(IMAGES_DIR)
>  	$(call quiet-command, \
> -		$< \
> +		$(PYTHON) $< \
>  		$(if $(V)$(DEBUG), --debug) \
>  		--image "$@" \
>  		--force \
> @@ -46,7 +46,7 @@ $(IMAGES_DIR)/%.img:	$(SRC_PATH)/tests/vm/% \
>  # Build in VM $(IMAGE)
>  vm-build-%: $(IMAGES_DIR)/%.img
>  	$(call quiet-command, \
> -		$(SRC_PATH)/tests/vm/$* \
> +		$(PYTHON) $(SRC_PATH)/tests/vm/$* \
>  		$(if $(V)$(DEBUG), --debug) \
>  		$(if $(DEBUG), --interactive) \
>  		$(if $(J),--jobs $(J)) \
> 


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3 Alex Bennée
@ 2019-05-31  6:22   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:22 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng, Wainer dos Santos Moschetta

On 5/30/19 12:15 PM, Alex Bennée wrote:
> From: Wainer dos Santos Moschetta <wainersm@redhat.com>
> 
> Fixed tests/vm/basevm.py to run with Python 3:
>  - hashlib.sha1() requires an binary encoded object.
>  - uses floor division ("//") (PEP 238).
>  - decode bytes to unicode when needed.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Message-Id: <20190329210804.22121-3-wainersm@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  tests/vm/basevm.py | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
> index 0556bdcf9e9..083befce9f5 100755
> --- a/tests/vm/basevm.py
> +++ b/tests/vm/basevm.py
> @@ -85,12 +85,12 @@ class BaseVM(object):
>              if not sha256sum:
>                  return True
>              checksum = subprocess.check_output(["sha256sum", fname]).split()[0]
> -            return sha256sum == checksum
> +            return sha256sum == checksum.decode()
>  
>          cache_dir = os.path.expanduser("~/.cache/qemu-vm/download")
>          if not os.path.exists(cache_dir):
>              os.makedirs(cache_dir)
> -        fname = os.path.join(cache_dir, hashlib.sha1(url).hexdigest())
> +        fname = os.path.join(cache_dir, hashlib.sha1(url.encode()).hexdigest())
>          if os.path.exists(fname) and check_sha256sum(fname):
>              return fname
>          logging.debug("Downloading %s to %s...", url, fname)
> @@ -134,7 +134,7 @@ class BaseVM(object):
>          raise NotImplementedError
>  
>      def add_source_dir(self, src_dir):
> -        name = "data-" + hashlib.sha1(src_dir).hexdigest()[:5]
> +        name = "data-" + hashlib.sha1(src_dir.encode()).hexdigest()[:5]
>          tarfile = os.path.join(self._tmpdir, name + ".tar")
>          logging.debug("Creating archive %s for src_dir dir: %s", tarfile, src_dir)
>          subprocess.check_call(["./scripts/archive-source.sh", tarfile],
> @@ -204,7 +204,7 @@ def parse_args(vmcls):
>  
>      def get_default_jobs():
>          if kvm_available(vmcls.arch):
> -            return multiprocessing.cpu_count() / 2
> +            return multiprocessing.cpu_count() // 2
>          else:
>              return 1
>  
> 


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help Alex Bennée
@ 2019-05-31  6:45   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:45 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng, Wainer dos Santos Moschetta

On 5/30/19 12:15 PM, Alex Bennée wrote:
> From: Wainer dos Santos Moschetta <wainersm@redhat.com>
> 
> Added description of variables missing on vm-test help.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Message-Id: <20190329210804.22121-6-wainersm@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/vm/Makefile.include | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
> index 6f82676306d..c59411bee01 100644
> --- a/tests/vm/Makefile.include
> +++ b/tests/vm/Makefile.include
> @@ -21,9 +21,13 @@ vm-test:
>  	@echo "  vm-clean-all                    - Clean up VM images"
>  	@echo
>  	@echo "Special variables:"
> -	@echo "    BUILD_TARGET=foo		 - override the build target"
> -	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds."
> +	@echo "    BUILD_TARGET=foo		 - Override the build target"
> +	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
>  	@echo '    EXTRA_CONFIGURE_OPTS="..."'
> +	@echo "    J=[0..9]*            	 - Override the -jN parameter for make commands"
> +	@echo "    DEBUG=1              	 - Enable verbose output on host and interactive debugging"
> +	@echo "    V=1				 - Enable verbose ouput on host and guest commands"
> +	@echo "    QEMU=/path/to/qemu		 - Change path to QEMU binary"
>  
>  vm-build-all: $(addprefix vm-build-, $(IMAGES))
>  
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text Alex Bennée
@ 2019-05-31  6:49   ` Philippe Mathieu-Daudé
  2019-05-31  8:15     ` Alex Bennée
  0 siblings, 1 reply; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:49 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Fam Zheng, Thomas Huth, Gerd Hoffmann, Wainer dos Santos Moschetta

Hi  Alex,

On 5/30/19 12:15 PM, Alex Bennée wrote:
> From: Gerd Hoffmann <kraxel@redhat.com>
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Thomas Huth <thuth@redhat.com>
> Message-Id: <20190520124716.30472-9-kraxel@redhat.com>
> [AJB: fix minor conflict]
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/vm/Makefile.include | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
> index e329129bd65..628eecade78 100644
> --- a/tests/vm/Makefile.include
> +++ b/tests/vm/Makefile.include
> @@ -25,6 +25,8 @@ vm-test:
>  	@echo "  vm-boot-ssh-<guest>             - Boot guest and login via ssh"
>  	@echo
>  	@echo "Special variables:"
> +	@echo "    DEBUG=1                       - be verbose, also start interactive"
> +	@echo "	                                   shell on build failures"

Patch 12 of this series (tests/vm: Add missing variables on help)
already added this, it now appears 2 times:

Special variables:
    DEBUG=1                       - be verbose, also start interactive
                                           shell on build failures
    DEBUG=1                      - Enable verbose output on host and
interactive debugging

This one is more precise although...

>  	@echo "    BUILD_TARGET=foo		 - Override the build target"
>  	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
>  	@echo '    EXTRA_CONFIGURE_OPTS="..."'
> 


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30 Alex Bennée
  2019-05-30 18:43   ` Richard Henderson
@ 2019-05-31  6:54   ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-05-31  6:54 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: Fam Zheng

On 5/30/19 12:15 PM, Alex Bennée wrote:
> While at it remove the bogus :latest tag for cris cross compiler. It
> tends to break caching and cause confusion.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  tests/docker/dockerfiles/fedora-cris-cross.docker | 2 +-
>  tests/docker/dockerfiles/fedora-i386-cross.docker | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/docker/dockerfiles/fedora-cris-cross.docker b/tests/docker/dockerfiles/fedora-cris-cross.docker
> index b168ada615a..09e7e449f9b 100644
> --- a/tests/docker/dockerfiles/fedora-cris-cross.docker
> +++ b/tests/docker/dockerfiles/fedora-cris-cross.docker
> @@ -2,7 +2,7 @@
>  # Cross compiler for cris system tests
>  #
>  
> -FROM fedora:latest
> +FROM fedora:30
>  ENV PACKAGES gcc-cris-linux-gnu
>  RUN dnf install -y $PACKAGES
>  RUN rpm -q $PACKAGES | sort > /packages.txt
> diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker
> index eb8108d1185..9106cf9ebed 100644
> --- a/tests/docker/dockerfiles/fedora-i386-cross.docker
> +++ b/tests/docker/dockerfiles/fedora-i386-cross.docker
> @@ -1,4 +1,4 @@
> -FROM fedora:29
> +FROM fedora:30
>  ENV PACKAGES \
>      gcc \
>      glib2-devel.i686 \
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9 Alex Bennée
@ 2019-05-31  7:56   ` Stefano Garzarella
  2019-05-31  8:16     ` Alex Bennée
  0 siblings, 1 reply; 43+ messages in thread
From: Stefano Garzarella @ 2019-05-31  7:56 UTC (permalink / raw)
  To: Alex Bennée; +Cc: Fam Zheng, Philippe Mathieu-Daudé, qemu-devel

On Thu, May 30, 2019 at 11:15:44AM +0100, Alex Bennée wrote:
> The toolchain PPA has it so we might as well use it.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  .travis.yml | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index b053a836a32..f0aa37f2d12 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -240,8 +240,8 @@ matrix:
>              - ubuntu-toolchain-r-test
>            packages:
>              # Extra toolchains
> -            - gcc-7
> -            - g++-7
> +            - gcc-9
> +            - g++-9
>              # Build dependencies
>              - libaio-dev
>              - libattr1-dev
> @@ -270,11 +270,11 @@ matrix:
>        language: generic
>        compiler: none
>        env:
> -        - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7
> -        - CONFIG="--cc=gcc-7 --cxx=g++-7 --disable-pie --disable-linux-user"
> +        - COMPILER_NAME=gcc CXX=g++-9 CC=gcc-9
> +        - CONFIG="--cc=gcc-9 --cxx=g++-9 --disable-pie --disable-linux-user"
>          - TEST_CMD=""
>        before_script:
> -        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
> +        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -Wno-error=stringop-truncation -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
>  

What about describing in the commit message that we are adding
'-Wno-error=stringop-truncation' in the cflags?

Thanks,
Stefano


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text
  2019-05-31  6:49   ` Philippe Mathieu-Daudé
@ 2019-05-31  8:15     ` Alex Bennée
  0 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-31  8:15 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Fam Zheng, Thomas Huth, qemu-devel, Wainer dos Santos Moschetta,
	Gerd Hoffmann


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Hi  Alex,
>
> On 5/30/19 12:15 PM, Alex Bennée wrote:
>> From: Gerd Hoffmann <kraxel@redhat.com>
>>
>> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Thomas Huth <thuth@redhat.com>
>> Message-Id: <20190520124716.30472-9-kraxel@redhat.com>
>> [AJB: fix minor conflict]
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  tests/vm/Makefile.include | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tests/vm/Makefile.include b/tests/vm/Makefile.include
>> index e329129bd65..628eecade78 100644
>> --- a/tests/vm/Makefile.include
>> +++ b/tests/vm/Makefile.include
>> @@ -25,6 +25,8 @@ vm-test:
>>  	@echo "  vm-boot-ssh-<guest>             - Boot guest and login via ssh"
>>  	@echo
>>  	@echo "Special variables:"
>> +	@echo "    DEBUG=1                       - be verbose, also start interactive"
>> +	@echo "	                                   shell on build failures"
>
> Patch 12 of this series (tests/vm: Add missing variables on help)
> already added this, it now appears 2 times:
>
> Special variables:
>     DEBUG=1                       - be verbose, also start interactive
>                                            shell on build failures
>     DEBUG=1                      - Enable verbose output on host and
> interactive debugging
>
> This one is more precise although...

Oops merge failure - will fix that.

>
>>  	@echo "    BUILD_TARGET=foo		 - Override the build target"
>>  	@echo "    TARGET_LIST=a,b,c    	 - Override target list in builds"
>>  	@echo '    EXTRA_CONFIGURE_OPTS="..."'
>>


--
Alex Bennée


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9
  2019-05-31  7:56   ` Stefano Garzarella
@ 2019-05-31  8:16     ` Alex Bennée
  0 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-05-31  8:16 UTC (permalink / raw)
  To: Stefano Garzarella; +Cc: Fam Zheng, Philippe Mathieu-Daudé, qemu-devel


Stefano Garzarella <sgarzare@redhat.com> writes:

> On Thu, May 30, 2019 at 11:15:44AM +0100, Alex Bennée wrote:
>> The toolchain PPA has it so we might as well use it.
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> ---
>>  .travis.yml | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/.travis.yml b/.travis.yml
>> index b053a836a32..f0aa37f2d12 100644
>> --- a/.travis.yml
>> +++ b/.travis.yml
>> @@ -240,8 +240,8 @@ matrix:
>>              - ubuntu-toolchain-r-test
>>            packages:
>>              # Extra toolchains
>> -            - gcc-7
>> -            - g++-7
>> +            - gcc-9
>> +            - g++-9
>>              # Build dependencies
>>              - libaio-dev
>>              - libattr1-dev
>> @@ -270,11 +270,11 @@ matrix:
>>        language: generic
>>        compiler: none
>>        env:
>> -        - COMPILER_NAME=gcc CXX=g++-7 CC=gcc-7
>> -        - CONFIG="--cc=gcc-7 --cxx=g++-7 --disable-pie --disable-linux-user"
>> +        - COMPILER_NAME=gcc CXX=g++-9 CC=gcc-9
>> +        - CONFIG="--cc=gcc-9 --cxx=g++-9 --disable-pie --disable-linux-user"
>>          - TEST_CMD=""
>>        before_script:
>> -        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
>> +        - ./configure ${CONFIG} --extra-cflags="-g3 -O0 -Wno-error=stringop-truncation -fsanitize=thread -fuse-ld=gold" || { cat config.log && exit 1; }
>>
>
> What about describing in the commit message that we are adding
> '-Wno-error=stringop-truncation' in the cflags?

I was sure I'd written that commit message, but obviously only in my
head. Will update.

>
> Thanks,
> Stefano


--
Alex Bennée


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again
  2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again Alex Bennée
@ 2019-06-07  9:33   ` Alex Bennée
  2019-07-15 11:06     ` Thomas Huth
  0 siblings, 1 reply; 43+ messages in thread
From: Alex Bennée @ 2019-06-07  9:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth


Alex Bennée <alex.bennee@linaro.org> writes:

> From: Thomas Huth <thuth@redhat.com>
>
> People often forget to run the iotests before submitting patches or
> pull requests - this is likely due to the fact that we do not run the
> tests during our mandatory "make check" tests yet. Now that we've got
> a proper "auto" group of iotests that should be fine to run in every
> environment, we can enable the iotests during "make check" again by
> running the "auto" tests by default from the check-block.sh script.
>
> Some cases still need to be checked first, though: iotests need bash
> and GNU sed (otherwise they fail), and if gprof is enabled, it spoils
> the output of some test cases causing them to fail. So if we detect
> that one of the required programs is missing or that gprof is enabled,
> we still have to skip the iotests to avoid failures.

Thomas,

I've dropped this from the latest PR because I'm still seeing problems
in some places. One of the issues is tests failing when the underlying
file system doesn't support O_DIRECT. Some tests seem to have explicit
feature checks for this but others just fail.

--
Alex Bennée


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again
  2019-06-07  9:33   ` Alex Bennée
@ 2019-07-15 11:06     ` Thomas Huth
  2019-07-15 11:58       ` Alex Bennée
  0 siblings, 1 reply; 43+ messages in thread
From: Thomas Huth @ 2019-07-15 11:06 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 07/06/2019 11.33, Alex Bennée wrote:
> 
> Alex Bennée <alex.bennee@linaro.org> writes:
> 
>> From: Thomas Huth <thuth@redhat.com>
>>
>> People often forget to run the iotests before submitting patches or
>> pull requests - this is likely due to the fact that we do not run the
>> tests during our mandatory "make check" tests yet. Now that we've got
>> a proper "auto" group of iotests that should be fine to run in every
>> environment, we can enable the iotests during "make check" again by
>> running the "auto" tests by default from the check-block.sh script.
>>
>> Some cases still need to be checked first, though: iotests need bash
>> and GNU sed (otherwise they fail), and if gprof is enabled, it spoils
>> the output of some test cases causing them to fail. So if we detect
>> that one of the required programs is missing or that gprof is enabled,
>> we still have to skip the iotests to avoid failures.
> 
> Thomas,
> 
> I've dropped this from the latest PR because I'm still seeing problems
> in some places. One of the issues is tests failing when the underlying
> file system doesn't support O_DIRECT. Some tests seem to have explicit
> feature checks for this but others just fail.

Ok, back at the keyboard, I'm now working on a patch that removes more
tests from the "auto" group. Do you happen to have a list of the tests
that were failing for you?
Or can you tell me which file systems do not support O_DIRECT, so I can
check it on my own?

 Thomas


^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again
  2019-07-15 11:06     ` Thomas Huth
@ 2019-07-15 11:58       ` Alex Bennée
  0 siblings, 0 replies; 43+ messages in thread
From: Alex Bennée @ 2019-07-15 11:58 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel


Thomas Huth <thuth@redhat.com> writes:

> On 07/06/2019 11.33, Alex Bennée wrote:
>>
>> Alex Bennée <alex.bennee@linaro.org> writes:
>>
>>> From: Thomas Huth <thuth@redhat.com>
>>>
>>> People often forget to run the iotests before submitting patches or
>>> pull requests - this is likely due to the fact that we do not run the
>>> tests during our mandatory "make check" tests yet. Now that we've got
>>> a proper "auto" group of iotests that should be fine to run in every
>>> environment, we can enable the iotests during "make check" again by
>>> running the "auto" tests by default from the check-block.sh script.
>>>
>>> Some cases still need to be checked first, though: iotests need bash
>>> and GNU sed (otherwise they fail), and if gprof is enabled, it spoils
>>> the output of some test cases causing them to fail. So if we detect
>>> that one of the required programs is missing or that gprof is enabled,
>>> we still have to skip the iotests to avoid failures.
>>
>> Thomas,
>>
>> I've dropped this from the latest PR because I'm still seeing problems
>> in some places. One of the issues is tests failing when the underlying
>> file system doesn't support O_DIRECT. Some tests seem to have explicit
>> feature checks for this but others just fail.
>
> Ok, back at the keyboard, I'm now working on a patch that removes more
> tests from the "auto" group. Do you happen to have a list of the tests
> that were failing for you?

  Not run: 045 059 064 070 075 077 078 081 084 088 092 094 101 106 113 116 119 123 128 131 146 148 160 162 171 175 211 212 213 221 225 231 233 237 239 241 253
  Some cases not run in: 139
  Failures: 082 102 243 250
  Failed 4 of 138 tests
  /home/alex.bennee/lsrc/qemu.git/tests/Makefile.include:1095: recipe for target 'check-tests/qemu-iotests-quick.sh' failed

> Or can you tell me which file systems do not support O_DIRECT, so I can
> check it on my own?

ZFS on Linux:

  hackpool-0/home/alex.bennee on /home/alex.bennee type zfs (rw,nosuid,nodev,noatime,xattr,noacl)

>
>  Thomas


--
Alex Bennée


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2019-07-15 11:58 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-30 10:15 [Qemu-devel] [PATCH v1 00/26] testing/next queue (iotests, docker, tests/vm) Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 01/26] editorconfig: add setting for shell scripts Alex Bennée
2019-05-30 18:15   ` Richard Henderson
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 02/26] qemu-io-cmds: use clock_gettime for benchmarking Alex Bennée
2019-05-30 18:41   ` Richard Henderson
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 03/26] tests: Run the iotests during "make check" again Alex Bennée
2019-06-07  9:33   ` Alex Bennée
2019-07-15 11:06     ` Thomas Huth
2019-07-15 11:58       ` Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 04/26] tests/docker: Update the Fedora image to Fedora 30 Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 05/26] tests/docker: Update the Fedora cross compile images to 30 Alex Bennée
2019-05-30 18:43   ` Richard Henderson
2019-05-31  6:54   ` Philippe Mathieu-Daudé
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 06/26] tests/docker: Update the Ubuntu image to 19.04 Alex Bennée
2019-05-30 18:44   ` Richard Henderson
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 07/26] .travis.yml: bump gcc sanitiser job to gcc-9 Alex Bennée
2019-05-31  7:56   ` Stefano Garzarella
2019-05-31  8:16     ` Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 08/26] .travis.yml: add clang ubsan job Alex Bennée
2019-05-31  6:21   ` Philippe Mathieu-Daudé
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 09/26] tests/vm: Use python configured on build Alex Bennée
2019-05-31  6:22   ` Philippe Mathieu-Daudé
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 10/26] tests/vm: Port basevm to Python 3 Alex Bennée
2019-05-31  6:22   ` Philippe Mathieu-Daudé
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 11/26] tests/vm: Fix build-centos docker-based tests run Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 12/26] tests/vm: Add missing variables on help Alex Bennée
2019-05-31  6:45   ` Philippe Mathieu-Daudé
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 13/26] scripts: use git archive in archive-source Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 14/26] tests/vm: python3 fixes Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 15/26] tests/vm: send proxy environment variables over ssh Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 16/26] tests/vm: use ssh with pty unconditionally Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 17/26] tests/vm: run test builds on snapshot Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 18/26] tests/vm: proper guest shutdown Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 19/26] tests/vm: add vm-boot-{ssh, serial}-<guest> targets Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 20/26] tests/vm: add DEBUG=1 to help text Alex Bennée
2019-05-31  6:49   ` Philippe Mathieu-Daudé
2019-05-31  8:15     ` Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 21/26] tests/vm: serial console support helpers Alex Bennée
2019-05-30 10:15 ` [Qemu-devel] [PATCH v1 22/26] tests/vm: openbsd autoinstall, using serial console Alex Bennée
2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 23/26] tests/vm: freebsd " Alex Bennée
2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 24/26] tests/vm: netbsd " Alex Bennée
2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 25/26] tests/vm: fedora " Alex Bennée
2019-05-30 10:16 ` [Qemu-devel] [PATCH v1 26/26] tests/vm: ubuntu.i386: apt proxy setup Alex Bennée

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.