File: getent_r.sh

package info (click to toggle)
samba-doc-ja 2.2.8a%2Bja1.0-0.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 34,192 kB
  • ctags: 22,693
  • sloc: ansic: 197,587; sh: 8,073; perl: 5,377; makefile: 1,489; awk: 1,146; exp: 1,143; csh: 216
file content (35 lines) | stat: -rwxr-xr-x 651 bytes parent folder | download | duplicates (18)
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
#!/bin/sh
#
# Verify test output.  Basically we check to see if all the files generated
# in /tmp by the get{pw,gr}ent_r.c and program are identical.  If there is
# some problem with the re-entrancy of the code then the information in the
# two files will be different.  
#

TYPE=$1
ID=$2
FILES="/tmp/${TYPE}_r-${ID}.out-*"

# Sort files

for file in $FILES; do
    cat $file | sort > $file.sorted
done

# Diff files

SORTED="/tmp/${TYPE}_r-${ID}.out-*.sorted"
failed=0

for file1 in $SORTED; do
    for file2 in $SORTED; do
        if [ $file1 != $file2 ]; then
                diff $file1 $file2
        fi
    done
done

# Clean up

rm -f $SORTED