re-import sources as agreed with the maintainer

This commit is contained in:
Adam Samalik 2023-07-10 13:45:54 +02:00
parent 2e62c78b41
commit 34ab433a3a
5 changed files with 325 additions and 0 deletions

23
.gitignore vendored
View File

@ -1 +1,24 @@
madwifi-headers.tar.bz2
wpa_supplicant-0.4.7.tar.gz
wpa_supplicant-0.5.1.tar.gz
wpa_supplicant-0.4.8.tar.gz
madwifi-headers-r1475.tar.bz2
wpa_supplicant-0.4.9.tar.gz
wpa_supplicant-0.5.7.tar.gz
wpa_supplicant-0.6.3.tar.gz
wpa_supplicant-0.6.4.tar.gz
wpa_supplicant-0.6.7.tar.gz
wpa_supplicant-0.6.8.tar.gz
/wpa_supplicant-0.7.3.tar.gz
/wpa_supplicant-1.0-rc1.tar.gz
/wpa_supplicant-1.0-rc2.tar.gz
/wpa_supplicant-1.1.tar.gz
/wpa_supplicant-2.0.tar.gz
/wpa_supplicant-2.3.tar.gz
/wpa_supplicant-2.4.tar.gz
/wpa_supplicant-2.5.tar.gz
/wpa_supplicant-2.6.tar.gz
/wpa_supplicant-2.7.tar.gz
/wpa_supplicant-2.9.tar.gz
/wpa_supplicant-2.9.20211112.gitc8b94bc7b347.tar.gz
/wpa_supplicant-2.10.tar.gz

15
tests/tests.yml Normal file
View File

@ -0,0 +1,15 @@
---
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-beakerlib
tests:
- wpa_supplicant_standalone
required_packages:
- kernel-modules-extra
- kernel-modules-internal
- wpa_supplicant
- iproute
- iw
- util-linux

View File

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/wpa_supplicant/Sanity/wpa_supplicant_standalone
# Description: sanity test for wpa_supplicant
# Author: Davide Caratti <dcaratti@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/wpa_supplicant/Sanity/wpa_supplicant_standalone
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Davide Caratti <dcaratti@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: sanity test for wpa_supplicant" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: wpa_supplicant" >> $(METADATA)
@echo "Requires: util-linux iproute iw wpa_supplicant" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
@echo "Releases: -RHEL4 -RHELClient5 -RHELServer5" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/wpa_supplicant/Sanity/wpa_supplicant_standalone
Description: sanity test for wpa_supplicant
Author: Davide Caratti <dcaratti@redhat.com>

View File

@ -0,0 +1,221 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/wpa_supplicant/Sanity/wpa_supplicant_standalone
# Description: sanity test for wpa_supplicant
# Author: Davide Caratti <dcaratti@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2019 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="wpa_supplicant"
MACSTA="00:00:0a:bb:e1:1a"
IFACEAP="wlan0"
IFACESTA="wlan1"
open_ap() {
local SSID=${1:-notreallyassid}
cat >openap.conf <<-EOF
network={
frequency=2412
ssid="$SSID"
mode=2
key_mgmt=NONE
}
EOF
wpa_supplicant -ddd -Dnl80211 -i$IFACEAP -copenap.conf -B -fopenap.log -Pw1ap.pid
}
open_sta() {
local SSID=${1:-notreallyassid}
cat >opensta.conf <<-EOF
network={
ssid="$SSID"
key_mgmt=NONE
}
EOF
wpa_supplicant -ddd -Dnl80211 -i$IFACESTA -copensta.conf -B -fopensta.log -Pw1sta.pid
}
wpa2psk_ap() {
local SSID=${1:-notreallyassid}
cat >wpapskap.conf <<-EOF
network={
frequency=2437
ssid="$SSID"
mode=2
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="hunter2?"
}
EOF
wpa_supplicant -ddd -Dnl80211 -i$IFACEAP -cwpapskap.conf -B -fwpapskap.log -Pw2ap.pid
}
wpa2psk_sta() {
local SSID=${1:-notreallyassid}
cat >wpapsksta.conf <<-EOF
network={
frequency=2437
ssid="$SSID"
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP
psk="hunter2?"
}
EOF
wpa_supplicant -ddd -Dnl80211 -i$IFACESTA -cwpapsksta.conf -B -fwpapsksta.log -Pw2sta.pid
}
kill_supplicants() {
local a=`cat w*.pid`
local iter=0
while [ ${#a} -gt 0 -a $iter -lt 10 ]; do
for a in $a; do
kill $a 1>/dev/null 2>&1
sleep 1
done
a=`cat w*.pid`
iter=$((iter+1))
done
ip link set dev $IFACEAP down
ip link set dev $IFACESTA down
if [ $iter -ge 10 -a ${#a} -gt 0 ]; then
return 1
else
return 0
fi
}
check_for_associated_sta()
{
local assoc_found=0 assoc_missed=0
ip link set dev $IFACEAP up
while sleep 2; do
if iw dev $IFACEAP station dump | grep -i $MACSTA ; then
assoc_found=$((assoc_found+1))
rlLog "found $MACSTA in $IFACEAP associations ($assoc_found)"
else
if [ $assoc_found -gt 0 ]; then
rlLog "association disappeared after $assoc_found cycles"
return 1
fi
rlLog "didn't find association ($assoc_missed)"
assoc_missed=$((assoc_missed+1))
fi
if [ $assoc_missed -gt 5 ]; then
rlLog "timeout waiting for $MACSTA in $IFACEAP station dump"
return 1
fi
if [ $assoc_found -gt 5 ]; then
return 0
fi
done
rlLog "sleep failed!"
return 1
}
check_for_running_aps()
{
local probe_ok=0 probe_missed=0
ip link set dev $IFACESTA up
while sleep 1; do
if iw dev $IFACESTA scan | grep "${1:-notreallyassid}"; then
probe_ok=$((probe_ok+1))
rlLog "$probe_ok probe received"
else
if [ $probe_ok -gt 0 ]; then
rlLog "probe failure after $probe_ok attempts"
return 1
fi
rlLog "missed probe response"
probe_missed=$((probe_missed+1))
fi
if [ $probe_missed -gt 5 ]; then
rlLog "timeout waiting for beacons"
return 1
fi
if [ $probe_ok -gt 5 ]; then
return 0
fi
done
rlLog "sleep failed!"
return 1
}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
# avoid randomizing MAC for wlan0 and wlan1
rlRun "systemctl stop NetworkManager"
# allow scans
rlRun "systemctl stop wpa_supplicant"
# install required modules
rlRun "modprobe rfkill"
rlRun "modprobe mac80211_hwsim radio=2"
rlRun "rfkill unblock wifi"
rlRun "ip link set dev $IFACESTA address $MACSTA"
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
# cleartext wifi
rlRun "kill_supplicants"
rlRun "open_ap test_OPEN"
rlRun "check_for_running_aps test_OPEN"
rlRun "open_sta test_OPEN"
rlRun "check_for_associated_sta test_OPEN"
# WPA2 personal
rlRun "kill_supplicants"
rlRun "wpa2psk_ap test_WPAPSK"
rlRun "check_for_running_aps test_WPAPSK"
rlRun "wpa2psk_sta test_WPAPSK"
rlRun "check_for_associated_sta test_WPAPSK"
rlPhaseEnd
rlPhaseStartCleanup
rlRun kill_supplicants
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlRun "modprobe -r mac80211_hwsim"
rlRun "systemctl restart wpa_supplicant"
rlRun "systemctl restart NetworkManager"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd