Annotation of embedaddon/php/ext/sysvmsg/tests/004.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: msg_set_queue() and msg_stat_queue()
3: --SKIPIF--
4: <?php if (!extension_loaded("sysvmsg")) die("skip sysvmsg extension is not available")?>
5: --FILE--
6: <?php
7: $id = ftok(__FILE__, 'r');
8:
9: $q = msg_get_queue($id);
10:
11: echo "Set mode:\n";
12: $arr = array('msg_perm.mode' => 0600);
13: var_dump(msg_set_queue($q, $arr));
14: echo "Did really work:\n";
15: var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
16:
17: echo "Set uid:\n"; // same as the running user to make it succeed
18: $arr = array('msg_perm.uid' => getmyuid());
19: var_dump(msg_set_queue($q, $arr));
20: echo "Did really work:\n";
21: var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
22:
23: echo "Set gid:\n"; // same as the running user to make it succeed
24: $arr = array('msg_perm.gid' => getmygid());
25: var_dump(msg_set_queue($q, $arr));
26: echo "Did really work:\n";
27: var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
28:
29: echo "Set smaller qbytes:\n";
30: $res = msg_stat_queue($q);
31: $arr = array('msg_qbytes' => ($res['msg_qbytes'] -1));
32: var_dump(msg_set_queue($q, $arr));
33: echo "Did really work:\n";
34: var_dump(count(array_diff_assoc($arr, msg_stat_queue($q))) == 0);
35:
36: if (!msg_remove_queue($q)) {
37: echo "BAD: queue removal failed\n";
38: }
39:
40: echo "Done\n";
41: ?>
42: --EXPECTF--
43: Set mode:
44: bool(true)
45: Did really work:
46: bool(true)
47: Set uid:
48: bool(true)
49: Did really work:
50: bool(true)
51: Set gid:
52: bool(true)
53: Did really work:
54: bool(true)
55: Set smaller qbytes:
56: bool(true)
57: Did really work:
58: bool(true)
59: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>