diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2020-01-22 02:24:54 -0500 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2020-02-25 08:23:18 -0500 |
commit | 34b1429ca92eae5bb2a532d5596f6150ea17150a (patch) | |
tree | ee3bde572d3fe435a36c9f13ed0421027a9a05de /tests | |
parent | c01e905f3a34088346833f3a5518cb0efeb24e27 (diff) | |
download | qemu-34b1429ca92eae5bb2a532d5596f6150ea17150a.zip qemu-34b1429ca92eae5bb2a532d5596f6150ea17150a.tar.gz qemu-34b1429ca92eae5bb2a532d5596f6150ea17150a.tar.bz2 |
bios-tables-test: default diff command
Most people probably just want diff -u. So let's use that
as the default.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qtest/bios-tables-test.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 1aed0ee..0a597bb 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -465,25 +465,18 @@ 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; - - dup2(STDERR_FILENO, STDOUT_FILENO); - ret = system(diff) ; - dup2(out, STDOUT_FILENO); - close(out); - 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."); - } + 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); + close(out); + g_free(diff); } } } |