diff options
author | Martin Schwenke <martin@meltin.net> | 2011-07-07 16:17:52 +1000 |
---|---|---|
committer | Martin Schwenke <martin@meltin.net> | 2011-08-08 13:38:07 +1000 |
commit | 506be3cb26dd3414e48e1b10b2b3f801ed272fc3 (patch) | |
tree | 1dfb576d0dc661daf12402c44fc0426016d9d25b /ctdb/tests/eventscripts/stubs | |
parent | 604eb67102b061b84f99d4a1ac6290288fd5ca73 (diff) | |
download | samba-506be3cb26dd3414e48e1b10b2b3f801ed272fc3.tar.gz samba-506be3cb26dd3414e48e1b10b2b3f801ed272fc3.tar.xz samba-506be3cb26dd3414e48e1b10b2b3f801ed272fc3.zip |
Tests: eventscripts and onnode tests use stubs/ subdirectory instead of bin/.
This sets up a more useful convention and avoids future .gitignore
problems.
Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 58c696dc600f1073e693930da061776b6fb199f2)
Diffstat (limited to 'ctdb/tests/eventscripts/stubs')
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/ctdb | 142 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/ethtool | 12 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/exportfs | 7 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/ip | 204 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/iptables | 5 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/kill | 7 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/killall | 7 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/net | 5 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/netstat | 99 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/pkill | 7 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/rpc.lockd | 6 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/rpc.mountd | 6 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/rpc.rquotad | 6 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/rpc.statd | 6 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/rpcinfo | 79 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/service | 64 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/testparm | 36 | ||||
-rwxr-xr-x | ctdb/tests/eventscripts/stubs/wbinfo | 7 |
18 files changed, 705 insertions, 0 deletions
diff --git a/ctdb/tests/eventscripts/stubs/ctdb b/ctdb/tests/eventscripts/stubs/ctdb new file mode 100755 index 0000000000..296fede83a --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/ctdb @@ -0,0 +1,142 @@ +#!/bin/sh + +prog="ctdb" + +usage () +{ + cat >&2 <<EOF +Usage: $prog [-Y] cmd + +A fake CTDB stub that prints items depending on the variables +FAKE_CTDB_PNN (default 0) depending on command-line options. + +Note that -Y is ignored. + +EOF + exit 1 +} + +# $POSIXLY_CORRECT means that the command passed to onnode can take +# options and getopt won't reorder things to make them options to this +# script. +_temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "Yh" -l help -- "$@") || \ + usage + +eval set -- "$_temp" + +while true ; do + case "$1" in + -Y) shift ;; + --) shift ; break ;; + -h|--help|*) usage ;; # * shouldn't happen, so this is reasonable. + esac +done + +[ $# -ge 1 ] || usage + +setup_tickles () +{ + # Make sure tickles file exists. + tickles_file="$CTDB_VARDIR/fake-ctdb/tickles" + mkdir -p $(dirname "$tickles_file") + touch "$tickles_file" +} + +setup_pstore () +{ + pstore_dir="$CTDB_VARDIR/fake-ctdb/pstore/$1" + mkdir -p "$pstore_dir" +} + +case "$1" in + ip) + # This is completely stateless and IPs move unnecessarily. + _f="${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE}/public_addresses}" + if [ -f "$_f" ] ; then + echo ":Public IP:Node:" + _n=0 + while read _ip _iface ; do + case "_$ip" in + \#*) : ;; + *) + # Find a node that is up... but don't loop forever. + _orig=$_n + while [ -f "${FAKE_CTDB_NODES_DOWN}/${_n}" ] ; do + _n=$(($_n + 1)) + if [ _n -eq $FAKE_CTDB_NUMNODES ] ; then + _n=0 + fi + if [ $_n -eq $_orig ] ; then + _n=-1 # Never down! :-) + fi + done + echo ":${_ip}:${_n}:" + esac + done <"$_f" + fi + ;; + pnn|xpnn) + # Defaults to 0 + echo "PNN:${FAKE_CTDB_PNN:-0}" + ;; + gettickles) + setup_tickles + echo ":source ip:port:destination ip:port:" + while read src dst ; do + echo ":${src}:${dst}:" + done <"$tickles_file" + ;; + addtickle) + setup_tickles + echo "$2 $3" >>"$tickles_file" + ;; + deltickle) + setup_tickles + _t=$(grep -F -v "$2 $3" "$tickles_file") + echo "$_t" >"$tickles_file" + ;; + pstore) + setup_pstore "$2" + cat "$4" >"${pstore_dir}/$3" + ;; + pfetch) + setup_pstore "$2" + cat "${pstore_dir}/$3" >"$4" 2>/dev/null + ;; + ifaces) + # Assume -Y. + echo ":Name:LinkStatus:References:" + _f="${CTDB_PUBLIC_ADDRESSES:-${CTDB_BASE}/public_addresses}" + if [ -r "$_f" ] ; then + while read _ip _iface ; do + case "_$ip" in + \#*) : ;; + *) + _status=1 + # For now assume _iface contains only 1. + if [ -f "{FAKE_CTDB_IFACES_DOWN}/${_iface}" ] ; then + _status=0 + fi + # Nobody looks at references + echo ":${_iface}:${_status}:0" + esac + done <"$_f" | + sort -u + fi + ;; + setifacelink) + # Existence of file means CTDB thinks interface is down. + _f="${FAKE_CTDB_IFACES_DOWN}/$2" + case "$3" in + up) rm -f "$_f" ;; + down) touch "$_f" ;; + *) + echo "ctdb setifacelink: unsupported interface status $3" + exit 1 + esac + ;; + *) + echo "${prog}: command \"$1\" not implemented in stub" + exit 1 +esac + diff --git a/ctdb/tests/eventscripts/stubs/ethtool b/ctdb/tests/eventscripts/stubs/ethtool new file mode 100755 index 0000000000..bd173f438f --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/ethtool @@ -0,0 +1,12 @@ +#!/bin/sh + +link="yes" + +if [ -f "${FAKE_ETHTOOL_LINK_DOWN}/${1}" ] ; then + link="no" +fi + +# Expect to add more fields later. +cat <<EOF + Link detected: ${link} +EOF diff --git a/ctdb/tests/eventscripts/stubs/exportfs b/ctdb/tests/eventscripts/stubs/exportfs new file mode 100755 index 0000000000..e3859f901f --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/exportfs @@ -0,0 +1,7 @@ +#!/bin/sh + +opts="10.0.0.0/16" #(rw,async,insecure,no_root_squash,no_subtree_check) + +for i in $FAKE_SHARES ; do + echo "${i} ${opts}" +done diff --git a/ctdb/tests/eventscripts/stubs/ip b/ctdb/tests/eventscripts/stubs/ip new file mode 100755 index 0000000000..5e6a1e9275 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/ip @@ -0,0 +1,204 @@ +#!/bin/sh + +: ${FAKE_IP_STATE:=${PWD}/var/fake-ip-state} + +not_implemented () +{ + echo "ip stub command: \"$1\" not implemented" + exit 127 +} + + +case "$1" in + link) + case "$2" in + set) + iface="$3" + case "$4" in + up) + rm -f "${FAKE_IP_STATE}/interfaces-down/${iface}" + ;; + down) + mkdir -p "${FAKE_IP_STATE}/interfaces-down" + touch "${FAKE_IP_STATE}/interfaces-down/${iface}" + ;; + *) + not_implemented "$*" + esac + ;; + *) + not_implemented "$1 $2" + esac + + ;; + addr) + case "$2" in + add) + shift 2 + local="" + dev="" + brd="" + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*) + local="$1" ; shift + ;; + local) + local="$2" ; shift 2 + ;; + broadcast|brd) + # For now assume this is always '+'. + if [ "$2" != "+" ] ; then + not_implemented "addr add ... brd $2 ..." + fi + shift 2 + ;; + dev) + dev="$2" ; shift 2 + ;; + *) + not_implemented "addr add ... $1 ..." + esac + done + if [ -z "$dev" ] ; then + not_implemented "addr add (without dev)" + fi + mkdir -p "${FAKE_IP_STATE}/addresses" + pf="${FAKE_IP_STATE}/addresses/${dev}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-secondary" + # We could lock here... but we should be the only ones + # playing around here with these stubs. + if [ ! -f "$pf" ] ; then + echo "$local" >"$pf" + elif grep -Fq "$local" "$pf" ; then + echo "RTNETLINK answers: File exists" >&2 + exit 254 + elif [ -f "$sf" ] && grep -Fq "$local" "$sf" ; then + echo "RTNETLINK answers: File exists" >&2 + exit 254 + else + echo "$local" >>"$sf" + fi + ;; + delete|del) + shift 2 + local="" + dev="" + while [ -n "$1" ] ; do + case "$1" in + *.*.*.*/*) + local="$1" ; shift + ;; + local) + local="$2" ; shift 2 + ;; + dev) + dev="$2" ; shift 2 + ;; + *) + not_implemented "addr del ... $1 ..." + esac + done + if [ -z "$dev" ] ; then + not_implemented "addr del (without dev)" + fi + mkdir -p "${FAKE_IP_STATE}/addresses" + pf="${FAKE_IP_STATE}/addresses/${dev}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-secondary" + # We could lock here... but we should be the only ones + # playing around here with these stubs. + if [ ! -f "$pf" ] ; then + echo "RTNETLINK answers: Cannot assign requested address" >&2 + exit 254 + elif grep -Fq "$local" "$pf" ; then + # Remove primaries AND SECONDARIES. + rm -f "$pf" "$sf" + elif [ -f "$sf" ] && grep -Fq "$local" "$sf" ; then + grep -Fv "$local" "$sf" >"${sf}.new" + mv "${sf}.new" "$sf" + else + echo "RTNETLINK answers: Cannot assign requested address" >&2 + exit 254 + fi + ;; + show|list) + shift 2 + dev="" + primary=true + secondary=true + while [ -n "$1" ] ; do + case "$1" in + dev) + dev="$2" ; shift 2 + ;; + # Do stupid things and stupid things will happen! + primary) + primary=true ; secondary=false ; shift + ;; + secondary) + secondary=true ; primary=false ; shift + ;; + *) + not_implemented "addr list ... $1 ..." + esac + done + devices="$dev" + if [ -z "$devices" ] ; then + # No device specified? Get all the primaries... + devices=$(ls "${FAKE_IP_STATE}/addresses/"*-primary 2>/dev/null | \ + sed -e 's@.*/@@' -e 's@-primary$@@') + fi + calc_brd () + { + case "${local#*/}" in + 24) + brd="${local%.*}.255" + ;; + *) + not_implemented "list ... fake bits other than 24: ${local#*/}" + esac + } + show_iface() + { + pf="${FAKE_IP_STATE}/addresses/${dev}-primary" + sf="${FAKE_IP_STATE}/addresses/${dev}-secondary" + mac=$(echo $dev | md5sum | sed -r -e 's@(..)(..)(..)(..)(..)(..).*@\1:\2:\3:\4:\5:\6@') + cat <<EOF +${n}: ${dev}: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether ${mac} brd ff:ff:ff:ff:ff:ff +EOF + if $primary && [ -r "$pf" ] ; then + read local <"$pf" + calc_brd +cat <<EOF + inet ${local} brd ${brd} scope global ${dev} +EOF + fi + if $secondary && [ -r "$sf" ] ; then + while read local ; do + calc_brd +cat <<EOF + inet ${local} brd ${brd} scope global secondary ${dev} +EOF + done <"$sf" + fi +cat <<EOF + valid_lft forever preferred_lft forever +EOF + + } + n=1 + for dev in $devices ; do + show_iface + n=$(($n + 1)) + done + ;; + *) + not_implemented "$1 $2" + esac + ;; + *) + not_implemented "$1" +esac + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/iptables b/ctdb/tests/eventscripts/stubs/iptables new file mode 100755 index 0000000000..2c65f7ba11 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/iptables @@ -0,0 +1,5 @@ +#!/bin/sh + +# Always succeed. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/kill b/ctdb/tests/eventscripts/stubs/kill new file mode 100755 index 0000000000..b69e3e62a3 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/kill @@ -0,0 +1,7 @@ +#!/bin/sh + +# Always succeed. This means that kill -0 will always find a +# process and anything else will successfully kill. This should +# exercise a good avriety of code paths. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/killall b/ctdb/tests/eventscripts/stubs/killall new file mode 100755 index 0000000000..1e182e1e0d --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/killall @@ -0,0 +1,7 @@ +#!/bin/sh + +# Always succeed. This means that killall -0 will always find a +# process and anything else will successfully kill. This should +# exercise a good avriety of code paths. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/net b/ctdb/tests/eventscripts/stubs/net new file mode 100755 index 0000000000..3f96413313 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/net @@ -0,0 +1,5 @@ +#!/bin/sh + +# Always succeed for now... + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/netstat b/ctdb/tests/eventscripts/stubs/netstat new file mode 100755 index 0000000000..cf0656651a --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/netstat @@ -0,0 +1,99 @@ +#!/bin/bash + +prog="netstat" + +usage () +{ + cat >&2 <<EOF +Usage: $prog [ -t | --unix ] [ -n ] [ -a ] [ -l ] + +A fake netstat stub that prints items depending on the variables +FAKE_NETSTAT_TCP_ESTABLISHED, FAKE_NETSTAT_TCP_LISTEN, +FAKE_NETSTAT_UNIX_LISTEN, depending on command-line options. + +Note that -n is ignored. + +EOF + exit 1 +} + +# Defaults. +tcp=false +unix=false +all=false +listen=false + +parse_options () +{ + # $POSIXLY_CORRECT means that the command passed to onnode can + # take options and getopt won't reorder things to make them + # options to this script. + _temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "tnalh" -l unix -l help -- "$@") + + [ $? != 0 ] && usage + + eval set -- "$_temp" + + while true ; do + case "$1" in + -n) shift ;; + -a) all=true ; shift ;; + -t) tcp=true ; shift ;; + -l) listen=true ; shift ;; + --unix) unix=true ; shift ;; + --) shift ; break ;; + -h|--help|*) usage ;; # * shouldn't happen, so this is reasonable. + esac + done + + [ $# -gt 0 ] && usage + + # If neither -t or --unix specified then print all. + $tcp || $unix || { tcp=true ; unix=true ; } +} + +parse_options "$@" + +if $tcp ; then + if $listen ; then + echo "Active Internet connections (servers only)" + elif $all ; then + echo "Active Internet connections (servers and established)" + else + echo "Active Internet connections (w/o servers)" + fi + + echo "Proto Recv-Q Send-Q Local Address Foreign Address State" + + tcp_fmt="tcp 0 0 %-23s %-23s %s\n" + for i in $FAKE_NETSTAT_TCP_ESTABLISHED ; do + src="${i%|*}" + dst="${i#*|}" + printf "$tcp_fmt" $src $dst "ESTABLISHED" + done + + if $all || $listen ; then + for i in $FAKE_NETSTAT_TCP_LISTEN ; do + printf "$tcp_fmt" $i "0.0.0.0:*" "LISTEN" + done + fi +fi + +if $unix ; then + if $listen ; then + echo "Active UNIX domain sockets (servers only)" + elif $all ; then + echo "Active UNIX domain sockets (servers and established)" + else + echo "Active UNIX domain sockets (w/o servers)" + fi + + echo "Proto RefCnt Flags Type State I-Node Path" + + unix_fmt="unix 2 [ ACC ] STREAM LISTENING %-8d %s\n" + if $all || $listen ; then + for i in $FAKE_NETSTAT_UNIX_LISTEN ; do + printf "$unix_fmt" 12345 "$i" + done + fi +fi diff --git a/ctdb/tests/eventscripts/stubs/pkill b/ctdb/tests/eventscripts/stubs/pkill new file mode 100755 index 0000000000..b3f1de5a57 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/pkill @@ -0,0 +1,7 @@ +#!/bin/sh + +# Always succeed. This means that pkill -0 will always find a +# process and anything else will successfully kill. This should +# exercise a good avriety of code paths. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/rpc.lockd b/ctdb/tests/eventscripts/stubs/rpc.lockd new file mode 100755 index 0000000000..e71f6cd8ff --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/rpc.lockd @@ -0,0 +1,6 @@ +#!/bin/sh + +# Restart always "works". However, the test infrastructure may +# continue to mark the service as down, so that's what matters. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/rpc.mountd b/ctdb/tests/eventscripts/stubs/rpc.mountd new file mode 100755 index 0000000000..e71f6cd8ff --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/rpc.mountd @@ -0,0 +1,6 @@ +#!/bin/sh + +# Restart always "works". However, the test infrastructure may +# continue to mark the service as down, so that's what matters. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/rpc.rquotad b/ctdb/tests/eventscripts/stubs/rpc.rquotad new file mode 100755 index 0000000000..e71f6cd8ff --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/rpc.rquotad @@ -0,0 +1,6 @@ +#!/bin/sh + +# Restart always "works". However, the test infrastructure may +# continue to mark the service as down, so that's what matters. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/rpc.statd b/ctdb/tests/eventscripts/stubs/rpc.statd new file mode 100755 index 0000000000..e71f6cd8ff --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/rpc.statd @@ -0,0 +1,6 @@ +#!/bin/sh + +# Restart always "works". However, the test infrastructure may +# continue to mark the service as down, so that's what matters. + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/rpcinfo b/ctdb/tests/eventscripts/stubs/rpcinfo new file mode 100755 index 0000000000..dd175f3d9c --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/rpcinfo @@ -0,0 +1,79 @@ +#!/bin/bash + +prog="rpcinfo" + +usage () +{ + cat >&2 <<EOF +Usage: $prog -u host program [version] + +A fake rpcinfo stub that succeeds for items in FAKE_RPCINFO_SERVICES, +depending on command-line options. + +Note that "-u host" is ignored. + +EOF + exit 1 +} + +parse_options () +{ + # $POSIXLY_CORRECT means that the command passed to onnode can + # take options and getopt won't reorder things to make them + # options to this script. + _temp=$(POSIXLY_CORRECT=1 getopt -n "$prog" -o "u:h" -l unix -l help -- "$@") + + [ $? != 0 ] && usage + + eval set -- "$_temp" + + while true ; do + case "$1" in + -u) shift 2 ;; # ignore + --) shift ; break ;; + -h|--help|*) usage ;; # * shouldn't happen, so this is reasonable. + esac + done + + [ 1 -le $# -a $# -le 2 ] || usage + + p="$1" + v="$2" +} + +parse_options "$@" + +for i in ${FAKE_RPCINFO_SERVICES} ; do + # This is stupidly cummulative, but needs to happen after the + # initial split of the list above. + IFS="${IFS}:" + set -- $i + # $1 = program, $2 = low version, $3 = high version + + if [ "$1" = "$p" ] ; then + if [ -n "$v" ] ; then + if [ "$2" -le "$v" -a "$v" -le "$3" ] ; then + echo "program ${p} version ${v} ready and waiting" + exit 0 + else + echo "rpcinfo: RPC: Program/version mismatch; low version = ${2}, high version = ${3}" >&2 + echo "program ${p} version ${v} is not available" + exit 1 + fi + else + for j in $(seq $2 $3) ; do + echo "program ${p} version ${j} ready and waiting" + done + exit 0 + fi + fi +done + +echo "rpcinfo: RPC: Program not registered" >&2 +if [ -n "$v" ] ; then + echo "program ${p} version ${v} is not available" +else + echo "program ${p} is not available" +fi + +exit 1 diff --git a/ctdb/tests/eventscripts/stubs/service b/ctdb/tests/eventscripts/stubs/service new file mode 100755 index 0000000000..5f47b55e00 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/service @@ -0,0 +1,64 @@ +#!/bin/sh + +service_status_dir="${EVENTSCRIPTS_TESTS_VAR_DIR}/service_fake_status" +mkdir -p "$service_status_dir" + +service="$1" +flag="${service_status_dir}/${service}" + +start() +{ + if [ -f "$flag" ] ; then + echo "service: can't start ${service} - already running" + exit 1 + else + touch "$flag" + echo "Starting ${service}: OK" + fi +} + +stop () +{ + if [ -f "$flag" ] ; then + echo "Stopping ${service}: OK" + rm -f "$flag" + else + echo "service: can't stop ${service} - not running" + exit 1 + fi +} + +case "$2" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + status) + if [ -f "$flag" ] ; then + echo "$service running" + exit 0 + else + echo "$service not running" + exit 3 + fi + ;; + force-started) + # For test setup... + touch "$flag" + ;; + force-stopped) + # For test setup... + rm -f "$flag" + ;; + *) + echo "service $service $2 not supported" + exit 1 +esac + +exit 0 diff --git a/ctdb/tests/eventscripts/stubs/testparm b/ctdb/tests/eventscripts/stubs/testparm new file mode 100755 index 0000000000..83aa578673 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/testparm @@ -0,0 +1,36 @@ +#!/bin/sh + +# Ensure that testparm always uses our canned configuration instead of +# the global one, unless some other file is specified. This requires +# testparm to be installed but is quicker than reimplementing all the +# various command-line options. + +file_specified=false +for i ; do + case "$i" in + -*) : ;; + *) file_specified=true + esac +done + +if $file_specified ; then + # This should include the shares, since this is used when the + # samba eventscript caches the output. + /usr/bin/testparm "$@" +else + # We force our own smb.conf and add the shares. + /usr/bin/testparm "$@" "${CTDB_ETCDIR}/samba/smb.conf" + + for i in $FAKE_SHARES ; do + bi=$(basename "$i") +cat <<EOF + +[${bi}] + path = $i + comment = fake share $bi + guest ok = no + read only = no + browseable = yes +EOF + done +fi diff --git a/ctdb/tests/eventscripts/stubs/wbinfo b/ctdb/tests/eventscripts/stubs/wbinfo new file mode 100755 index 0000000000..4fc6b98331 --- /dev/null +++ b/ctdb/tests/eventscripts/stubs/wbinfo @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ "$FAKE_WBINFO_FAIL" = "yes" ] ; then + exit 1 +fi + +exit 0 |