File: 046_copyfrom-detect-2

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 (85 lines) | stat: -rwxr-xr-x 1,825 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
#!/bin/bash

set -e 
$PREPARE_CLEAN > /dev/null
$INCLUDE_FUNCS

logfile=$LOGDIR/046.detect

cd $WC

for a in `seq 1 50`
do
  p=dir-$a/dir1
  mkdir -p $p
	echo $WC > $p/wcpath
	echo $a > $p/other-$a
done

$BINq ci -m 1 -o delay=yes

mkdir dir2
echo $WC2 > dir2/wcpath

$BINdflt copyfrom-detect > $logfile
if [[ `wc -l < $logfile` -ne 33 ]]
then
  $ERROR "Wrong number of output lines"
fi
if [[ `grep name: $logfile | wc -l` -ne 31 ]]
then
  $ERROR "Filename didn't match?"
fi
if egrep -q '^  \.\.\.$' $logfile
then
  $SUCCESS "'Too many matches' found"
else
  $ERROR "'too many' indication missing"
fi


$PREPARE_DEFAULT > /dev/null
cd $WC
cp -r tree tree-2
cp -r tree/a tree-a
cp -r tree/a/1 tree-a-1
$BINdflt copyfrom-detect -v > $logfile

function MatchBlock
{
	dest=$1
	shift

  if not_found=`perl -e '
	$dest=shift;
	while (<STDIN>)
	{
		s#\s+$##;
		$inblk=1,next if $_ eq $dest;
		last if $inblk && m#^\S#;

		s#^\s+##,push(@block,$_) if $inblk;
	}
	for $q (grep(/\w/,@ARGV))
	{
	  if (!grep($q eq $_, @block))
		{
			print $q,"\n";
			exit 1;
		}
	}
	exit 0;
	' "$dest" "$@" < $logfile`
	then
	  $SUCCESS "$dest matched"
	else
	  $ERROR "$dest didn't have '$not_found'"
	fi
}

MatchBlock tree-2 "dirlist=100.0%:tree"
MatchBlock tree-2/c "name,dirlist=100.0%:tree/c" "dirlist=100.0%:tree/a" "dirlist=100.0%:tree/b"
MatchBlock tree-2/c/3 "name,dirlist=100.0%:tree/a/3" "name,dirlist=100.0%:tree/b/3" "name,dirlist=100.0%:tree/c/3" "dirlist=100.0%:tree/b/1" "dirlist=100.0%:tree/a/1" 
MatchBlock tree-2/a "name,dirlist=100.0%:tree/a" "dirlist=100.0%:tree/c" "dirlist=100.0%:tree/b"
MatchBlock tree-a "dirlist=100.0%:tree/a" "dirlist=100.0%:tree/b" "dirlist=100.0%:tree/c"
MatchBlock tree-a-1 "dirlist=100.0%:tree/a/1" "dirlist=100.0%:tree/a/2" "dirlist=100.0%:tree/a/3" "dirlist=100.0%:tree/b/1" "dirlist=100.0%:tree/c/1"