source: web/old/remctl-2.14/tests/client/remctl-t @ f6f3e91

web
Last change on this file since f6f3e91 was f6f3e91, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago

Preserve directory hierarchy (not sure what happened to it)

  • Property mode set to 100755
File size: 2.6 KB
Line 
1#!/bin/sh
2#
3# Test suite for the remctl command-line client.
4#
5# Written by Russ Allbery <rra@stanford.edu>
6# Copyright 2006, 2007, 2009 Board of Trustees, Leland Stanford Jr. University
7#
8# See LICENSE for licensing terms.
9
10. "$SOURCE/tap/libtap.sh"
11. "$SOURCE/tap/kerberos.sh"
12. "$SOURCE/tap/remctl.sh"
13cd "$SOURCE"
14
15# Test setup.
16kerberos_setup
17if [ $? != 0 ] ; then
18    skip_all "Kerberos tests not configured"
19else
20    plan 11
21fi
22remctl="$BUILD/../client/remctl"
23if [ ! -x "$remctl" ] ; then
24    bail "can't locate remctl client binary"
25fi
26remctld_start "$BUILD/../server/remctld" "$SOURCE/data/conf-simple"
27
28# Now, we can finally run our tests.
29ok_program "basic" 0 "hello world" \
30    "$remctl" -s "$principal" -p 14373 localhost test test
31ok_program "no output" 0 "" \
32    "$remctl" -s "$principal" -p 14373 localhost test status 0
33ok_program "exit status 1" 1 "" \
34    "$remctl" -s "$principal" -p 14373 localhost test status 1
35ok_program "exit status 2" 2 "" \
36    "$remctl" -s "$principal" -p 14373 localhost test status 2
37ok_program "wrong principal" 255 "Access denied" \
38    "$remctl" -s "$principal" -p 14373 localhost test noauth
39ok_program "non-existent ACL" 255 "Access denied" \
40    "$remctl" -s "$principal" -p 14373 localhost test noacl
41ok_program "non-existent command" 255 "Cannot execute" \
42    "$remctl" -s "$principal" -p 14373 localhost test nonexistent
43ok_program "unknown command" 255 "Unknown command" \
44    "$remctl" -s "$principal" -p 14373 localhost test bad-command
45ok_program "201 arguments" 0 "201" \
46    "$remctl" -s "$principal" -p 14373 localhost test argv \
47    a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
48    a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
49    a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
50    a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
51    a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a \
52    a a a a a a a a a a a a a a a a a a a a a a a a a
53
54# Make sure that error messages end in a newline.
55"$remctl" -s "$principal" -p 14373 localhost test noauth \
56    > "$BUILD/data/output" 2>&1
57echo 'foo' >> "$BUILD/data/output"
58ok "error messages end in a newline" \
59    [ "`wc -l "$BUILD/data/output" | sed 's, /.*,,'`" -eq 2 ]
60
61# Check refused connections.
62"$remctl" -p 14445 localhost test noauth > "$BUILD/data/output" 2>&1
63output=`sed 's/):.*/)/' "$BUILD/data/output"`
64echo "# saw: $output"
65ok "correct connection refused error" \
66    [ "$output" = "remctl: cannot connect to localhost (port 14445)" ]
67
68# Clean up.
69rm -f "$BUILD/data/output"
70remctld_stop
71kerberos_cleanup
Note: See TracBrowser for help on using the repository browser.