xref: /freebsd/tools/boot/lua-test.sh (revision 0957b409)
1#!/bin/sh
2# $FreeBSD$
3
4# Will image the test directory (default /tmp/loadertest) if it doesn't exist
5
6die() {
7    echo $*
8    exit 1
9}
10
11dir=$1
12scriptdir=$(dirname $(realpath $0))
13cd $(make -V SRCTOP)/stand
14obj=$(make -V .OBJDIR)
15t=$obj/userboot/test/test
16
17[ -n "$dir" ] || dir=/tmp/loadertest
18[ -d "$dir" ] || ${scriptdir}/lua-img.sh ${dir}
19# We'll try userboot.so from the test directory before plucking it straight out
20# of .OBJDIR.
21u=$dir/boot/userboot.so
22[ -f "$u" ] || u=$obj/userboot/userboot_lua/userboot_lua.so
23[ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found"
24[ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load"
25[ -x "$t" ] || die "no userboot test jig found ($t)"
26[ -f "$u" ] || die "no userboot.so ($u) found"
27
28$t -h $dir -b $u
29