summaryrefslogtreecommitdiff
path: root/usr/src/test/os-tests/tests/definit/definit.ksh
blob: ddec04b0d5efa48d64e17aea6554ee339c44737f (plain)
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
#!/usr/bin/ksh
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#

# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.

typeset dir=$(dirname $0)

typeset tf=$(mktemp)
if [[ -z "$tf" || ! -f "$tf" ]]; then
	print "Could not create temporary file."
	exit 1
fi
trap 'rm -f $tf' EXIT

integer exitval=0

for b in 32 64; do
	typeset bin=definit_test.$b
	print "Testing $bin"
	if ! $dir/$bin $dir/init.data > $tf; then
		print "Failed to run $bin"
		exitval=1
	fi
	if ! diff $tf $dir/init.expected; then
		print "Output from $bin did not match"
		exitval=1
	fi
done

((exitval == 0)) && print "All tests passed successfully"

exit $exitval