File: 029_properties

package info (click to toggle)
fsvs 1.2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,964 kB
  • ctags: 1,464
  • sloc: ansic: 16,650; sh: 5,885; perl: 783; makefile: 338; python: 90
file content (127 lines) | stat: -rwxr-xr-x 2,409 bytes parent folder | download | duplicates (5)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/bin/bash

set -e
$PREPARE_DEFAULT > /dev/null
$INCLUDE_FUNCS
cd $WC


file=empty-file
propname=blablubli
propvalue=foobarbaz

$BINdflt ps "$propname" "$propvalue" "$file"
$BINq ci -m1
$WC2_UP_ST_COMPARE
propvalread=`$BINdflt pg "$propname" "$WC2/$file"`
if [[ "$propvalread" == "$propvalue" ]]
then
	$SUCCESS "Property successfully read back"
else
	$ERROR "Property not read!"
fi

if [[ `$BINdflt pl -v $file` == "$propname=$propvalue" ]]
then
	$SUCCESS "Property successfully listed"
else
	$ERROR "Property not listed!"
fi

# empty property
$BINdflt ps "$propname" "" "$file"
$BINq ci -m1
$WC2_UP_ST_COMPARE
if [[ `$BINdflt pl -v $WC2/$file` == "$propname=" ]]
then
	$SUCCESS "Property successfully emptied"
else
	$ERROR "Property not emptied!"
fi

# delete property
$BINdflt pd "$propname" "$file"

propvalread=`$BINdflt pg "$propname" "$file"`
if [[ "$propvalread" == "" ]]
then
	$SUCCESS "Property deleted"
else
	$ERROR "Deleted property still there"
fi

$BINq ci -m1

propvalread=`$BINdflt pg "$propname" "$file"`
if [[ "$propvalread" == "" ]]
then
	$SUCCESS "Property still deleted after commit"
else
	$ERROR "Deleted property back after commit"
fi

$WC2_UP_ST_COMPARE
if [[ `$BINdflt pl $WC2/$file` == "$file has no properties." ]]
then
	$SUCCESS "Property successfully removed"
else
	$ERROR "Property not removed!"
fi


if $BINq ps a b does-not-exist 2> /dev/null
then
  $ERROR "Sets properties for unknown entries"
else
  $SUCCESS "Rejects unknown entries"
fi


file=abc.$RANDOM
function CheckStatus
{
	exp=$1
  verb=$2

	# We need -C for the test with only changed mtime, but again with 0 
	# bytes.

	if [[ `$BINdflt st $file -C | cut -c1-5` != "$exp" ]]
	then 
		$BINdflt st $file
		$ERROR "Wrong status output - expected '$exp'."
	fi

	if [[ `$BINdflt st $file -v -C | cut -c1-7` != "$verb" ]]
	then 
		$BINdflt st $file -v
		$ERROR "Wrong verbose status output - expected '$verb'."
	fi
}

touch -d 12:00 $file
CheckStatus "N... " "N..... "

$BINq ps a b $file
CheckStatus "nP.. " "n..P.. "

$BINq ci -m2
CheckStatus "" "...... "

$BINq ps a c $file
CheckStatus ".P.. " "...P.. "

echo aaaa > $file
touch -d 12:00 $file
CheckStatus ".PC. " "...PC. "

rm $file
touch $file
CheckStatus ".m.. " ".t.P.. "

$SUCCESS "All status outputs are ok."

# What happens if we change a property on a deleted entry? The property 
# change would simply get lost - we only send the delete to the repository.