Skip to content

Commit 15a7be0

Browse files
committed
lkl: tests: handler lkl_init failures
Check lkl_init for failures. Print the log buffer in case of failures, to make debugging easier. Signed-off-by: Octavian Purdila <tavip@google.com>
1 parent 79fd9f4 commit 15a7be0

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

tools/lkl/tests/boot.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,10 @@ int main(int argc, const char **argv)
780780

781781
lkl_host_ops.print = lkl_test_log;
782782

783-
lkl_init(&lkl_host_ops);
783+
if (lkl_init(&lkl_host_ops) < 0) {
784+
printf("%s\n", lkl_test_get_log());
785+
return 1;
786+
}
784787

785788
ret = lkl_test_run(tests, sizeof(tests)/sizeof(struct lkl_test),
786789
"boot");

tools/lkl/tests/disk-vfio-pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ int main(int argc, const char **argv)
109109

110110
lkl_host_ops.print = lkl_test_log;
111111

112-
lkl_init(&lkl_host_ops);
112+
if (lkl_init(&lkl_host_ops) < 0) {
113+
printf("%s\n", lkl_test_get_log());
114+
return 1;
115+
}
113116

114117
ret = lkl_test_run(tests, sizeof(tests) / sizeof(struct lkl_test),
115118
"disk-vfio-pci %s", cla.fstype);

tools/lkl/tests/disk.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ int main(int argc, const char **argv)
189189

190190
lkl_host_ops.print = lkl_test_log;
191191

192-
lkl_init(&lkl_host_ops);
192+
if (lkl_init(&lkl_host_ops) < 0) {
193+
printf("%s\n", lkl_test_get_log());
194+
return 1;
195+
}
193196

194197
ret = lkl_test_run(tests, sizeof(tests)/sizeof(struct lkl_test),
195198
"disk %s", cla.fstype);

0 commit comments

Comments
 (0)