Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110089636
D48949.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D48949.diff
View Options
diff --git a/usr.sbin/syslogd/tests/syslogd_test.sh b/usr.sbin/syslogd/tests/syslogd_test.sh
--- a/usr.sbin/syslogd/tests/syslogd_test.sh
+++ b/usr.sbin/syslogd/tests/syslogd_test.sh
@@ -323,7 +323,7 @@
{
local logfile
- atf_check jail -c name=syslogd_noinet persist
+ syslogd_mkjail syslogd_noinet
logfile="${PWD}/jail_noinet.log"
printf "user.debug\t${logfile}\n" > "${SYSLOGD_CONFIG}"
@@ -335,7 +335,7 @@
}
jail_noinet_cleanup()
{
- jail -r syslogd_noinet
+ syslogd_cleanup
}
# Create a pair of jails, connected by an epair. The idea is to run syslogd in
@@ -344,10 +344,12 @@
# 169.254.0.2 or 169.254.0.3.
allowed_peer_test_setup()
{
+ syslogd_check_req epair
+
local epair
- atf_check jail -c name=syslogd_allowed_peer vnet persist
- atf_check jail -c name=syslogd_client vnet persist
+ syslogd_mkjail syslogd_allowed_peer vnet
+ syslogd_mkjail syslogd_client vnet
atf_check -o save:epair ifconfig epair create
epair=$(cat epair)
@@ -364,9 +366,7 @@
allowed_peer_test_cleanup()
{
- jail -r syslogd_allowed_peer
- jail -r syslogd_client
- ifconfig $(cat epair) destroy
+ syslogd_cleanup
}
atf_test_case allowed_peer "cleanup"
@@ -499,19 +499,21 @@
}
forward_body()
{
+ syslogd_check_req epair
+
local epair logfile
atf_check -o save:epair ifconfig epair create
epair=$(cat epair)
epair=${epair%%a}
- atf_check jail -c name=syslogd_server vnet persist
+ syslogd_mkjail syslogd_server vnet
atf_check ifconfig ${epair}a vnet syslogd_server
atf_check jexec syslogd_server ifconfig ${epair}a inet 169.254.0.1/16
atf_check jexec syslogd_server ifconfig ${epair}a alias 169.254.0.2/16
atf_check jexec syslogd_server ifconfig lo0 inet 127.0.0.1/8
- atf_check jail -c name=syslogd_client vnet persist
+ syslogd_mkjail syslogd_client vnet
atf_check ifconfig ${epair}b vnet syslogd_client
atf_check jexec syslogd_client ifconfig ${epair}b inet 169.254.0.3/16
atf_check jexec syslogd_client ifconfig lo0 inet 127.0.0.1/8
@@ -545,8 +547,7 @@
}
forward_cleanup()
{
- jail -r syslogd_server
- jail -r syslogd_client
+ syslogd_cleanup
}
atf_init_test_cases()
diff --git a/usr.sbin/syslogd/tests/syslogd_test_common.sh b/usr.sbin/syslogd/tests/syslogd_test_common.sh
--- a/usr.sbin/syslogd/tests/syslogd_test_common.sh
+++ b/usr.sbin/syslogd/tests/syslogd_test_common.sh
@@ -115,3 +115,46 @@
rm -f "${pid_file}" "${socket_file}" "${privsocket_file}"
fi
}
+
+# Check required kernel module.
+syslogd_check_req()
+{
+ type=$1
+
+ if kldstat -q -n if_${type}.ko; then
+ return
+ fi
+
+ if ! kldload -n -q if_${type}; then
+ atf_skip "if_${type}.ko is required to run this test."
+ return
+ fi
+}
+
+# Make a jail and save its name to the created_jails.lst file.
+# Accepts a name and optional arguments.
+syslogd_mkjail()
+{
+ jailname=$1
+ shift
+ args=$*
+
+ atf_check jail -c name=${jailname} ${args} persist
+
+ echo $jailname >> created_jails.lst
+}
+
+# Remove epair interfaces and jails.
+syslogd_cleanup()
+{
+ if [ -f created_jails.lst ]; then
+ while read jailname; do
+ jail -r ${jailname}
+ done < created_jails.lst
+ rm created_jails.lst
+ fi
+
+ if [ -f epair ]; then
+ ifconfig $(cat epair) destroy
+ fi
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 14, 11:54 AM (20 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16629279
Default Alt Text
D48949.diff (3 KB)
Attached To
Mode
D48949: syslogd: Fix tests when if_epair is not loaded
Attached
Detach File
Event Timeline
Log In to Comment