Add rumptest command for testing rump linkage.

This commit is contained in:
pooka 2009-11-18 18:05:19 +00:00
parent eea5c3505f
commit 3f3cc8c2db
1 changed files with 85 additions and 2 deletions

View File

@ -1,5 +1,5 @@
#! /usr/bin/env sh
# $NetBSD: build.sh,v 1.218 2009/11/17 20:49:34 apb Exp $
# $NetBSD: build.sh,v 1.219 2009/11/18 18:05:19 pooka Exp $
#
# Copyright (c) 2001-2009 The NetBSD Foundation, Inc.
# All rights reserved.
@ -242,6 +242,7 @@ initdefaults()
do_iso_image=false
do_iso_image_source=false
do_params=false
do_rump=false
# done_{operation}=true if given operation has been done.
#
@ -569,6 +570,7 @@ Usage: ${progname} [-EnorUux] [-a arch] [-B buildid] [-C cdextras]
kernel=conf Build kernel with config file \`conf'
releasekernel=conf Install kernel built by kernel=conf to RELEASEDIR.
modules Build and install kernel modules.
rumptest Do a linktest for rump (for developers).
sets Create binary sets in
RELEASEDIR/RELEASEMACHINEDIR/binary/sets.
DESTDIR should be populated beforehand.
@ -854,6 +856,10 @@ parseoptions()
bomb "Must supply a directory with \`install=...'"
;;
rump|rumptest)
op=${op}
;;
*)
usage "Unknown operation \`${op}'"
;;
@ -1317,7 +1323,7 @@ createmakewrapper()
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.218 2009/11/17 20:49:34 apb Exp $
# Generated from: \$NetBSD: build.sh,v 1.219 2009/11/18 18:05:19 pooka Exp $
# with these arguments: ${_args}
#
@ -1488,6 +1494,79 @@ installworld()
statusmsg "Successful installworld to ${dir}"
}
# Run rump build&link tests.
#
# To make this feasible for running without having to install includes and
# libraries into destdir (i.e. quick), we only run ld. This is possible
# since the rump kernel is a closed namespace apart from calls to rumpuser.
# Therefore, if ld complains only about rumpuser symbols, rump kernel
# linking was successful.
#
# We test that rump links with a number of component configurations.
# These attempt to mimic what is encountered in the full build.
# See list below. The list should probably be either autogenerated
# or managed elsewhere. But keep it here until a better idea arises.
#
# Above all, note that THIS IS NOT A SUBSTITUTE FOR A FULL BUILD.
#
RUMP_LIBSETS='
-lrump,
-lrumpvfs -lrump,
-lrumpfs_tmpfs -lrumpvfs -lrump,
-lrumpfs_ffs -lrumpfs_msdosfs -lrumpvfs -lrump,
-lrumpnet_virtif -lrumpnet_netinet -lrumpnet_net -lrumpnet -lrump,
-lrumpnet_sockin -lrumpfs_smbfs -lrumpdev_netsmb
-lrumpcrypto -lrumpdev -lrumpnet -lrumpvfs -lrump,
-lrumpnet_sockin -lrumpfs_nfs -lrumpnet -lrumpvfs -lrump'
dorump()
{
local doclean=""
local doobjs=""
# we cannot link libs without building csu, and that leads to lossage
[ "${1}" != "rumptest" ] && bomb 'build.sh rump not yet functional. ' \
'did you mean "rumptest"?'
[ "${MKUPDATE}" = "no" ] && doclean="cleandir"
[ "${MKOBJDIRS}" = "no" ] || doobjs="obj"
${runcmd} "${makewrapper}" ${parallel} do-distrib-dirs
targlist="${doclean} ${doobjs} dependall install"
setmakeenv NORUMPUSER 1
# optimize: for test we build only static libs (3x test speedup)
if [ "${1}" = "rumptest" ] ; then
setmakeenv NOPIC 1
setmakeenv NOPROFILE 1
fi
for cmd in ${targlist} ; do
make_in_dir "${NETBSDSRCDIR}/sys/rump" ${cmd}
done
# if we just wanted to build & install rump, we're done
[ "${1}" != "rumptest" ] && return
tool_ld=`${runcmd} "${makewrapper}" -V '${LD}'`
local oIFS="${IFS}"
IFS=","
for set in ${RUMP_LIBSETS} ; do
IFS="${oIFS}"
${runcmd} ${tool_ld} -nostdlib -L${DESTDIR}/usr/lib \
-static --whole-archive ${set} 2>&1 | awk '
/undefined reference/ &&
!/more undefined references.*follow/{
if (match($NF, "`rumpuser_") == 0)
fails[NR] = $0
}
END{
for (x in fails)
print fails[x]
exit x!=0
}'
[ $? -ne 0 ] && bomb "Testlink of rump failed: ${set}"
done
statusmsg "Rump build&link tests successful"
}
main()
{
@ -1568,6 +1647,10 @@ main()
installworld "${arg}"
;;
rump|rumptest)
dorump "${op}"
;;
*)
bomb "Unknown operation \`${op}'"
;;