1 | --TEST-- |
---|
2 | Check simplified remctl API |
---|
3 | --SKIPIF-- |
---|
4 | <?php |
---|
5 | if (!file_exists("remctl-test.pid")) |
---|
6 | echo "skip remctld not running"; |
---|
7 | ?> |
---|
8 | --FILE-- |
---|
9 | <?php |
---|
10 | $fh = fopen("remctl-test.princ", "r"); |
---|
11 | $principal = rtrim(fread($fh, filesize("remctl-test.princ"))); |
---|
12 | $command = array("test", "test"); |
---|
13 | $result = remctl("localhost", 14373, $principal, $command); |
---|
14 | echo "stdout_len: $result->stdout_len\n"; |
---|
15 | echo "stdout: $result->stdout\n"; |
---|
16 | echo "stderr_len: $result->stderr_len\n"; |
---|
17 | echo "status: $result->status\n"; |
---|
18 | flush(); |
---|
19 | |
---|
20 | $command = array("test", "status", "2"); |
---|
21 | $result = remctl("localhost", 14373, $principal, $command); |
---|
22 | echo "stdout_len: $result->stdout_len\n"; |
---|
23 | echo "stderr_len: $result->stderr_len\n"; |
---|
24 | echo "status: $result->status\n"; |
---|
25 | flush(); |
---|
26 | |
---|
27 | $command = array("test", "bad-command"); |
---|
28 | $result = remctl("localhost", 14373, $principal, $command); |
---|
29 | echo "stdout_len: $result->stdout_len\n"; |
---|
30 | echo "stderr_len: $result->stderr_len\n"; |
---|
31 | echo "error: $result->error\n"; |
---|
32 | echo "status: $result->status\n"; |
---|
33 | flush(); |
---|
34 | ?> |
---|
35 | --EXPECT-- |
---|
36 | stdout_len: 12 |
---|
37 | stdout: hello world |
---|
38 | |
---|
39 | stderr_len: 0 |
---|
40 | status: 0 |
---|
41 | stdout_len: 0 |
---|
42 | stderr_len: 0 |
---|
43 | status: 2 |
---|
44 | stdout_len: 0 |
---|
45 | stderr_len: 0 |
---|
46 | error: Unknown command |
---|
47 | status: 0 |
---|