xref: /freebsd/tools/boot/lua-test.sh (revision 574a8bf981301e233e953c3119165bea36118006)
1ca72e2e2SWarner Losh#!/bin/sh
2ca72e2e2SWarner Losh# $FreeBSD$
3ca72e2e2SWarner Losh
4*574a8bf9SKyle Evans# Will image the test directory (default /tmp/loadertest) if it doesn't exist
5*574a8bf9SKyle Evans
6ca72e2e2SWarner Loshdie() {
7ca72e2e2SWarner Losh    echo $*
8ca72e2e2SWarner Losh    exit 1
9ca72e2e2SWarner Losh}
10ca72e2e2SWarner Losh
11ca72e2e2SWarner Loshdir=$1
12*574a8bf9SKyle Evansscriptdir=$(dirname $(realpath $0))
13ca72e2e2SWarner Loshcd $(make -V SRCTOP)/stand
14ca72e2e2SWarner Loshobj=$(make -V .OBJDIR)
15ca72e2e2SWarner Losht=$obj/userboot/test/test
16ca72e2e2SWarner Loshu=$obj/userboot/userboot/userboot.so
17ca72e2e2SWarner Losh
18ff840987SKyle Evans[ -n "$dir" ] || dir=/tmp/loadertest
19*574a8bf9SKyle Evans[ -d "$dir" ] || ${scriptdir}/lua-img.sh ${dir}
20ca72e2e2SWarner Losh[ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found"
21ca72e2e2SWarner Losh[ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load"
22ca72e2e2SWarner Losh[ -x "$t" ] || die "no userboot test jig found ($t)"
23ca72e2e2SWarner Losh[ -x "$u" ] || die "no userboot.so ($u) found"
24ca72e2e2SWarner Losh
25ca72e2e2SWarner Losh$t -h $dir -b $u
26