Module Name: src Committed By: pooka Date: Wed Nov 18 18:05:19 UTC 2009
Modified Files: src: build.sh Log Message: Add rumptest command for testing rump linkage. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/build.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/build.sh diff -u src/build.sh:1.218 src/build.sh:1.219 --- src/build.sh:1.218 Tue Nov 17 20:49:34 2009 +++ src/build.sh Wed Nov 18 18:05:19 2009 @@ -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 @@ 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 @@ 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 @@ bomb "Must supply a directory with \`install=...'" ;; + rump|rumptest) + op=${op} + ;; + *) usage "Unknown operation \`${op}'" ;; @@ -1317,7 +1323,7 @@ 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 @@ 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 @@ installworld "${arg}" ;; + rump|rumptest) + dorump "${op}" + ;; + *) bomb "Unknown operation \`${op}'" ;;