{"id":808893,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808893/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20170901180340.30009-4-eblake@redhat.com>","date":"2017-09-01T18:03:14","name":"[v6,03/29] test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"405165d240fb9077eb7b081a4d7a0d10c4e4a89d","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/1.0/people/6591/?format=json","name":"Eric Blake","email":"eblake@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/20170901180340.30009-4-eblake@redhat.com/mbox/","series":[{"id":1089,"url":"http://patchwork.ozlabs.org/api/1.0/series/1089/?format=json","date":"2017-09-01T18:03:12","name":"Preliminary libqtest cleanups","version":6,"mbox":"http://patchwork.ozlabs.org/series/1089/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808893/checks/","tags":{},"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xkRzT1BK3z9t3F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat,  2 Sep 2017 04:07:32 +1000 (AEST)","from localhost ([::1]:53090 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dnqLq-0001Z2-UJ\n\tfor incoming@patchwork.ozlabs.org; Fri, 01 Sep 2017 14:07:30 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:55596)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqII-0006ye-QS\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:52 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dnqIH-0001Sg-I0\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:50 -0400","from mx1.redhat.com ([209.132.183.28]:35918)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>) id 1dnqIH-0001S2-9q\n\tfor qemu-devel@nongnu.org; Fri, 01 Sep 2017 14:03:49 -0400","from smtp.corp.redhat.com\n\t(int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 5B6E6267C4\n\tfor <qemu-devel@nongnu.org>; Fri,  1 Sep 2017 18:03:48 +0000 (UTC)","from red.redhat.com (ovpn-121-149.rdu2.redhat.com [10.10.121.149])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id BF3EB627DE;\n\tFri,  1 Sep 2017 18:03:47 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 5B6E6267C4","From":"Eric Blake <eblake@redhat.com>","To":"qemu-devel@nongnu.org","Date":"Fri,  1 Sep 2017 13:03:14 -0500","Message-Id":"<20170901180340.30009-4-eblake@redhat.com>","In-Reply-To":"<20170901180340.30009-1-eblake@redhat.com>","References":"<20170901180340.30009-1-eblake@redhat.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.15","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tFri, 01 Sep 2017 18:03:48 +0000 (UTC)","Content-Transfer-Encoding":"quoted-printable","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","Subject":"[Qemu-devel] [PATCH v6 03/29] test-qga: Kill broken and dead\n\tQGA_TEST_SIDE_EFFECTING code","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"pbonzini@redhat.com, armbru@redhat.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Back when the test was introduced, in commit 62c39b307, the\ntest was set up to run qemu-ga directly on the host performing\nthe test, and defaults to limiting itself to safe commands.  At\nthe time, it was envisioned that setting QGA_TEST_SIDE_EFFECTING\nin the environment could cover a few more commands, while noting\nthe potential danger of those side effects running in the host.\n\nBut this has NEVER been tested: if you enable the environment\nvariable, the test WILL fail.  One obvious reason: if you are not\nrunning as root, you'll probably get a permission failure when\ntrying to freeze the file systems, or when changing system time.\nLess obvious: if you run the test as root (wow, you're brave), you\ncould end up hanging if the test tries to log things to a\ntemporarily frozen filesystem.  But the cutest reason of all: if\nyou get past the above hurdles, the test uses invalid JSON in\ntest_qga_fstrim() (missing '' around the dictionary key 'minimum'),\nand will thus fail an assertion in qmp_fd().\n\nRather than leave this untested time-bomb in place, rip it out.\nHopefully, as originally envisioned, we can find an opportunity\nto test an actual sandboxed guest where the guest-agent has\nfull permissions and will not unduly affect the host running\nthe test - if so, 'git revert' can be used if desired, for\nsalvaging any useful parts of this attempt.\n\nSigned-off-by: Eric Blake <eblake@redhat.com>\nReviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>\n---\n tests/test-qga.c | 90 --------------------------------------------------------\n 1 file changed, 90 deletions(-)","diff":"diff --git a/tests/test-qga.c b/tests/test-qga.c\nindex 06783e7585..fd6bc7690f 100644\n--- a/tests/test-qga.c\n+++ b/tests/test-qga.c\n@@ -642,65 +642,6 @@ static void test_qga_get_time(gconstpointer fix)\n     QDECREF(ret);\n }\n\n-static void test_qga_set_time(gconstpointer fix)\n-{\n-    const TestFixture *fixture = fix;\n-    QDict *ret;\n-    int64_t current, time;\n-    gchar *cmd;\n-\n-    /* get current time */\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-get-time'}\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    current = qdict_get_int(ret, \"return\");\n-    g_assert_cmpint(current, >, 0);\n-    QDECREF(ret);\n-\n-    /* set some old time */\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-set-time',\"\n-                 \" 'arguments': { 'time': 1000 } }\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    QDECREF(ret);\n-\n-    /* check old time */\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-get-time'}\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    time = qdict_get_int(ret, \"return\");\n-    g_assert_cmpint(time / 1000, <, G_USEC_PER_SEC * 10);\n-    QDECREF(ret);\n-\n-    /* set back current time */\n-    cmd = g_strdup_printf(\"{'execute': 'guest-set-time',\"\n-                          \" 'arguments': { 'time': %\" PRId64 \" } }\",\n-                          current + time * 1000);\n-    ret = qmp_fd(fixture->fd, cmd);\n-    g_free(cmd);\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    QDECREF(ret);\n-}\n-\n-static void test_qga_fstrim(gconstpointer fix)\n-{\n-    const TestFixture *fixture = fix;\n-    QDict *ret;\n-    QList *list;\n-    const QListEntry *entry;\n-\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-fstrim',\"\n-                 \" arguments: { minimum: 4194304 } }\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    list = qdict_get_qlist(ret, \"return\");\n-    entry = qlist_first(list);\n-    g_assert(qdict_haskey(qobject_to_qdict(entry->value), \"paths\"));\n-\n-    QDECREF(ret);\n-}\n-\n static void test_qga_blacklist(gconstpointer data)\n {\n     TestFixture fix;\n@@ -831,30 +772,6 @@ static void test_qga_fsfreeze_status(gconstpointer fix)\n     QDECREF(ret);\n }\n\n-static void test_qga_fsfreeze_and_thaw(gconstpointer fix)\n-{\n-    const TestFixture *fixture = fix;\n-    QDict *ret;\n-    const gchar *status;\n-\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-fsfreeze-freeze'}\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    QDECREF(ret);\n-\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-fsfreeze-status'}\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    status = qdict_get_try_str(ret, \"return\");\n-    g_assert_cmpstr(status, ==, \"frozen\");\n-    QDECREF(ret);\n-\n-    ret = qmp_fd(fixture->fd, \"{'execute': 'guest-fsfreeze-thaw'}\");\n-    g_assert_nonnull(ret);\n-    qmp_assert_no_error(ret);\n-    QDECREF(ret);\n-}\n-\n static void test_qga_guest_exec(gconstpointer fix)\n {\n     const TestFixture *fixture = fix;\n@@ -1029,13 +946,6 @@ int main(int argc, char **argv)\n     g_test_add_data_func(\"/qga/guest-get-osinfo\", &fix,\n                          test_qga_guest_get_osinfo);\n\n-    if (g_getenv(\"QGA_TEST_SIDE_EFFECTING\")) {\n-        g_test_add_data_func(\"/qga/fsfreeze-and-thaw\", &fix,\n-                             test_qga_fsfreeze_and_thaw);\n-        g_test_add_data_func(\"/qga/set-time\", &fix, test_qga_set_time);\n-        g_test_add_data_func(\"/qga/fstrim\", &fix, test_qga_fstrim);\n-    }\n-\n     ret = g_test_run();\n\n     fixture_tear_down(&fix, NULL);\n","prefixes":["v6","03/29"]}