]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
common: Introduce weak defaults for interfaces used by common code
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 Aug 2021 18:10:24 +0000 (19:10 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 17 Aug 2021 20:06:28 +0000 (21:06 +0100)
This avoids each architecture needing to implement stubs for possibly optional
functionality.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
build/files.mk
common/weak-defaults.c [new file with mode: 0644]
include/xtf/framework.h

index dfa27e481102bb637ce1fe999627ba86d3dd1ebf..5c1cc8d80edbdf4aea9851be39c732cb46c7d4d7 100644 (file)
@@ -16,6 +16,7 @@ obj-perarch += $(ROOT)/common/libc/vsnprintf.o
 obj-perarch += $(ROOT)/common/report.o
 obj-perarch += $(ROOT)/common/setup.o
 obj-perarch += $(ROOT)/common/xenbus.o
+obj-perarch += $(ROOT)/common/weak-defaults.o
 
 obj-perenv += $(ROOT)/arch/x86/decode.o
 obj-perenv += $(ROOT)/arch/x86/desc.o
diff --git a/common/weak-defaults.c b/common/weak-defaults.c
new file mode 100644 (file)
index 0000000..74cefeb
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * @file common/weak-defaults.c
+ *
+ * Default implementations of functions called by common code, which may need
+ * arch or environment specific implementations.
+ */
+#include <xtf/framework.h>
+
+const char __weak environment_description[] = "Unknown";
+
+void __weak arch_setup(void)
+{
+}
+
+void __weak test_setup(void)
+{
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
index a71bf39a03d1d03a7f3851dae1ad3e866659aa1b..4c6527e6ef96b0bea498fb039e8875077d13e798 100644 (file)
@@ -1,8 +1,19 @@
+/**
+ * @file include/xtf/framework.h
+ *
+ * Interfaces used by common code, needing to be implemented by
+ * arch/environment specific code.  Default stubs are provided in
+ * common/weak-defaults.c
+ */
 #ifndef XTF_FRAMEWORK_H
 #define XTF_FRAMEWORK_H
 
-/* To be implemented by each arch */
+#include <xtf/compiler.h>
+
+/* Set up exception handling, consoles, etc. */
 void arch_setup(void);
+
+/* Set up test-specific configuration. */
 void test_setup(void);
 
 /* Single line summary of execution environment. */