Commit c412d6ac authored by Yanan Wang's avatar Yanan Wang Committed by Paolo Bonzini
Browse files

KVM: selftests: Print the errno besides error-string in TEST_ASSERT



Print the errno besides error-string in TEST_ASSERT in the format of
"errno=%d - %s" will explicitly indicate that the string is an error
information. Besides, the errno is easier to be used for debugging
than the error-string.

Suggested-by: default avatarAndrew Jones <drjones@redhat.com>
Signed-off-by: default avatarYanan Wang <wangyanan55@huawei.com>
Reviewed-by: default avatarAndrew Jones <drjones@redhat.com>
Message-Id: <20210330080856.14940-5-wangyanan55@huawei.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent fa76c775
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -71,9 +71,9 @@ test_assert(bool exp, const char *exp_str,

		fprintf(stderr, "==== Test Assertion Failure ====\n"
			"  %s:%u: %s\n"
			"  pid=%d tid=%d - %s\n",
			"  pid=%d tid=%d errno=%d - %s\n",
			file, line, exp_str, getpid(), _gettid(),
			strerror(errno));
			errno, strerror(errno));
		test_dump_stack();
		if (fmt) {
			fputs("  ", stderr);