fix malloc-brk-fail
[libc-test] / src / functional / ipc_msg.c
index 477a3f4..b243d6d 100644 (file)
@@ -12,7 +12,7 @@
 #include "test.h"
 
 static const char path[] = ".";
-static const int id = 'x';
+static const int id = 'm';
 
 #define T(f) do{ \
        if ((f)+1 == 0) \
@@ -61,12 +61,14 @@ static void snd()
        EQ(qid_ds.msg_qnum, 0, "got %d, want %d");
        EQ(qid_ds.msg_lspid, 0, "got %d, want %d");
        EQ(qid_ds.msg_lrpid, 0, "got %d, want %d");
-       EQ((long)qid_ds.msg_stime, 0, "got %ld, want %d");
-       EQ((long)qid_ds.msg_rtime, 0, "got %ld, want %d");
+       EQ((long long)qid_ds.msg_stime, 0, "got %lld, want %d");
+       EQ((long long)qid_ds.msg_rtime, 0, "got %lld, want %d");
        if (qid_ds.msg_ctime < t)
-               t_error("qid_ds.msg_ctime >= t failed: got %ld, want %ld\n", (long)qid_ds.msg_ctime, (long)t);
+               t_error("qid_ds.msg_ctime >= t failed: got %lld, want >= %lld\n", (long long)qid_ds.msg_ctime, (long long)t);
+       if (qid_ds.msg_ctime > t+5)
+               t_error("qid_ds.msg_ctime <= t+5 failed: got %lld, want <= %lld\n", (long long)qid_ds.msg_ctime, (long long)t+5);
        if (qid_ds.msg_qbytes <= 0)
-               t_error("qid_ds.msg_qbytes > 0 failed: got %d, want 0\n", qid_ds.msg_qbytes, t);
+               t_error("qid_ds.msg_qbytes > 0 failed: got %d, want 0\n", qid_ds.msg_qbytes, t);
 
        /* test send */
        T(msgsnd(qid, &msg, sizeof msg.data, IPC_NOWAIT));
@@ -74,7 +76,9 @@ static void snd()
        EQ(qid_ds.msg_qnum, 1, "got %d, want %d");
        EQ(qid_ds.msg_lspid, getpid(), "got %d, want %d");
        if (qid_ds.msg_stime < t)
-               t_error("msg_stime is %ld want >= %ld\n", (long)qid_ds.msg_stime, (long)t);
+               t_error("msg_stime is %lld want >= %lld\n", (long long)qid_ds.msg_stime, (long long)t);
+       if (qid_ds.msg_stime > t+5)
+               t_error("msg_stime is %lld want <= %lld\n", (long long)qid_ds.msg_stime, (long long)t+5);
 }
 
 static void rcv()