From a7b4384fefbd1cbe05c8fd10fe06de8c4fdc2792 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 22 Jan 2020 02:20:36 -0500 Subject: bios-tables-test: tell people how to update For now just a pointer to the source file. Signed-off-by: Michael S. Tsirkin Reviewed-by: Laurent Vivier Reviewed-by: Thomas Huth --- tests/qtest/bios-tables-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index b4752c6..9c3c468 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -426,7 +426,9 @@ static void test_acpi_asl(test_data *data) fprintf(stderr, "acpi-test: Warning! %.4s binary file mismatch. " - "Actual [aml:%s], Expected [aml:%s].\n", + "Actual [aml:%s], Expected [aml:%s].\n" + "See source file tests/qtest/bios-tables-test.c " + "for instructions on how to update expected files.\n", exp_sdt->aml, sdt->aml_file, exp_sdt->aml_file); all_tables_match = all_tables_match && -- cgit v1.1 From c01e905f3a34088346833f3a5518cb0efeb24e27 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 22 Jan 2020 02:21:18 -0500 Subject: bios-tables-test: fix up DIFF generation Turns out it goes to stdout which is suppressed even with V=1. Force DIFF output to stderr to make it visible. Signed-off-by: Michael S. Tsirkin --- tests/qtest/bios-tables-test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c index 9c3c468..1aed0ee 100644 --- a/tests/qtest/bios-tables-test.c +++ b/tests/qtest/bios-tables-test.c @@ -463,13 +463,19 @@ static void test_acpi_asl(test_data *data) "Actual [asl:%s, aml:%s], Expected [asl:%s, aml:%s].\n", exp_sdt->aml, sdt->asl_file, sdt->aml_file, exp_sdt->asl_file, exp_sdt->aml_file); + fflush(stderr); if (getenv("V")) { const char *diff_cmd = getenv("DIFF"); if (diff_cmd) { - int ret G_GNUC_UNUSED; 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 " -- cgit v1.1 From 34b1429ca92eae5bb2a532d5596f6150ea17150a Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 22 Jan 2020 02:24:54 -0500 Subject: 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 --- tests/qtest/bios-tables-test.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'tests') 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); } } } -- cgit v1.1 From 6ab425d8a10226098c29971f74b5fa954d5498d6 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Wed, 22 Jan 2020 03:02:43 -0500 Subject: rebuild-expected-aml.sh: remind about the process Remind users of rebuild-expected-aml.sh about the process to follow. Suppress the warning if allowed file list exists - that's a big hint user is already aware of the process. Signed-off-by: Michael S. Tsirkin --- tests/data/acpi/rebuild-expected-aml.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/data/acpi/rebuild-expected-aml.sh b/tests/data/acpi/rebuild-expected-aml.sh index d44e511..9cbaab1 100755 --- a/tests/data/acpi/rebuild-expected-aml.sh +++ b/tests/data/acpi/rebuild-expected-aml.sh @@ -31,6 +31,13 @@ done eval `grep SRC_PATH= config-host.mak` +old_allowed_dif=`grep -v -e 'List of comma-separated changed AML files to ignore' ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h` + echo '/* List of comma-separated changed AML files to ignore */' > ${SRC_PATH}/tests/qtest/bios-tables-test-allowed-diff.h echo "The files were rebuilt and can be added to git." + +if [ -z "$old_allowed_dif" ]; then + echo "Note! Please do not commit expected files with source changes" + echo "Note! Please follow the process documented in ${SRC_PATH}/tests/qtest/bios-tables-test.c" +fi -- cgit v1.1