File: 036_status_non-recursive

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 (120 lines) | stat: -rwxr-xr-x 2,691 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

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

logfile=$LOGDIR/036.status_non-recursive


# Check for -N on deleted hierarchies
# Set some known timestamp
touch -d "2008-02-01 12:13" .
$BINq ci -m1 -o delay=yes

function ExpLines
{
  parms="$1"
	exp_cnt="$2"
	$BINdflt st $parms > $logfile
	if [[ `wc -l < $logfile` -eq $exp_cnt ]]
	then
		$SUCCESS "found $exp_cnt for '$parms'"
	else
		$ERROR_NB "Got for $BINdflt st $parms:"
		cat $logfile
		$ERROR "expected $exp_cnt lines."
	fi
}


ExpLines "-C" 0
rm -r tree
touch -d "2008-02-01 12:13" .

# With -N -N, no children are looked at.
ExpLines "-N -N -C" 0
# If we don't pass -C, the timestamp is looked at, and if it's still the 
# same no check is done.
ExpLines "-N -N" 0
# We have to touch the directory; even with -C no children are seen.
touch .
#strace $BINdflt -N -N -C big_file > $logfile
#false
ExpLines "-N -N -C" 1
ExpLines "-N -N" 1
ExpLines "-N" 2
ExpLines "" 41

if $BINdflt -o stop_change=true status
then
  $ERROR "Expected an error code - 1"
fi

$BINq ci -m 1
if $BINdflt -o stop_change=true status
then
  $SUCCESS "No error code without change."
else
  $ERROR "Expected no error code - 1"
fi

touch empty-file
if $BINdflt -o stop_change=true status
then
  $ERROR "Expected an error code - 2"
fi
if $BINdflt -o stop_change=true -f text status
then
  $SUCCESS "Filtering for changes, stopping ok"
else
  $ERROR "Expected no error code - 2"
fi


# Check change detection options; use a known timestamp, and create them 
# simultaneously because of the ctime.
touch -d "2008-07-03 1:3" . big_file big_2 big_3
$BINq ci -m 1 big_file


$INFO "1) change file, same mtime, incl. size."
echo bla > big_2
touch -d "2008-07-03 1:3" big_2
mv big_2 big_file
ExpLines "big_file" 1
ExpLines "-o change_check=file_mtime big_file" 1
ExpLines "-o change_check=allfiles big_file" 1
ExpLines "-o change_check=dir big_file" 1
ExpLines "-C big_file" 1

# Delay so that the ctime is different.
$BINq ci -m 1 -o delay=yes


$INFO "2) change file, same mtime, same size, different ctime."
echo blu > big_3
touch -d "2008-07-03 1:3" big_3
mv big_3 big_file
ExpLines "-o change_check=allfiles big_file" 1
ExpLines "-o change_check=file_mtime big_file" 1
ExpLines "-C -C big_file" 1
# Another test for -C is in 013_manber, where (because the directory gets
# renamed) even the ctime is the same.

$BINq ci -m 1 -o change_check=full


$INFO "3) new entry"
# . is shown as changed, as the check flag is set.
echo blu > new-file-now
touch -d "2008-07-03 1:3" .
ExpLines "-N -N" 1
ExpLines "-o change_check=file_mtime" 2
ExpLines "-o change_check=allfiles" 2
ExpLines "-o change_check=dir" 2
ExpLines "-C" 2
ExpLines "-C -C" 2