File: 002.phpt

package info (click to toggle)
remctl 3.18-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,612 kB
  • sloc: ansic: 19,504; sh: 5,386; perl: 1,778; java: 740; makefile: 715; xml: 502; python: 430
file content (56 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--TEST--
Check simplified remctl API
--CREDITS--
Russ Allbery
# Copyright 2008, 2010
#     The Board of Trustees of the Leland Stanford Junior University
#
# SPDX-License-Identifier: MIT
--ENV--
KRB5CCNAME=remctl-test.cache
LD_LIBRARY_PATH=../client/.libs
--SKIPIF--
<?php
    if (!file_exists("remctl-test.pid"))
        echo "skip remctld not running";
?>
--FILE--
<?php
    $fh = fopen("remctl-test.princ", "r");
    $principal = rtrim(fread($fh, filesize("remctl-test.princ")));
    $command = array("test", "test");
    $result = remctl("localhost", 14373, $principal, $command);
    echo "stdout_len: $result->stdout_len\n";
    echo "stdout: $result->stdout\n";
    echo "stderr_len: $result->stderr_len\n";
    echo "status: $result->status\n";
    flush();

    $command = array("test", "status", "2");
    $result = remctl("localhost", 14373, $principal, $command);
    echo "stdout_len: $result->stdout_len\n";
    echo "stderr_len: $result->stderr_len\n";
    echo "status: $result->status\n";
    flush();

    $command = array("test", "bad-command");
    $result = remctl("localhost", 14373, $principal, $command);
    echo "stdout_len: $result->stdout_len\n";
    echo "stderr_len: $result->stderr_len\n";
    echo "error: $result->error\n";
    echo "status: $result->status\n";
    flush();
?>
--EXPECT--
stdout_len: 12
stdout: hello world

stderr_len: 0
status: 0
stdout_len: 0
stderr_len: 0
status: 2
stdout_len: 0
stderr_len: 0
error: Unknown command
status: 0