qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <lvivier@redhat.com>,
	Igor Mammedov <imammedo@redhat.com>,
	Thomas Huth <thuth@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 3/5] bios-tables-test: default diff command
Date: Wed, 22 Jan 2020 03:05:58 -0500	[thread overview]
Message-ID: <20200122080538.591734-4-mst@redhat.com> (raw)
In-Reply-To: <20200122080538.591734-1-mst@redhat.com>

Most people probably just want diff -u. So let's use that
as the default.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 tests/qtest/bios-tables-test.c | 27 ++++++++++-----------------
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index c8db2839b2..6ec1c5be64 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -465,24 +465,17 @@ static void test_acpi_asl(test_data *data)
                         exp_sdt->asl_file, exp_sdt->aml_file);
                 fflush(stderr);
                 if (getenv("V")) {
-                    const char *diff_cmd = getenv("DIFF");
-                    if (diff_cmd) {
-                        char *diff = g_strdup_printf("%s %s %s", diff_cmd,
-                            exp_sdt->asl_file, sdt->asl_file);
-                        int out = dup(STDOUT_FILENO);
-                        int ret G_GNUC_UNUSED;
+                    const char *diff_env = getenv("DIFF");
+                    const char *diff_cmd = diff_env ? diff_env : "diff -u";
+                    char *diff = g_strdup_printf("%s %s %s", diff_cmd,
+                                                 exp_sdt->asl_file, sdt->asl_file);
+                    int out = dup(STDOUT_FILENO);
+                    int ret G_GNUC_UNUSED;
 
-                        dup2(STDERR_FILENO, STDOUT_FILENO);
-                        ret = system(diff) ;
-                        dup2(out, STDOUT_FILENO);
-                        g_free(diff);
-                    } else {
-                        fprintf(stderr, "acpi-test: Warning. not showing "
-                            "difference since no diff utility is specified. "
-                            "Set 'DIFF' environment variable to a preferred "
-                            "diff utility and run 'make V=1 check' again to "
-                            "see ASL difference.");
-                    }
+                    dup2(STDERR_FILENO, STDOUT_FILENO);
+                    ret = system(diff) ;
+                    dup2(out, STDOUT_FILENO);
+                    g_free(diff);
                 }
             }
         }
-- 
MST



  parent reply	other threads:[~2020-01-22  8:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22  8:05 [PATCH 0/5] bios-tables-test: more documentation Michael S. Tsirkin
2020-01-22  8:05 ` [PATCH 1/5] bios-tables-test: tell people how to update Michael S. Tsirkin
2020-01-22  8:25   ` Laurent Vivier
2020-01-22  9:17   ` Thomas Huth
2020-01-22  8:05 ` [PATCH 2/5] bios-tables-test: fix up DIFF generation Michael S. Tsirkin
2020-01-22  9:00   ` Laurent Vivier
2020-01-22  9:13     ` Michael S. Tsirkin
2020-01-22  8:05 ` Michael S. Tsirkin [this message]
2020-01-22  8:06 ` [PATCH 4/5] bios-tables-test: fix path to allowed diff Michael S. Tsirkin
2020-01-22  8:51   ` Laurent Vivier
2020-01-22  9:18   ` Thomas Huth
2020-01-22  8:06 ` [PATCH 5/5] rebuild-expected-aml.sh: remind about the process Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200122080538.591734-4-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).