]> xenbits.xensource.com Git - mini-os.git/commitdiff
mini-os: put sanity_check() under CONFIG_TEST
authorJuergen Gross <jgross@suse.com>
Tue, 30 Jul 2024 09:50:02 +0000 (11:50 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 30 Jul 2024 09:50:02 +0000 (11:50 +0200)
Hide the sanity_check() function, as it is used nowhere. By putting it
under #ifdef CONFIG_TEST it will stay around, but it won't be
included in normal production builds.

Call sanity_check() from the periodic thread of the test app, causing
a sanity check every second.

Since any application linked with Mini-OS can't call sanity_check()
(there is no EXPORT_SYMBOL for it), there is zero chance of breaking
any use case.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
include/lib.h
mm.c
test.c

index abd4e9abead1be6dd86b7962a80ddc26dfccb326..de67bab0e0a9b600b38a1485f6c75e91eaf20c7c 100644 (file)
@@ -152,8 +152,10 @@ do {                                                           \
 
 #define BUG_ON(x) ASSERT(!(x))
 
+#ifdef CONFIG_TEST
 /* Consistency check as much as possible. */
 void sanity_check(void);
+#endif
 
 /* Get own domid. */
 domid_t get_domid(void);
diff --git a/mm.c b/mm.c
index 4aa0c6ca9db9ea368194f8525f5eb7104dac9485..a5d3f5e5e0b288151908bbf240b7e9e677aeff70 100644 (file)
--- a/mm.c
+++ b/mm.c
@@ -395,6 +395,7 @@ void fini_mm(void)
 {
 }
 
+#ifdef CONFIG_TEST
 void sanity_check(void)
 {
     int x;
@@ -410,3 +411,4 @@ void sanity_check(void)
         }
     }
 }
+#endif
diff --git a/test.c b/test.c
index 465c54e8295c0288a7a0ace1a3b7e7f99c49c3dc..4dd6e2606a1e04da12822819cca37e4c6ca885e7 100644 (file)
--- a/test.c
+++ b/test.c
@@ -185,6 +185,7 @@ static void periodic_thread(void *p)
     {
         gettimeofday(&tv, NULL);
         printk("T(s=%ld us=%ld)\n", tv.tv_sec, tv.tv_usec);
+        sanity_check();
         msleep(1000);
     }
 }