summaryrefslogtreecommitdiff
path: root/test/tx/cmake/module_qemu/src/harness.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/tx/cmake/module_qemu/src/harness.h')
-rw-r--r--test/tx/cmake/module_qemu/src/harness.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/tx/cmake/module_qemu/src/harness.h b/test/tx/cmake/module_qemu/src/harness.h
new file mode 100644
index 00000000..9145531b
--- /dev/null
+++ b/test/tx/cmake/module_qemu/src/harness.h
@@ -0,0 +1,70 @@
+/***************************************************************************
+ * Copyright (c) 2026 Eclipse ThreadX contributors
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the MIT License which is available at
+ * https://opensource.org/licenses/MIT.
+ *
+ * AI Disclosure: This file was largely AI-generated by Claude Code (Opus 5.5).
+ * The AI-generated portions may be considered public domain (CC0-1.0)
+ * and not subject to the project's licence. The human contributor has
+ * reviewed and verified that the code is correct.
+ *
+ * SPDX-License-Identifier: MIT and CC0-1.0
+ **************************************************************************/
+
+
+/**************************************************************************/
+/**************************************************************************/
+/** */
+/** ThreadX Test */
+/** */
+/** Module execution harness: manager-side reporting */
+/** */
+/**************************************************************************/
+/**************************************************************************/
+
+#ifndef HARNESS_H
+#define HARNESS_H
+
+#include "tx_api.h"
+#include "txm_module.h"
+
+/* Record one expectation; a failed one is printed and makes the image fail. */
+VOID harness_expect(const CHAR *description, ULONG actual, ULONG expected);
+
+/* Print a line, or a labelled value, over semihosting. */
+VOID harness_print(const CHAR *text);
+VOID harness_value(const CHAR *label, ULONG value);
+
+/* Print the verdict and end the simulation; never returns. */
+VOID harness_finish(VOID);
+
+/* Wait, in ticks, until a module writes the done word or the limit passes.
+ Returns TX_TRUE if the module finished. */
+UINT harness_wait_for_module(ULONG limit_ticks);
+
+/* Clear the shared area and grant it to a module. */
+VOID harness_shared_clear(VOID);
+UINT harness_shared_grant(TXM_MODULE_INSTANCE *module_instance);
+
+/* What the memory fault notification has seen. */
+extern volatile ULONG harness_fault_count;
+extern TX_THREAD * volatile harness_fault_thread;
+extern TXM_MODULE_INSTANCE * volatile harness_fault_module;
+extern volatile ULONG harness_fault_address;
+extern volatile ULONG harness_fault_status;
+
+VOID harness_fault_notify(TX_THREAD *thread_ptr, TXM_MODULE_INSTANCE *module_instance);
+
+/* The memory handed to the Module Manager, shared by every test image. */
+extern UCHAR harness_module_memory[];
+extern UCHAR harness_object_memory[];
+
+#define HARNESS_MODULE_MEMORY_SIZE ((ULONG) 65536UL)
+#define HARNESS_OBJECT_MEMORY_SIZE ((ULONG) 16384UL)
+
+/* Each test image defines this; it runs on the manager thread. */
+VOID harness_test(VOID);
+
+#endif