xref: /freebsd/tools/boot/lua-test.sh (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
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
16u=$obj/userboot/userboot/userboot.so
17
18[ -n "$dir" ] || dir=/tmp/loadertest
19[ -d "$dir" ] || ${scriptdir}/lua-img.sh ${dir}
20[ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found"
21[ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load"
22[ -x "$t" ] || die "no userboot test jig found ($t)"
23[ -x "$u" ] || die "no userboot.so ($u) found"
24
25$t -h $dir -b $u
26