mailtest utility for testing the mail subsystem
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 3m6s
Build documentation / build-and-deploy (push) Successful in 2m57s

This commit is contained in:
2026-04-01 00:19:09 +02:00
parent 568283c089
commit 12fa3ee11b
6 changed files with 69 additions and 1 deletions

6
mailtest/.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
*.o
*.json
docs/
.cache/
*.map
mailtest

11
mailtest/Makefile Normal file
View File

@@ -0,0 +1,11 @@
include ../make/ufuncs.mk
$(eval $(call add_lib,libprocess))
$(eval $(call add_lib,libstring))
$(eval $(call add_lib,libmalloc))
$(eval $(call add_lib,libdebugconsole))
$(eval $(call add_lib,libaux))
cflags += -DPRINTF_INCLUDE_CONFIG_H=1
include ../make/user.mk

1
mailtest/app.mk Normal file
View File

@@ -0,0 +1 @@
app := mailtest

46
mailtest/mailtest.c Normal file
View File

@@ -0,0 +1,46 @@
#include <debugconsole.h>
#include <process_self.h>
#include <status.h>
#include <strconv.h>
#include <string.h>
#include <system.h>
void app_main (void) {
libprocess_self_init ();
char commandbuf[32];
memset (commandbuf, 0, sizeof (commandbuf));
char payloadbuf[32];
memset (payloadbuf, 0, sizeof (payloadbuf));
char procgroupbuf[32];
memset (procgroupbuf, 0, sizeof (procgroupbuf));
if (env_get (process_get_pgid (), "C", (void*)commandbuf, sizeof (commandbuf)) != ST_OK) {
return;
}
if (strcmp (commandbuf, "recv") == 0) {
char recv_buffer[1024];
for (;;) {
memset (recv_buffer, 0, sizeof (recv_buffer));
mail_receive (recv_buffer, sizeof (recv_buffer));
debug_printf ("%s\n", recv_buffer);
}
} else if (strcmp (commandbuf, "send") == 0) {
if (env_get (process_get_pgid (), "payload", (void*)payloadbuf, sizeof (payloadbuf)) != ST_OK) {
return;
}
if (env_get (process_get_pgid (), "pg", (void*)procgroupbuf, sizeof (procgroupbuf)) != ST_OK) {
return;
}
int pgid = str_to_uint32 (procgroupbuf);
debug_printf ("sending %s to PG %s (%d)\n", payloadbuf, procgroupbuf, pgid);
mail_send (pgid, payloadbuf, sizeof (payloadbuf));
}
}

3
mailtest/src.mk Normal file
View File

@@ -0,0 +1,3 @@
c += mailtest.c
o += mailtest.o

View File

@@ -3,7 +3,8 @@ apps := \
spin \
ce \
sdutil \
usb
usb \
mailtest
all_apps:
@for d in $(apps); do make -C $$d platform=$(platform) all; done