]> xenbits.xensource.com Git - libvirt.git/commit
tests: Ensure test files are newline-terminated
authorAndrea Bolognani <abologna@redhat.com>
Fri, 5 Jan 2024 11:02:43 +0000 (12:02 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Fri, 5 Jan 2024 13:38:49 +0000 (14:38 +0100)
commit8a743a598bfc3812eb01f605af8eef4ca7f95649
tree7af374ace146addd73851ea715a13526d6f9de0e
parent2439e7135c1a7779ae13c4612b33946ea832a600
tests: Ensure test files are newline-terminated

Currently we only append a newline to 'actual' if 'expected'
(as loaded from file) already ends in a newline, but that
results in inconsistent behavior.

For example, some of the test files used by virhostcputest are
newline-terminated and some aren't. If we were to remove
existing newlines from those files or add them where they
aren't present, the test would still pass, and even using
VIR_TEST_REGENERATE_OUTPUT=1 wouldn't change them back.

Make things consistent by ensuring that 'actual' is always
newline-terminated. The only exception is when 'actual' is
completely empty: in that case, we want the file to be actually
empty, not contain a single empty line. query-jobs-empty.result
in qemumonitorjsondata/ is an example of this being used.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
22 files changed:
tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-create.json
tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-define.json
tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-create.json
tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-define.json
tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-create.json
tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-define.json
tests/qemunbdkitdata/disk-cdrom-network.args.disk1.pipe.778
tests/qemunbdkitdata/disk-cdrom-network.args.disk2.pipe.780
tests/qemunbdkitdata/disk-network-http.args.disk2.pipe.778
tests/qemunbdkitdata/disk-network-http.args.disk3.pipe.780
tests/qemunbdkitdata/disk-network-source-curl-nbdkit-backing.args.disk0.pipe.778
tests/qemunbdkitdata/disk-network-source-curl.args.disk0.pipe.778
tests/qemunbdkitdata/disk-network-source-curl.args.disk1.pipe.780
tests/qemunbdkitdata/disk-network-source-curl.args.disk1.pipe.782
tests/qemunbdkitdata/disk-network-source-curl.args.disk2.pipe.784
tests/qemunbdkitdata/disk-network-ssh-password.args.disk0.pipe.778
tests/testutils.c
tests/virhostcpudata/linux-ppc64-deconf-cpus.signature
tests/virhostcpudata/linux-ppc64-subcores1.signature
tests/virhostcpudata/linux-ppc64-subcores2.signature
tests/virhostcpudata/linux-ppc64-subcores3.signature
tests/virhostcpudata/linux-s390x-with-frequency.signature