File: 055_rel-ignore

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 (72 lines) | stat: -rwxr-xr-x 1,405 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

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

# General ignore patterns are tested somewhere else.
# Here just the special rel-ignore function is tested.

logfile=$LOGDIR/055.log


mkdir -p a/b
$BINq ci -m1 -o delay=yes

touch a/b/f1 a/b/fI
touch g1 gI

function exp
{
  dumped="group:ignore,$1"
  cnt=$2
  cnt_I="$3"
	shift 3
	# Rest are patterns to be loaded

  while [[ "$1" != "" ]]
	do
	  pat="$1"
		shift

		true | $BINdflt ignore load
		$INFO "Testing $pat"
		$BINdflt rel-ignore "$pat"

		$BINdflt st > $logfile
		if [[ `grep I $logfile | wc -l` -ne $cnt_I ]]
		then
			cat $logfile
			$ERROR "$cnt_I *I can be ignored, but found "`grep -c I < $logfile`
		fi

		if [[ `wc -l < $logfile` -ne $cnt ]]
		then
			cat $logfile
			$ERROR "$cnt lines expected, "`wc -l < $logfile`" got"
		fi

		$BINdflt ignore dump > $logfile
		if [[ `cat $logfile` == "$dumped" ]]
		then
			$SUCCESS "$dumped matched"
		else
			cat $logfile
			$ERROR "$dumped not matched"
		fi
	done
}

exp "./**/*I" 4 0 "**/*I" "**/../**/*I"
exp "./**I" 4 0 "**I" "./**I" "$WC/**I"
# Ignore only on top level
exp "./*I" 5 1 "**/../*I" 
# From here on only level 2 below is ignored, so the single ./gI entry
# gets found.
exp "./*/*/*I" 5 1 "*/*/*I" "*/../*/X/../*/*I" "$WC/*/*/227/../*I" 
exp "./a/**I" 5 1 "./a/**I" 
# All can be found
exp "./a/**p" 6 2 "a/**p" 
exp "./*/*I" 6 2 "*/*I" "./*/*I" "$WC/*/*I"