File: test-wrapper.sh

package info (click to toggle)
sbsigntool 0.9.4-3.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 980 kB
  • sloc: ansic: 8,390; sh: 194; makefile: 159
file content (56 lines) | stat: -rwxr-xr-x 1,068 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

# set a few global variables that may be used by the test
basedir=$(cd $srcdir && pwd)
datadir=$(pwd)
bindir="$datadir/../src"

sbsign=$bindir/sbsign
sbverify=$bindir/sbverify
sbattach=$bindir/sbattach

key="$datadir/private-key.rsa"
cert="$datadir/public-cert.pem"
intkey="$datadir/int-key.ec"
intcert="$datadir/int-cert.pem"
cakey="$datadir/ca-key.ec"
cacert="$datadir/ca-cert.pem"

export basedir datadir bindir sbsign sbverify sbattach key cert intkey intcert cakey cacert

# 'test' needs to be an absolute path, as we will cd to a temporary
# directory before running the test
test="$PWD/$1"
rc=0

function run_test()
{
	test="$1"

	# image depends on the test arch
	image="$datadir/test.pecoff"
	export image

	# create the temporary directory...
	tempdir=$(mktemp --directory)

	# ... and run the test in it.
	( cd "$tempdir";  $test )

	if [ $? -ne 0 ]
	then
		echo "test $(basename $test) failed on arch $arch"
		echo
		rc=1
	fi

	rm -rf "$tempdir"
}

# run test on all available arches
for arch in $TEST_ARCHES
do
	run_test $test
done

exit $rc