Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Andrew Jones <drjones@redhat.com>
Signed-off-by: Yanan Wang <wangyanan55@huawei.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Message-Id: <20210330080856.14940-5-wangyanan55@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Yanan Wang and committed by
Paolo Bonzini
c412d6ac fa76c775

+2 -2
+2 -2
tools/testing/selftests/kvm/lib/assert.c
··· 71 71 72 72 fprintf(stderr, "==== Test Assertion Failure ====\n" 73 73 " %s:%u: %s\n" 74 - " pid=%d tid=%d - %s\n", 74 + " pid=%d tid=%d errno=%d - %s\n", 75 75 file, line, exp_str, getpid(), _gettid(), 76 - strerror(errno)); 76 + errno, strerror(errno)); 77 77 test_dump_stack(); 78 78 if (fmt) { 79 79 fputs(" ", stderr);