File: sanitize.sh

package info (click to toggle)
libreswan 5.2-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 81,632 kB
  • sloc: ansic: 129,988; sh: 32,018; xml: 20,646; python: 10,303; makefile: 3,022; javascript: 1,506; sed: 574; yacc: 511; perl: 264; awk: 52
file content (84 lines) | stat: -rwxr-xr-x 1,871 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
78
79
80
81
82
83
84
#!/bin/bash

set -eu

# Assuming that this script is in testing/utils, find the top-level
# directory.
LIBRESWANSRCDIR=$(dirname $(dirname $(dirname $(readlink -f $0))))

if [ ! -d OUTPUT ] ; then
	echo "$0: no OUTPUT subdirectory.  Is `pwd` a test directory?" >&2
	exit 1
fi

if [ -f ./testparams.sh ] ; then
	. ./testparams.sh
else
	. ${LIBRESWANSRCDIR}/testing/default-testparams.sh
fi

if [ -f ./add-testparams.sh ]
then
    . ./add-testparams.sh
fi

. ${LIBRESWANSRCDIR}/testing/pluto/setup.sh
. ${LIBRESWANSRCDIR}/testing/utils/functions.sh

set +e
consoles=`ls *.console.txt 2>/dev/null || echo "NOFILES"`
set -e

# this blats CORE into all the .diff files; better than nothing
for i in OUTPUT/core* ; do
	if [ -f "$i" ] ; then
		echo "# CORE: $i"
	fi
done

result=notset
if [ "$consoles" != "NOFILES" ]; then
	for con in $consoles; do
		conv=`echo "$con" | sed -e "s/console/console.verbose/g"`
		host=`echo "$con" | sed -e "s/.console.txt//g"`
		if  [ ! -f $con ]; then
			echo "can't sanitize missing file $con"
			exit 1
		fi
		if [ ! -f OUTPUT/$conv ]; then
			echo "can't sanitize missing OUTPUT/$conv"
			exit 1
		fi

		#echo "sanitize host $host OUTPUT/$conv $con"
		r=`consolediff "$host" "OUTPUT/$conv" "$con"`
		set $r
		m=$3

		if [ "$result" == "notset" ] && [ "$m" == "matched" ]; then
			result="passed"
		fi
		if [ "$m" != "matched" ] ; then
			result="failed"
		fi
		echo "$r"
	done;
else
	result=failed
	vconsoles=`ls OUTPUT/*.console.verbose.txt`
	for conv in $vconsoles; do
		con1=`echo "$conv" | sed -e "s/console.verbose/console/g"`
		con=`echo "$con1" | sed -e "s/OUTPUT\///g"`
		host=`echo "$con" | sed -e "s/.console.txt//g"`

		if [ ! -f $conv ]; then
			echo "can't sanitize missing file $conv"
			exit 1
		fi
		r=`consolediff "$host" "$conv" "$con"`
		echo "$host Consoleoutput new"

done;
fi

echo "result $(basename $(pwd)) $result "