1#!/bin/sh
2
3. ./functions.sh
4
5echo "NFSv${VERS} Basic rename test."
6
7start_share
8
9mkdir "${TESTDIR}/subdir"
10mkdir "${TESTDIR}/subdir2"
11
12echo -n "Rename a root path (abs -> abs) ... "
13echo "kangabanga" > "${TESTDIR}/testfile"
14./prog_rename "${TESTURL}/?version=${VERS}" "." /testfile /renamed1 || failure
15success
16
17echo -n "Verify the new path ... "
18grep kangabanga "${TESTDIR}/renamed1" >/dev/null || failure
19success
20
21echo -n "Rename a root path (rel -> abs) ... "
22echo "kangabanga" > "${TESTDIR}/testfile"
23./prog_rename "${TESTURL}/?version=${VERS}" "." testfile /renamed2 || failure
24success
25
26echo -n "Verify the new path ... "
27grep kangabanga "${TESTDIR}/renamed2" >/dev/null || failure
28success
29
30echo -n "Rename a root path (rel -> rel) ... "
31echo "kangabanga" > "${TESTDIR}/testfile"
32./prog_rename "${TESTURL}/?version=${VERS}" "." testfile renamed3 || failure
33success
34
35echo -n "Verify the new path ... "
36grep kangabanga "${TESTDIR}/renamed3" >/dev/null || failure
37success
38
39echo -n "Rename a root path (abs -> rel) ... "
40echo "kangabanga" > "${TESTDIR}/testfile"
41./prog_rename "${TESTURL}/?version=${VERS}" "." /testfile renamed4 || failure
42success
43
44echo -n "Verify the new path ... "
45grep kangabanga "${TESTDIR}/renamed4" >/dev/null || failure
46success
47
48
49
50echo -n "Rename a subdir path (abs -> abs) ... "
51echo "kangabanga" > "${TESTDIR}/subdir/testfile"
52./prog_rename "${TESTURL}/?version=${VERS}" "." /subdir/testfile /subdir/renamed5 || failure
53success
54
55echo -n "Verify the new path ... "
56grep kangabanga "${TESTDIR}/subdir/renamed5" >/dev/null || failure
57success
58
59echo -n "Rename a subdir path (rel -> abs) ... "
60echo "kangabanga" > "${TESTDIR}/subdir/testfile"
61./prog_rename "${TESTURL}/?version=${VERS}" "." subdir/testfile /subdir/renamed6 || failure
62success
63
64echo -n "Verify the new path ... "
65grep kangabanga "${TESTDIR}/subdir/renamed6" >/dev/null || failure
66success
67
68echo -n "Rename a subdir path (rel -> rel) ... "
69echo "kangabanga" > "${TESTDIR}/subdir/testfile"
70./prog_rename "${TESTURL}/?version=${VERS}" "." subdir/testfile subdir/renamed7 || failure
71success
72
73echo -n "Verify the new path ... "
74grep kangabanga "${TESTDIR}/subdir/renamed7" >/dev/null || failure
75success
76
77echo -n "Rename a subdir path (abs -> rel) ... "
78echo "kangabanga" > "${TESTDIR}/subdir/testfile"
79./prog_rename "${TESTURL}/?version=${VERS}" "." /subdir/testfile subdir/renamed8 || failure
80success
81
82echo -n "Verify the new path ... "
83grep kangabanga "${TESTDIR}/subdir/renamed8" >/dev/null || failure
84success
85
86echo -n "Rename a subdir path to a different dir (rel -> rel) ... "
87echo "kangabanga" > "${TESTDIR}/subdir/testfile"
88./prog_rename "${TESTURL}/?version=${VERS}" "." /subdir/testfile subdir2/renamed9 || failure
89success
90
91echo -n "Verify the new path ... "
92grep kangabanga "${TESTDIR}/subdir2/renamed9" >/dev/null || failure
93success
94
95echo -n "Rename from different cwd ... "
96echo "kangabanga" > "${TESTDIR}/subdir/testfile"
97./prog_rename "${TESTURL}/?version=${VERS}" "subdir" ./testfile ../subdir2/renamed10 || failure
98success
99
100echo -n "Rename from outside share ... "
101./prog_rename "${TESTURL}/?version=${VERS}" "subdir" ../../testfile ../subdir2/renamed11 2>/dev/null && failure
102success
103
104echo -n "Rename to outside share ... "
105echo "kangabanga" > "${TESTDIR}/subdir/testfile"
106./prog_rename "${TESTURL}/?version=${VERS}" "subdir" ./testfile ../../subdir2/renamed12 2>/dev/null && failure
107success
108
109
110stop_share
111
112exit 0
113