File: 035_sorted_output

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 (40 lines) | stat: -rwxr-xr-x 647 bytes parent folder | download | duplicates (4)
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
#!/bin/bash

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


logfile=$LOGDIR/035.sorted_output

funsort=$logfile.unsort
fsort=$logfile.sort


$INFO "Testing sorting"

# We try to create entries with a lower inode number than their parent.
touch z a y b x c w
mkdir H
mv z a y b x c w H
for parm in "" "-v"
do
	$BINdflt st > $funsort
	$BINdflt st -o dir_sort=yes > $fsort

	if cmp -s $funsort $fsort
	then
	  $WARN "Sorted equals unsorted?"
	fi

	if sort -k3 $funsort | cmp -s - $fsort
	then
	  echo "Sorting ok"
	else
		sort -k3 $funsort | diff -u - $fsort
	  $ERROR "Didn't sort (cmdline='$parm')"
	fi
done
$SUCCESS "Sorting works."