[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mini-os master] mini-os: put sanity_check() under CONFIG_TEST



commit dc3b68bf37f401c98d598e37344a73a60a4a67e9
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Tue Jul 30 11:50:02 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jul 30 11:50:02 2024 +0200

    mini-os: put sanity_check() under CONFIG_TEST
    
    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@xxxxxxxx>
    Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
---
 include/lib.h | 2 ++
 mm.c          | 2 ++
 test.c        | 1 +
 3 files changed, 5 insertions(+)

diff --git a/include/lib.h b/include/lib.h
index abd4e9a..de67bab 100644
--- a/include/lib.h
+++ b/include/lib.h
@@ -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 4aa0c6c..a5d3f5e 100644
--- 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 465c54e..4dd6e26 100644
--- 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);
     }
 }
--
generated by git-patchbot for /home/xen/git/mini-os.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.