2 * Copyright (c) 2016 Proofpoint, Inc. and its suppliers.
5 * By using this file, you agree to the terms and conditions set
6 * forth in the LICENSE file which can be found at the top level of
7 * the sendmail distribution.
18 # include <sm/string.h>
20 # include <sm/notify.h>
25 ** MSGTEST -- test of message queue.
28 ** owner -- create message queue.
42 #define TSTSTR "qf0001"
44 r = sm_notify_start(owner, 0);
47 perror("sm_notify_start failed");
53 len = sm_strlcpy(buf, TSTSTR, sizeof(buf));
54 r = sm_notify_snd(buf, len);
64 r = sm_notify_rcv(buf, sizeof(buf), 5);
68 if (r > 0 && r < sizeof(buf))
70 buf[sizeof(buf) - 1] = '\0';
71 SM_TEST(strcmp(buf, TSTSTR) == 0);
72 fprintf(stderr, "buf=\"%s\"\n", buf);
87 while ((ch = getopt(argc, argv, OPTIONS)) != -1)
96 r = sm_notify_init(0);
99 perror("sm_notify_init failed\n");
103 if ((pid = fork()) < 0)
105 perror("fork failed\n");
109 sm_test_begin(argc, argv, "test notify");
112 /* give the parent the chance to setup data */
114 r = notifytest(false);
118 r = notifytest(true);
121 return sm_test_end();