File: verify_filesize_option.sh

package info (click to toggle)
rdfind 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid
  • size: 648 kB
  • sloc: cpp: 1,670; sh: 1,622; makefile: 32
file content (110 lines) | stat: -rwxr-xr-x 1,921 bytes parent folder | download
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
#!/bin/sh
# Ensures the exclusion of empty files work as intended.
#


set -e
. "$(dirname "$0")/common_funcs.sh"

reset_teststate

#make pairs of files, with specific sizes
for i in $(seq 0 4) ; do
  head -c$i /dev/zero >a$i
  head -c$i /dev/zero >b$i
done

#try eliminate them, but they are correctly ignored.
$rdfind -ignoreempty true -deleteduplicates true a* b*
[ -e a0 ]
[ -e b0 ]
for i in $(seq 1 4) ; do
  [ -e a$i ]
  [ ! -e b$i ]
done

dbgecho "passed ignoreempty true test case"

reset_teststate

#make pairs of files, with specific sizes
for i in $(seq 0 4) ; do
  head -c$i /dev/zero >a$i
  head -c$i /dev/zero >b$i
done
#eliminate also the empty ones
$rdfind -ignoreempty false -deleteduplicates true a* b*
[ -e a0 ]
[ ! -e b0 ]
for i in $(seq 1 4) ; do
  [ -e a$i ]
  [ ! -e b$i ]
done
dbgecho "passed ignoreempty false test case"



reset_teststate

#make pairs of files, with specific sizes
for i in $(seq 0 4) ; do
  head -c$i /dev/zero >a$i
  head -c$i /dev/zero >b$i
done
$rdfind -minsize 0 -deleteduplicates true a* b*
[ -e a0 ]
[ ! -e b0 ]
for i in $(seq 1 4) ; do
  [ -e a$i ]
  [ ! -e b$i ]
done
dbgecho "passed -minsize 0 test case"


reset_teststate

#make pairs of files, with specific sizes
for i in $(seq 0 4) ; do
  head -c$i /dev/zero >a$i
  head -c$i /dev/zero >b$i
done
$rdfind -minsize 1 -deleteduplicates true a* b*
[ -e a0 ]
[ -e b0 ]
for i in $(seq 1 4) ; do
  [ -e a$i ]
  [ ! -e b$i ]
done
dbgecho "passed -minsize 1 test case"




for cutoff in $(seq 0 4) ; do
reset_teststate

#make pairs of files, with specific sizes
for i in $(seq 0 4) ; do
  head -c$i /dev/zero >a$i
  head -c$i /dev/zero >b$i
done
$rdfind -minsize $cutoff -deleteduplicates true a* b*
for i in $(seq 0 4) ; do  
  [ -e a$i ]
  if [ $i -lt $cutoff ] ; then
    [ -e b$i ]
  else
    [ ! -e b$i ]
  fi	
done
dbgecho "passed -minsize $cutoff test case"
done







dbgecho "all is good for the symlinks test!"