On 03/21/18 20:41, Eric S. Raymond wrote:
Ian and I note that the test suite seems a bit compromised.
Hello Eric,
When running compile tests and the test suite I think it is a good idea
to enable as many Net-SNMP features as possible. You may want to have a
look at the attached shell scripts - these are the scripts I use myself
to rebuild Net-SNMP and to run the regression tests. The
net-snmp-run-perl-tests script needs more work - I have not yet had the
time to figure out all the environment variable settings to make it pick
up its dependencies from the build directory instead of requiring "make
install" to be run first.
Bart.
#!/usr/bin/env bash
if [ -e .git ]; then
cat .git/HEAD | sed 's:.*/::'
elif [ -e .svn ]; then
svn info . | sed -n 's=^URL: .*/\([^/]*\)$=\1=p'
else
echo branch-name-not-known
fi
#!/usr/bin/env bash
# Necessary software packages for building Net-SNMP:
# autoconf automake libtool m4
# glibc glibc-devel libssh2 libssh2-devel openssl openssl-devel rpm-devel
# perl-ExtUtils-MakeMaker perl-ExtUtils-Embed perl-Test-Harness
# python python-devel python-setuptools
scriptdir="$(dirname "$0")"
branch_name="$("$scriptdir/branch-name")"
is_5_4_or_above="false"
is_5_5_or_above="false"
is_5_6_or_above="false"
is_5_7_or_above="false"
is_5_8_or_above="false"
if [ "${branch_name#master}" != "${branch_name}" ]; then
is_5_8_or_above="true"
is_5_7_or_above="true"
is_5_6_or_above="true"
is_5_5_or_above="true"
is_5_4_or_above="true"
elif [ "${branch_name#V5-7-}" != "${branch_name}" ]; then
is_5_7_or_above="true"
is_5_6_or_above="true"
is_5_5_or_above="true"
is_5_4_or_above="true"
elif [ "${branch_name#V5-6-}" != "${branch_name}" ]; then
is_5_6_or_above="true"
is_5_5_or_above="true"
is_5_4_or_above="true"
elif [ "${branch_name#V5-5-}" != "${branch_name}" ]; then
is_5_5_or_above="true"
is_5_4_or_above="true"
elif [ "${branch_name#V5-4-}" != "${branch_name}" ] ||
[ "${branch_name%-5.4.2.1}" != "${branch_name}" ]
then
is_5_4_or_above="true"
fi
have_rtnetlink=true
#srcdir=${1:-.}; shift
if ! echo "$*" | grep -Eq 'with-openssl=(no|internal)'; then
opensslver="$(
case "${OSTYPE}" in
linux*)
for p in openssl-devel libopenssl-devel libressl-devel; do
rpm -q --qf '%{version}\n' $p 2>/dev/null;
done;
dpkg-query --show -f '${Version}\n' libssl-dev 2>/dev/null;
pacman -Q openssl 2>&1 | sed -n 's/^openssl[[:blank:]]*//p';;
*)
echo 1.0;;
esac)"
fi
if grep -q 'CentOS release 4' /etc/issue 2>/dev/null; then
opensslver=""
have_rtnetlink=false
fi
opensshver="$({ rpm -q openssh-devel; rpm -q libssh2-devel; rpm -q
libssh-devel; } 2>/dev/null | sed -n
's/^.*ssh[0-9]*-devel-\([0-9a-z.]*\)-.*$/\1/p' | head -n1)"
srcdir=.
cflags="-g -O0 -pipe ${CFLAGS}"
#cflags="-DNETSNMP_USE_ASSERT ${CFLAGS}"
if true; then
# Disable inlining to make debugging easier
cflags="$cflags -fno-strict-aliasing -fno-inline -fno-inline-functions
-fno-inline-functions-called-once -fno-early-inlining -Wno-inline"
if gcc -fno-inline-small-functions -xc -c - </dev/null >/dev/null 2>&1; then
cflags="$cflags -fno-inline-small-functions"
fi
fi
# See also the top-level Net-SNMP Makefile.in.
export NOAUTODEPS=y
options=()
options+=(--enable-developer)
options+=(--enable-ipv6)
options+=("--with-cflags=$cflags")
options+=(--with-defaults)
transports=()
[ "$opensshver" != "" ] && $is_5_5_or_above && transports+=(SSH)
# Mib names can be found as follows:
# (cd agent/mibgroup &&
# git grep -lE 'void[[:blank:]]*init_.*\(void\)|config_require\(' |
# sed -n 's/\.h$//p')
mibs=()
mibs+=(examples/data_set)
mibs+=(examples/delayed_instance)
mibs+=(examples/example)
mibs+=(examples/notification)
mibs+=(examples/scalar_int)
mibs+=(examples/ucdDemoPublic)
mibs+=(examples/watched)
mibs+=(mibII)
mibs+=(smux)
case "$(uname)" in
Linux*)
$is_5_8_or_above && options+=(--enable-blumenthal-aes)
options+=(--enable-new-features)
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
$is_5_7_or_above && mibs+=(deliver/deliverByNotify)
mibs+=(disman/event)
mibs+=(disman/expression)
mibs+=(disman/mteEventNotificationTable)
mibs+=(disman/mteEventTable)
mibs+=(disman/mteObjectsTable)
mibs+=(disman/mteTriggerBooleanTable)
mibs+=(disman/mteTriggerDeltaTable)
mibs+=(disman/mteTriggerExistenceTable)
mibs+=(disman/mteTriggerTable)
mibs+=(disman/mteTriggerThresholdTable)
mibs+=(disman/nslookup-mib)
mibs+=(disman/ping-mib)
mibs+=(disman/schedule)
mibs+=(disman/traceroute-mib)
$is_5_5_or_above && $have_rtnetlink && mibs+=(etherlike-mib)
mibs+=(examples/netSnmpHostsTable)
mibs+=(hardware/cpu)
$is_5_5_or_above && mibs+=(hardware/fsys)
mibs+=(hardware/memory)
$is_5_5_or_above && mibs+=(hardware/sensors)
mibs+=(host)
mibs+=(ip-forward-mib)
mibs+=(ip-mib/inetNetToMediaTable)
$is_5_5_or_above && mibs+=(ip-mib/ipDefaultRouterTable)
mibs+=(ip-mib/ipv4InterfaceTable)
mibs+=(ip-mib/ipv6InterfaceTable)
$is_5_5_or_above && mibs+=(ip-mib/ipv6ScopeZoneIndexTable)
mibs+=(mibII/ipAddr)
mibs+=(mibII/mta_sendmail)
mibs+=(misc/ipfwacc)
$is_5_4_or_above && mibs+=(sctp-mib)
mibs+=(snmp-notification-mib)
[ "$opensslver" != "" ] && mibs+=(snmp-usm-dh-objects-mib)
mibs+=(tcp-mib)
mibs+=(testhandler)
[ "$opensslver" != "" ] && $is_5_6_or_above && mibs+=(tlstm-mib tsm-mib)
mibs+=(tunnel)
mibs+=(ucd-snmp/diskio)
$is_5_5_or_above && mibs+=(ucd-snmp/lmsensorsMib)
mibs+=(ucd-snmp/extensible)
mibs+=(udp-mib)
if $is_5_5_or_above && $have_rtnetlink; then
mibs+=(rmon-mib)
else
mibs+=(Rmon)
mibs+=(Rmon/alarm)
fi
options+=(--with-mysql)
options+=("--with-security-modules=$($is_5_7_or_above && echo usm ksm
tsm)")
transports+=(AAL5PVC)
transports+=(IPX)
transports+=(STD)
$is_5_8_or_above && transports+=(UDPshared)
[ "$opensslver" = "" ] && options+=("--with-openssl=internal")
options+=("--with-default-snmp-version=2")
{ rpm -q python-setuptools >/dev/null 2>&1 || rpm -q python-devel
>/dev/null 2>&1 || dpkg-query -l python-setuptools >/dev/null 2>&1; } &&
options+=(--with-python-modules)
# Disabled modules because troublesome: Rmon ipfwchains/ipfwchains
ucd-snmp/lmSensors
;;
AIX*)
mkdir -p "$HOME/.net-snmp"
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(host)
mibs+=(misc/ipfwacc)
mibs+=(snmp-notification-mib)
mibs+=(snmp-usm-dh-objects-mib)
mibs+=(tcp-mib)
mibs+=(ucd-snmp/diskio)
mibs+=(ucd-snmp/extensible)
mibs+=(udp-mib)
mibs+=(Rmon)
options+=("--with-persistent-directory=$HOME/.net-snmp")
options+=("$(if [ "$opensslver" = "" ]; then if $is_5_6_or_above; then if
false; then echo --with-openssl=internal; fi; else echo --without-openssl
--with-default-snmp-version="2"; fi; fi)")
;;
FreeBSD*)
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(disman/nslookup-mib)
mibs+=(host)
mibs+=(if-mib)
mibs+=(mibII/mta_sendmail)
mibs+=(misc/ipfwacc)
mibs+=(snmp-notification-mib)
mibs+=(snmp-usm-dh-objects-mib)
mibs+=(tcp-mib)
mibs+=(ucd-snmp/diskio)
mibs+=(ucd-snmp/extensible)
mibs+=(udp-mib)
$is_5_4_or_above && mibs+=(sctp-mib)
mibs+=(Rmon)
options+=("$(if [ "$opensslver" = "" ]; then if $is_5_6_or_above; then if
false; then echo --with-openssl=internal; fi; else echo --without-openssl
--with-default-snmp-version="2"; fi; fi)")
options+=(--with-python-modules)
options+=("$(if [ "$HOSTNAME" = cell-user ]; then echo
--disable-embedded-perl --without-perl-modules; fi)")
# Disabled modules because troublesome: Rmon ipfwchains/ipfwchains
ucd-snmp/lmSensors
;;
NetBSD*)
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(disman/nslookup-mib)
mibs+=(host)
mibs+=(if-mib)
mibs+=(mibII/mta_sendmail)
mibs+=(misc/ipfwacc)
mibs+=(snmp-notification-mib)
mibs+=(snmp-usm-dh-objects-mib)
mibs+=(tcp-mib)
mibs+=(ucd-snmp/diskio)
mibs+=(ucd-snmp/extensible)
mibs+=(udp-mib)
mibs+=(Rmon)
options+=($(if [ "$opensslver" = "" ]; then if $is_5_6_or_above; then if
false; then echo --with-openssl=internal; fi; else echo --without-openssl
--with-default-snmp-version="2"; fi; fi))
options+=($(if [ "$HOSTNAME" = cell-user ]; then echo
--disable-embedded-perl --without-perl-modules; fi))
;;
SunOS*)
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(rmon-mib)
;;
CYGWIN*)
export ENV_SEPARATOR=":"
options+=(--disable-embedded-perl)
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(ucd-snmp/extensible)
mibs+=(winExtDLL)
#options+=("--with-openssl=internal")
;;
MINGW*)
options+=(--disable-embedded-perl)
if [ "$branch_name" != "V5-4-patches" ]; then
options+=("--with-openssl=/c/OpenSSL")
fi
options+=("--prefix=/usr/local/net-snmp-${branch_name}")
mibs+=(snmp-notification-mib)
mibs+=(ucd-snmp/dlmod)
mibs+=(ucd-snmp/extensible)
mibs+=(winExtDLL)
options+=(--without-perl-modules)
#options+=(--with-mibdirs="C:/usr/share/snmp/mibs")
;;
*)
echo "Unknown OS $(uname)."
;;
esac
if ! echo "${options[*]} $*" | grep -Eq 'with-openssl=(no|internal)' &&
[ "$opensslver" != "" ] && $is_5_6_or_above &&
grep -rqw BIO_dgram_get_peer /usr/include/openssl 2>/dev/null; then
transports+=(DTLSUDP)
transports+=(TLSTCP)
fi
${srcdir}/configure "${options[@]}" --with-transports="${transports[*]}" \
--with-mib-modules="${mibs[*]}" "$@"
#!/usr/bin/env bash
set -x
usage() {
echo "Usage: $(basename "$0") [-m] [-p] [-t]"
}
rebuild() {
local num_jobs=$(($("${scriptdir}/num_cpus") + 1))
killall lt-snmpd lt-snmptrapd >&/dev/null
if [ -z "$preserve" ]; then "${scriptdir}"/clean-source-tree; fi &&
echo "net-snmp-configure $*" &&
"${scriptdir}"/net-snmp-configure "$@" &&
make -s -j"${num_jobs}" -l"${num_jobs}" &&
if [ -z "$skip_tests" ]; then "${scriptdir}"/net-snmp-run-tests; fi
}
scriptdir="$(dirname "$0")"
while [ "$1" != "${1#-}" ]; do
case "$1" in
'-m') multiple=true; shift;;
'-p') preserve=true; shift;;
'-t') skip_tests=true; shift;;
'--') shift; break;;
*) usage; exit 1;;
esac
done
export NOAUTODEPS=1
if [ -z "$multiple" ]; then
rebuild "$@"
else
for opts in "" "--with-openssl=internal" "--without-openssl" \
"--disable-debugging --disable-ipv6"; do
rebuild "$@" "$opts"
done
fi 2>&1 | tee "../net-snmp-$(basename "$PWD")-build-log.txt"
#!/bin/bash
echo $PERL5LIB
# See also the output of the following command:
# find -name '*.so' | sed 's/^\.\///;s/\/[^\/]*$//' | sort -u
export
LD_LIBRARY_PATH="$PWD/snmplib/.libs:$PWD/agent/helpers/.libs:$PWD/agent/.libs:$PWD/apps/.libs:"
&&
# PERLLIB: A list of directories in which to look for Perl library files before
looking in the standard library and the current directory.
export
PERLLIB="$PWD/perl/blib/lib:$PWD/perl/blib/lib/NetSNMP:$PWD/perl/blib/lib/NetSNMP/agent:$PWD/perl/blib/arch/auto/SNMP"
&&
cd perl &&
make test
#!/bin/bash
set -x
killall snmpd
export
LD_LIBRARY_PATH="$PWD/snmplib/.libs:$PWD/agent/.libs:$PWD/agent/helpers/.libs:"
export MIBDIRS=$PWD/mibs
export SNMP_PERSISTENT_DIR=/tmp/net-snmp
export SNMP_SNMPD_PORT=1161
export PYTHONPATH=$PWD/python/netsnmp
mkdir -p "$SNMP_PERSISTENT_DIR" || exit $?
agent/snmpd -I-smux -f -Lo -c python/netsnmp/tests/snmpd.conf
localhost:${SNMP_SNMPD_PORT} &
pid=$!
cd python || exit $?
python setup.py --basedir="$PWD/.." test || exit $?
kill $pid
wait
#!/bin/bash
scriptdir="$(dirname "$0")"
ulimit -c unlimited
killall snmpd snmptrapd >&/dev/null
export SNMP_VERBOSE=1 &&
export SNMP_SAVE_TMPDIR=1 &&
export NOAUTODEPS=1 &&
make -s &&
(
export PATH="$PWD/agent/.libs:$PWD/apps/.libs:$PWD:$PATH" &&
export
LD_LIBRARY_PATH="$PWD/snmplib/.libs:$PWD/agent/.libs:$PWD/agent/helpers/.libs:"
&&
cd testing &&
if [ -e RUNFULLTESTS ] &&
perl -e 'require TAP::Harness;' >/dev/null 2>&1; then
export HARNESS_OPTIONS=j9
./RUNFULLTESTS -g all
#./RUNFULLTESTS -g tls -r T121DtlsTrap_simple
#./RUNFULLTESTS -g tls -r T111DtlsServer
#./RUNFULLTESTS -g tls
#./RUNFULLTESTS -g unit-tests
else
make -s test
fi &&
cd .. &&
net-snmp-run-perl-tests
) &&
"$scriptdir/net-snmp-run-python-tests"
#!/usr/bin/env bash
if type wmic >&/dev/null; then
wmic cpu get NumberOfCores |
{ read -r a; read -r b; echo "$a" >/dev/null; echo "$b"; }
elif [ -e /sys/devices/system/cpu ]; then
ls -d /sys/devices/system/cpu/cpu[0-9]* | wc -l
else
echo 4
fi
#!/usr/bin/env bash
shopt -s nullglob
usage() {
echo "Usage: $(basename "$0") [ -x <exclude> ]*"
exit 1
}
word_in_list() {
local a word=$1
shift
for a in "$@"; do
[ "$word" = "$a" ] && return 0
done
return 1
}
remove_empty_directories() {
find . -depth -type d |
sed 's|^\./||' |
grep -Ev '^\.$|^\.svn/|/\.svn/|/\.svn$|^\.hg/|^\.hg$|^\.git/|^\.git$' |
while read -r d; do
for f in "$d"/{*,.*}; do
if ! [ -e "$f" ]; then
rmdir "$d"
fi
break
done
done
}
exclude=("TAGS")
git_options=(-e TAGS)
while [ "${1#-}" != "$1" ]; do
case "$1" in
-x)
exclude+=("$2")
git_options+=(-e "$2")
shift; shift;;
*)
usage;;
esac
done
for d in "${@-.}"; do
(
if cd "$d"; then
if [ -e .svn ]; then
if ! type -p svn >&/dev/null; then
echo "$0: svn: not found."
exit 0
fi
"$(dirname "$0")"/list-non-source-files |
while read -r f; do
if ! word_in_list "$f" "${exclude[@]}"; then rm -rf -- "$f"; fi;
done
elif [ -e .git ] || [ -e ../.git ]; then
if ! type -p git >&/dev/null; then
echo "$0: git: not found."
exit 0
fi
git clean -f -d -x "${git_options[@]}" >/dev/null
remove_empty_directories
elif [ -e .hg ] || [ -e ../.hg ]; then
if ! type -p hg >&/dev/null; then
echo "$0: hg: not found."
exit 0
fi
hg purge --all
else
echo "$0: $d: not administered by Subversion, Git or Mercurial."
fi
fi
)
done
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders