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