xref: /illumos-gate/usr/src/test/os-tests/tests/definit/definit.ksh (revision b8052df9f609edb713f6828c9eecc3d7be19dfb3)
1#!/usr/bin/ksh
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source. A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11#
12
13# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
14
15typeset dir=$(dirname $0)
16
17typeset tf=$(mktemp)
18if [[ -z "$tf" || ! -f "$tf" ]]; then
19	print "Could not create temporary file."
20	exit 1
21fi
22trap 'rm -f $tf' EXIT
23
24integer exitval=0
25
26for b in 32 64; do
27	typeset bin=definit_test.$b
28	print "Testing $bin"
29	if ! $dir/$bin $dir/init.data > $tf; then
30		print "Failed to run $bin"
31		exitval=1
32	fi
33	if ! diff $tf $dir/init.expected; then
34		print "Output from $bin did not match"
35		exitval=1
36	fi
37done
38
39((exitval == 0)) && print "All tests passed successfully"
40
41exit $exitval
42