*BSD unit tests (#4269)

* FreeBSD 14 unit tests

* FreeBSD 14 Vagrant

* OpenBSD 7.5 unit tests
This commit is contained in:
Guillaume Valadon 2024-06-22 16:46:19 +02:00 committed by GitHub
parent 06afa3982f
commit 54fc9e9478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 13 additions and 10 deletions

View File

@ -19,7 +19,7 @@ Vagrant.configure("2") do |config|
end
config.vm.define "freebsd" do |bsd|
bsd.vm.box = "freebsd/FreeBSD-13.1-RELEASE"
bsd.vm.box = "freebsd/FreeBSD-14.0-RELEASE"
bsd.vm.provision "shell", path: "provision_freebsd.sh"
end

View File

@ -5,7 +5,7 @@
# See https://scapy.net/ for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
PACKAGES="git python2 python39 py39-virtualenv py39-pip py27-sqlite3 py39-sqlite3 bash rust sudo"
PACKAGES="git python39 python311 py39-virtualenv py39-pip py39-sqlite3 py311-sqlite3 bash rust sudo"
pkg update
pkg install --yes $PACKAGES

View File

@ -319,7 +319,7 @@ def scapy_data_cache(name):
"Couldn't load cache from %s" % str(cachepath),
exc_info=True,
)
cachepath.unlink()
cachepath.unlink(missing_ok=True)
# Cache does not exist or is invalid.
content = func(filename)
data = {

View File

@ -17,7 +17,8 @@
"test/contrib/automotive/ecu_am.uts",
"test/contrib/automotive/gm/gmlanutils.uts",
"test/contrib/isotp_packet.uts",
"test/contrib/isotpscan.uts"
"test/contrib/isotpscan.uts",
"test/contrib/isotp_soft_socket.uts"
],
"onlyfailed": true,
"preexec": {

View File

@ -12,7 +12,7 @@ import subprocess
import re
import time
import sys
from scapy.consts import WINDOWS
from scapy.consts import WINDOWS, OPENBSD
# DEV: to add your file to this list, make sure you have
# a GREAT reason.
@ -47,7 +47,7 @@ ALL_FILES = [
x.split(".")[1] not in EXCEPTION_PACKAGES
]
NB_PROC = 1 if WINDOWS else 4
NB_PROC = 1 if WINDOWS or OPENBSD else 4
def append_processes(processes, filename):
processes.append(

View File

@ -1684,10 +1684,11 @@ assert country == 'US'
def _test():
with no_debug_dissector():
x = sr1(IP(dst="www.google.com")/ICMP(),timeout=3)
assert x is not None
x
assert x[IP].ottl() in [32, 64, 128, 255]
assert 0 <= x[IP].hops() <= 126
x is not None and ICMP in x and x[ICMP].type == 0
assert ICMP in x and x[ICMP].type == 0
retry_test(_test)
@ -1996,7 +1997,8 @@ retry_test(_test)
~ netaccess needs_root tcpdump
* Let's test traceroute
def _test():
ans, unans = traceroute("www.slashdot.org")
with no_debug_dissector():
ans, unans = traceroute("www.slashdot.org")
ans.nsummary()
s,r=ans[0]
s.show()

View File

@ -10,7 +10,7 @@
# minversion = 4.0
skip_missing_interpreters = true
# envlist = default when doing 'tox'
envlist = py{37,38,39,310,311,312}-{linux,bsd,windows}-non_root
envlist = py{37,38,39,310,311,312}-{linux,bsd,windows}-{non_root,root}
# Main tests
@ -41,7 +41,7 @@ deps = mock
zstandard ; sys_platform != 'win32'
platform =
linux: linux
bsd: darwin|freebsd|openbsd|netbsd
bsd: (darwin|freebsd|openbsd|netbsd).*
windows: win32
commands =
linux-non_root: {envpython} {env:DISABLE_COVERAGE:-m coverage run} -m scapy.tools.UTscapy -c ./test/configs/linux.utsc -N {posargs}