Skip to contentSkip to conversation

kvm: main returns int

PATCH In review Edward Liaw via ltp 2 participants 2 messages Sep 13, 2022 – Sep 14, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: main returns int

---
I think the test framework expects main to return int, is this correct?
---

---
 testcases/kernel/kvm/include/kvm_guest.h | 2 +-
 testcases/kernel/kvm/kvm_pagefault01.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/kvm/include/kvm_guest.h +1 -1
index ec13c5845..4a4be3f39 100644
@@ -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]))
 
testcases/kernel/kvm/kvm_pagefault01.c +1 -1
index e355fa448..dc92c7b66 100644
@@ -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;
Signature · 5 lines
2.37.2.789.g6183377224-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw
Quoted 2 lines · Edward Liaw via ltp

---
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.

Signature · 11 lines
Martin Doucha   [email protected]
QA Engineer for Software Maintenance
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp