summaryrefslogtreecommitdiffstats
path: root/source3/script/tests/test_volume_serial_number.sh
blob: b156d7087e6584363ae844c1772cc8a137a76ff4 (plain)
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
#!/bin/sh
#
# This verifies setting the volume serial number parameter for a share works.
#

if [ $# -lt 5 ]; then
    echo "Usage: $0 SERVER_IP USERNAME PASSWORD SHARENAME SMBCLIENT"
    exit 1
fi

SERVER_IP="$1"
USERNAME="$2"
PASSWORD="$3"
SHARENAME="$4"
SMBCLIENT="$5"

SMBCLIENT="$VALGRIND ${SMBCLIENT}"
failed=0

incdir=$(dirname "$0")/../../../testprogs/blackbox
. "$incdir/subunit.sh"

test_serial_number() {

    output=$($SMBCLIENT "//$SERVER_IP/$SHARENAME" -U "$USERNAME%$PASSWORD" -c "volume") || return 1
    echo "smbclient volume on $SHARENAME returned: \"$output\""

    expected="0xdeadbeef"
    echo "$output" | grep $expected || {
        echo "Expected output containing \"$expected\", got: \"$output\""
        return 1
    }
}

testit "volume serial number for share $SHARENAME" test_serial_number || failed=$((failed+1))

exit "$failed"