File: 062_readonly_conf

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 (77 lines) | stat: -rwxr-xr-x 1,379 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
73
74
75
76
77
#!/bin/bash

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


logfile=$LOGDIR/062.ro-conf

$BINdflt delay

echo a > x$RANDOM.$$
echo $RANDOM.$$ > empty-file


function Go
{
	run="$1"

	$BINdflt st > $logfile.$run,st
	$BINdflt diff > $logfile.$run,diff
	$BINdflt log -rHEAD > $logfile.$run,log
	$BINdflt pl -v * > $logfile.$run,pl
	$BINdflt pg fsvs:commit-pipe enc-dec > $logfile.$run,pg
	$BINdflt info -v tree > $logfile.$run,info
}

# Get compare values. 
# The chmod must be done before, to get the same status output.
#chmod -R a-w .
Go 1


# Don't allow any changes here; "diff" must use /tmp.
chmod -R a-w $FSVS_WAA
chmod -R a-w $FSVS_CONF

# We must be careful to clean up after this test, so that normal testing 
# can resume.
# So we run in a subshell, and look at the return value afterwards.
if ! result=$(
		Go 2
		if ! $BINdflt diff -r HEAD > /dev/null
		then
			echo "diff -r HEAD gives an error"
			exit 1
		fi
	)
then
	if [[ "$result" == "" ]]
	then
		result="Exit code"
	fi
fi

# Allow removing these hierarchies
chmod -R u+w $FSVS_WAA
chmod -R u+w $FSVS_CONF

if [[ "$result" != "" ]]
then
	$ERROR "$result"
fi

for file in `/bin/ls $logfile.* | cut -f2 -d, | sort -u`
do
	if diff -u $logfile.1,$file $logfile.2,$file
	then
		$SUCCESS "compared $file output."
	else
		$ERROR "'$file' output different"
	fi
done

$SUCCESS "read-only WAA and CONF ok."