qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

test: execute g_test_run when tests are skipped

Sometimes a test's main() function recognizes that the environment
does not support the test, and therefore exits. In this case, we
still should run g_test_run() so that a TAP harness will print the
test plan ("1..0") and the test will be marked as skipped.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1543513531-1151-2-git-send-email-pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+9 -9
+1 -1
tests/cdrom-test.c
··· 169 169 170 170 if (exec_genisoimg(genisocheck)) { 171 171 /* genisoimage not available - so can't run tests */ 172 - return 0; 172 + return g_test_run(); 173 173 } 174 174 175 175 ret = prepare_image(arch, isoimage);
+2 -3
tests/ivshmem-test.c
··· 492 492 /* shm */ 493 493 tmpshm = mktempshm(TMPSHMSIZE, &fd); 494 494 if (!tmpshm) { 495 - return 0; 495 + goto out; 496 496 } 497 497 tmpshmem = mmap(0, TMPSHMSIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); 498 498 g_assert(tmpshmem != MAP_FAILED); ··· 514 514 } 515 515 } 516 516 517 + out: 517 518 ret = g_test_run(); 518 - 519 519 cleanup(); 520 - 521 520 return ret; 522 521 }
+4 -4
tests/migration-test.c
··· 789 789 g_test_init(&argc, &argv, NULL); 790 790 791 791 if (!ufd_version_check()) { 792 - return 0; 792 + return g_test_run(); 793 793 } 794 794 795 795 /* ··· 800 800 if (g_str_equal(qtest_get_arch(), "ppc64") && 801 801 access("/sys/module/kvm_hv", F_OK)) { 802 802 g_test_message("Skipping test: kvm_hv not available"); 803 - return 0; 803 + return g_test_run(); 804 804 } 805 805 806 806 /* ··· 811 811 #if defined(HOST_S390X) 812 812 if (access("/dev/kvm", R_OK | W_OK)) { 813 813 g_test_message("Skipping test: kvm not available"); 814 - return 0; 814 + return g_test_run(); 815 815 } 816 816 #else 817 817 g_test_message("Skipping test: Need s390x host to work properly"); 818 - return 0; 818 + return g_test_run(); 819 819 #endif 820 820 } 821 821
+2 -1
tests/test-crypto-pbkdf.c
··· 440 440 #else 441 441 int main(int argc, char **argv) 442 442 { 443 - return 0; 443 + g_test_init(&argc, &argv, NULL); 444 + return g_test_run(); 444 445 } 445 446 #endif