mirror of
https://github.com/openwrt/packages.git
synced 2026-10-14 05:36:34 +04:00
The generic per-executable version probe and the old test.sh both invoke
tcpreplay --version. Under the QEMU test runtime tcpreplay and
tcpreplay-edit abort at startup on the interface link probe
("eth0: SIOCETHTOOL(ETHTOOL_GLINK) ioctl failed: Not a tty") before
autoopts can print the version, which fails the tcpreplay-all test and
warns on the standalone tcpreplay/tcpreplay-edit packages.
Add a test-version.sh that disables the flaky generic probe and asserts
each tool's version without needing an interface, and rewrite test.sh to
exercise the file-processing core (tcpcapinfo dissect, tcprewrite edit,
tcpprep cache) on a small synthesized capture instead of shelling out to
--version, which the CI infrastructure already covers.
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
43 lines
1.2 KiB
Bash
Executable File
43 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# shellcheck shell=busybox
|
|
|
|
# tcpreplay and tcpreplay-edit probe a network interface's link state while
|
|
# parsing their options, so under the QEMU runtime running any of these tools
|
|
# with --version is unreliable: tcpreplay/tcpreplay-edit either abort
|
|
# ("eth0: SIOCETHTOOL(ETHTOOL_GLINK) ioctl failed: Not a tty") or hang forever
|
|
# (observed on big-endian mips). Do not execute the binaries here at all;
|
|
# assert the version string compiled into each one instead. Actually running
|
|
# the file-processing tools is covered by test.sh. The presence of this script
|
|
# also disables the generic per-executable probe, which would otherwise run
|
|
# the same hanging --version.
|
|
|
|
version="$2"
|
|
|
|
check() {
|
|
bin="/usr/bin/$1"
|
|
[ -x "$bin" ] || {
|
|
echo "missing executable: $bin" >&2
|
|
return 1
|
|
}
|
|
grep -qaF "$version" "$bin" || {
|
|
echo "version $version not found in $bin" >&2
|
|
return 1
|
|
}
|
|
}
|
|
|
|
case "$1" in
|
|
tcpbridge | tcpcapinfo | tcpliveplay | tcpprep | tcpreplay | tcpreplay-edit | tcprewrite)
|
|
check "$1"
|
|
;;
|
|
tcpreplay-all)
|
|
# Meta-package: ships no binary of its own, the modules arrive as
|
|
# dependencies. Validate a representative always-present module.
|
|
check tcprewrite
|
|
;;
|
|
*)
|
|
echo "Untested package: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|