mailtest utility for testing the mail subsystem
This commit is contained in:
6
mailtest/.gitignore
vendored
Normal file
6
mailtest/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
*.o
|
||||||
|
*.json
|
||||||
|
docs/
|
||||||
|
.cache/
|
||||||
|
*.map
|
||||||
|
mailtest
|
||||||
11
mailtest/Makefile
Normal file
11
mailtest/Makefile
Normal 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
1
mailtest/app.mk
Normal file
@@ -0,0 +1 @@
|
|||||||
|
app := mailtest
|
||||||
46
mailtest/mailtest.c
Normal file
46
mailtest/mailtest.c
Normal 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
3
mailtest/src.mk
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
c += mailtest.c
|
||||||
|
|
||||||
|
o += mailtest.o
|
||||||
@@ -3,7 +3,8 @@ apps := \
|
|||||||
spin \
|
spin \
|
||||||
ce \
|
ce \
|
||||||
sdutil \
|
sdutil \
|
||||||
usb
|
usb \
|
||||||
|
mailtest
|
||||||
|
|
||||||
all_apps:
|
all_apps:
|
||||||
@for d in $(apps); do make -C $$d platform=$(platform) all; done
|
@for d in $(apps); do make -C $$d platform=$(platform) all; done
|
||||||
|
|||||||
Reference in New Issue
Block a user