diff --git a/tests/ncat-protocol-sanity-test/Makefile b/tests/ncat-protocol-sanity-test/Makefile deleted file mode 100644 index d76d767..0000000 --- a/tests/ncat-protocol-sanity-test/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /CoreOS/nmap/Sanity/ncat-protocol-sanity-test -# Description: Test all supported protocols of ncat, like tcp, udp, ... -# Author: Patrik Kis -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2012 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/CoreOS/nmap/Sanity/ncat-protocol-sanity-test -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE srv.exp clt.exp udpsrv.exp udpclt.exp tcpclt.exp tcpsrv.exp - -.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: Patrik Kis " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Test all supported protocols of ncat, like tcp, udp, ..." >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 5m" >> $(METADATA) - @echo "RunFor: nmap" >> $(METADATA) - @echo "Requires: nmap tcpdump expect" >> $(METADATA) - @echo "Releases: -RHEL4 -RedHatEnterpriseLinuxClient5 -RedHatEnterpriseLinuxServer5" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv2" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/ncat-protocol-sanity-test/PURPOSE b/tests/ncat-protocol-sanity-test/PURPOSE deleted file mode 100644 index a13aea3..0000000 --- a/tests/ncat-protocol-sanity-test/PURPOSE +++ /dev/null @@ -1,5 +0,0 @@ -PURPOSE of /CoreOS/nmap/Sanity/ncat-protocol-sanity-test -Description: Test all supported protocols of ncat, like tcp, udp, ... -Author: Patrik Kis - -sanity test for nmap listening on TCP, SCTP, UDP diff --git a/tests/ncat-protocol-sanity-test/clt.exp b/tests/ncat-protocol-sanity-test/clt.exp deleted file mode 100755 index d85714c..0000000 --- a/tests/ncat-protocol-sanity-test/clt.exp +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -4 --sctp localhost 6666 - -expect { - eof { exit 2 } - default { exit 1 } - "ServerSend\r" { sleep 1; send -- "ClientSend\r" } -} -sleep 1 -exit 0 diff --git a/tests/ncat-protocol-sanity-test/runtest.sh b/tests/ncat-protocol-sanity-test/runtest.sh deleted file mode 100755 index 3489bbb..0000000 --- a/tests/ncat-protocol-sanity-test/runtest.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /CoreOS/nmap/Sanity/ncat-protocol-sanity-test -# Description: Test all supported protocols of ncat, like tcp, udp, ... -# Author: Patrik Kis -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2012 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing -# to use, modify, copy, or redistribute it subject to the terms -# and conditions of the GNU General Public License version 2. -# -# 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, write to the Free -# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include Beaker environment -. /usr/bin/rhts-environment.sh -. /usr/share/beakerlib/beakerlib.sh - -PACKAGE="nmap" - -rlJournalStart - rlPhaseStartSetup - rlAssertRpm $PACKAGE - rlRun "modprobe sctp" - rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory" - rlIsRHEL 4 5 && rlRun "chcon -t tmpfs_t $TmpDir" 0 \ - "Changing SELinux context to allow nmap to write to $TmpDir" - rlRun "cp *exp $TmpDir" 0 "Copying expect scripts to working directory" - rlRun "pushd $TmpDir" - rlPhaseEnd - - rlPhaseStartTest "ncat acts as tcp server (Listen mode)" - rlRun "tcpdump -pnnli lo port 6666 > tcpdump-tcp.out &" 0 "Run tcpdump" - TCPDUMPPID=$!; echo TCPDUMPPID=$TCPDUMPPID - sleep 2 - rlRun "./tcpsrv.exp > ncat-server-tcp.out &" - NCATPID=$!; echo NCATPID=$NCATPID - rlRun "rlWaitForSocket -p $NCATPID 6666 -d 0.5" - rlRun "./tcpclt.exp > ncat-client-tcp.out" - sleep 3 - rlRun "kill -9 $NCATPID" 0,1 "Making sure the ncat is dead" - rlRun "kill -9 $TCPDUMPPID" 0,1 "Making sure the tcpdump is dead" - sleep 1 - cat tcpdump-tcp.out - rlAssertGrep "127.0.0.1.6666.*\[S" tcpdump-tcp.out - rlAssertGrep "127.0.0.1.6666.*\[P" tcpdump-tcp.out - rlAssertGrep "127.0.0.1.6666.*\[F" tcpdump-tcp.out - rlAssertEquals "Vefify that there were two PUSH packet sent" \ - 2 `grep "127.0.0.1.6666.*\[P" tcpdump-tcp.out |wc -l` - cat ncat-server-tcp.out - rlAssertGrep "ClientSend" ncat-server-tcp.out - cat ncat-client-tcp.out - rlAssertGrep "ServerSend" ncat-client-tcp.out - rlPhaseEnd - - rlPhaseStartTest "ncat acts as SCTP server (Listen mode)" - # SCTP does not support half-open connection so it has to be tested with expect - # otherwise the parties initiate connection close immediately after all input read - rlRun "tcpdump -pnnli lo port 6666 > tcpdump-sctp.out &" 0 "Run tcpdump" - TCPDUMPPID=$!; echo TCPDUMPPID=$TCPDUMPPID - sleep 2 - rlRun "./srv.exp > ncat-server-sctp.out &" - NCATPID=$!; echo NCATPID=$NCATPID - rlRun "rlWaitForSocket -p $NCATPID 6666 -d 0.5" - rlRun "./clt.exp > ncat-client-sctp.out" - sleep 3 - rlRun "kill -9 $NCATPID" 0,1 "Making sure the ncat is dead" - rlRun "kill -9 $TCPDUMPPID" 0,1 "Making sure the tcpdump is dead" - sleep 1 - cat tcpdump-sctp.out - rlAssertGrep "127.0.0.1.6666.*sctp.*\[INIT" tcpdump-sctp.out - rlAssertGrep "127.0.0.1.6666.*sctp.*\[COOKIE" tcpdump-sctp.out - rlAssertGrep "127.0.0.1.6666.*sctp.*\[SHUTDOWN" tcpdump-sctp.out - rlAssertEquals "Vefify that there were two DATA sctp packet sent" \ - 2 `grep "127.0.0.1.6666.*sctp.*\[DATA\]" tcpdump-sctp.out |wc -l` - cat ncat-server-sctp.out - rlAssertGrep "ClientSend" ncat-server-sctp.out - cat ncat-client-sctp.out - rlAssertGrep "ServerSend" ncat-client-sctp.out - rlPhaseEnd - - rlPhaseStartTest "ncat acts as UDP server (Listen mode)" - rlRun "tcpdump -pnnli lo port 6666 > tcpdump-udp.out &" 0 "Run tcpdump" - TCPDUMPPID=$!; echo TCPDUMPPID=$TCPDUMPPID - sleep 2 - rlRun "./udpsrv.exp >ncat-server-udp.out &" - NCATPID=$!; echo NCATPID=$NCATPID - sleep 2 - rlRun "./udpclt.exp >ncat-client-udp.out &" - NCATCLNTPID=$!; echo NCATPID=$NCATCLNTPID - sleep 2 - rlRun "kill -9 $NCATPID $NCATCLNTPID" 0,1 "Making sure the ncat is dead" - rlRun "kill -9 $TCPDUMPPID" 0,1 "Making sure the tcpdump is dead" - sleep 2 - cat tcpdump-udp.out - rlAssertGrep "127.0.0.1.*>.*127.0.0.1.6666.*UDP" tcpdump-udp.out - rlAssertGrep "127.0.0.1.6666.*>.*127.0.0.1..*UDP" tcpdump-udp.out - rlAssertEquals "Vefify that there were two UDP packet sent" \ - 2 `wc -l tcpdump-udp.out` - cat ncat-server-udp.out - rlAssertGrep "ClientSend" ncat-server-udp.out - cat ncat-client-udp.out - rlAssertGrep "ServerSend" ncat-client-udp.out - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "popd" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd diff --git a/tests/ncat-protocol-sanity-test/srv.exp b/tests/ncat-protocol-sanity-test/srv.exp deleted file mode 100755 index 086ed36..0000000 --- a/tests/ncat-protocol-sanity-test/srv.exp +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -vl --sctp 6666 - -expect { - eof { exit 2 } - default { exit 1 } - "Ncat: Connection from 127.0.0.1" { sleep 1; send -- "ServerSend\r" } -} -expect { - eof { exit 2 } - default { exit 1 } - "ClientSend\r" -} -expect { - eof { exit 0 } - default { exit 1 } -} -exit 3 - diff --git a/tests/ncat-protocol-sanity-test/tcpclt.exp b/tests/ncat-protocol-sanity-test/tcpclt.exp deleted file mode 100755 index 3396eac..0000000 --- a/tests/ncat-protocol-sanity-test/tcpclt.exp +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -4 localhost 6666 - -expect { - eof { exit 2 } - default { exit 1 } - "ServerSend\r" { sleep 1; send -- "ClientSend\r" } -} -sleep 1 -exit 0 diff --git a/tests/ncat-protocol-sanity-test/tcpsrv.exp b/tests/ncat-protocol-sanity-test/tcpsrv.exp deleted file mode 100755 index ac1c803..0000000 --- a/tests/ncat-protocol-sanity-test/tcpsrv.exp +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -vl 6666 - -expect { - eof { exit 2 } - default { exit 1 } - "Ncat: Connection from 127.0.0.1" { sleep 1; send -- "ServerSend\r" } -} -expect { - eof { exit 2 } - default { exit 1 } - "ClientSend\r" -} -expect { - eof { exit 0 } - default { exit 1 } -} -exit 3 - diff --git a/tests/ncat-protocol-sanity-test/udpclt.exp b/tests/ncat-protocol-sanity-test/udpclt.exp deleted file mode 100755 index dbbb0ef..0000000 --- a/tests/ncat-protocol-sanity-test/udpclt.exp +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -4 --udp localhost 6666 - -send -- "ClientSend\r" -expect { - eof { exit 2 } - default { exit 1 } - "ServerSend\r" -} -sleep 1 -exit 0 diff --git a/tests/ncat-protocol-sanity-test/udpsrv.exp b/tests/ncat-protocol-sanity-test/udpsrv.exp deleted file mode 100755 index 3aa72fe..0000000 --- a/tests/ncat-protocol-sanity-test/udpsrv.exp +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/expect - -set timeout 10 - -spawn ncat -vl --udp 6666 - -expect { - eof { exit 2 } - default { exit 1 } - "ClientSend\r" { send -- "ServerSend\r" } -} -sleep 1 -exit 0 diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index 9f67887..0000000 --- a/tests/tests.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -# Tests that run in all contexts -- hosts: localhost - roles: - - role: standard-test-beakerlib - tags: - - classic - tests: - - ncat-protocol-sanity-test - - simple-functionality-test - required_packages: - - kernel-modules # Required to run ncat-protocol-sanity-test - - nmap # Required to run simple-functionality-test - - lsof # Required to run simple-functionality-test - - tcpdump # Required to run ncat-protocol-sanity-test - - expect # Required to run ncat-protocol-sanity-test