1ca72e2e2SWarner Losh#!/bin/sh 2ca72e2e2SWarner Losh 3574a8bf9SKyle Evans# Will image the test directory (default /tmp/loadertest) if it doesn't exist 4574a8bf9SKyle Evans 5ca72e2e2SWarner Loshdie() { 6ca72e2e2SWarner Losh echo $* 7ca72e2e2SWarner Losh exit 1 8ca72e2e2SWarner Losh} 9ca72e2e2SWarner Losh 10ca72e2e2SWarner Loshdir=$1 11574a8bf9SKyle Evansscriptdir=$(dirname $(realpath $0)) 12ca72e2e2SWarner Loshcd $(make -V SRCTOP)/stand 13ca72e2e2SWarner Loshobj=$(make -V .OBJDIR) 14ca72e2e2SWarner Losht=$obj/userboot/test/test 15ca72e2e2SWarner Losh 16ff840987SKyle Evans[ -n "$dir" ] || dir=/tmp/loadertest 17574a8bf9SKyle Evans[ -d "$dir" ] || ${scriptdir}/lua-img.sh ${dir} 18*f98c671dSKyle Evans# We'll try userboot.so from the test directory before plucking it straight out 19*f98c671dSKyle Evans# of .OBJDIR. 20*f98c671dSKyle Evansu=$dir/boot/userboot.so 21*f98c671dSKyle Evans[ -f "$u" ] || u=$obj/userboot/userboot_lua/userboot_lua.so 22ca72e2e2SWarner Losh[ -f "$dir/boot/lua/loader.lua" ] || die "No boot/lua/loader.lua found" 23ca72e2e2SWarner Losh[ -f "$dir/boot/kernel/kernel" ] || die "No kernel to load" 24ca72e2e2SWarner Losh[ -x "$t" ] || die "no userboot test jig found ($t)" 25*f98c671dSKyle Evans[ -f "$u" ] || die "no userboot.so ($u) found" 26ca72e2e2SWarner Losh 27ca72e2e2SWarner Losh$t -h $dir -b $u 28