diff mbox series

[v1] kvm: main returns int

Message ID 20220913202853.1808453-1-edliaw@google.com
State Rejected
Headers show
Series [v1] kvm: main returns int | expand

Commit Message

Edward Liaw Sept. 13, 2022, 8:28 p.m. UTC
---
I think the test framework expects main to return int, is this correct?
---

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 testcases/kernel/kvm/include/kvm_guest.h | 2 +-
 testcases/kernel/kvm/kvm_pagefault01.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin Doucha Sept. 14, 2022, 9:04 a.m. UTC | #1
On 13. 09. 22 22:28, Edward Liaw via ltp wrote:
> ---
> I think the test framework expects main to return int, is this correct?

No, the test framework does not expect any return value from main(). 
This is also written in KVM test documentation in the last paragraph of 
"Basic KVM test structure":
https://github.com/linux-test-project/ltp/wiki/KVM-Test-API

Redefining the return type to int will not break anything but the value 
will be ignored. Test results are passed through a special memory buffer 
using tst_res() and tst_brk() functions.
diff mbox series

Patch

diff --git a/testcases/kernel/kvm/include/kvm_guest.h b/testcases/kernel/kvm/include/kvm_guest.h
index ec13c5845..4a4be3f39 100644
--- a/testcases/kernel/kvm/include/kvm_guest.h
+++ b/testcases/kernel/kvm/include/kvm_guest.h
@@ -15,7 +15,7 @@ 
 #undef TRERRNO
 
 #define TST_TEST_TCONF(message) \
-	void main(void) { tst_brk(TCONF, message); }
+	int main(void) { tst_brk(TCONF, message); }
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
diff --git a/testcases/kernel/kvm/kvm_pagefault01.c b/testcases/kernel/kvm/kvm_pagefault01.c
index e355fa448..dc92c7b66 100644
--- a/testcases/kernel/kvm/kvm_pagefault01.c
+++ b/testcases/kernel/kvm/kvm_pagefault01.c
@@ -45,7 +45,7 @@  int handle_page_fault(void *userdata, struct kvm_interrupt_frame *ifrm,
 	return 0;
 }
 
-void main(void)
+int main(void)
 {
 	uintptr_t tmp;
 	struct page_table_entry_pae *subpte, *pte = kvm_pagetable;