File: 041_options

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

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

LOG=$LOGDIR/041.options

# step 1: empty settings file.
CONF=$FSVS_CONF/config

touch $CONF
if ! $BINdflt st
then
	$ERROR "Empty config file fails"
fi

echo '## comment' > $CONF
echo '# comment' >> $CONF
echo '' >> $CONF
if ! $BINdflt st
then
	$ERROR "Comment-only settings file gives an error"
fi


touch empty-file
echo 'path=absolute' > $CONF
if ! $BINdflt st > $LOG
then
	$ERROR "Reading config-file fails (1)"
fi

if grep "$WC1/empty-file" < $LOG > /dev/null
then
	$SUCCESS "Parameter path read and understood."
else
	$ERROR "Parameter path not read"
fi


# The file is only touched, so filter=text shouldn't find it.
echo 'filter=text' > $CONF
if ! $BINdflt st > $LOG
then
	$ERROR "Reading config-file fails (2)"
fi

if [[ `wc -l < $LOG` -eq 0 ]]
then
	$SUCCESS "Parameter filter read and understood."
else
	$ERROR "Parameter filter not read"
fi


echo 'invalid string' > $CONF
if $BINdflt st > $LOG 2>&1
then
	$ERROR "Invalid string doesn't fail"
fi

echo 'invalid=option' > $CONF
if $BINdflt st > $LOG 2>&1
then
	$ERROR "Invalid option doesn't fail"
fi

$SUCCESS "Config file correctly parsed."

# Restore default behaviour.
rm $CONF