summaryrefslogtreecommitdiffstats
path: root/meta-networking
diff options
context:
space:
mode:
authorMingli Yu <Mingli.Yu@windriver.com>2018-01-04 10:04:58 +0800
committerJoe MacDonald <joe_macdonald@mentor.com>2018-01-08 12:06:37 -0500
commit40dcf5203b1ed04e0516d475bf582cb32217a8c6 (patch)
treee3417184327fd2535cce825daa3afabbb255df17 /meta-networking
parent8031dd5affa4d4c34a61efae938c435275800ea6 (diff)
downloadmeta-openembedded-40dcf5203b1ed04e0516d475bf582cb32217a8c6.tar.gz
openl2tp: add ptest support
* Add run-ptest * Add patch to enable the regressin test Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
Diffstat (limited to 'meta-networking')
-rw-r--r--meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch24
-rw-r--r--meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest97
-rw-r--r--meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb12
3 files changed, 132 insertions, 1 deletions
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch
new file mode 100644
index 000000000..0bece2f4d
--- /dev/null
+++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/openl2tpd-enable-tests.patch
@@ -0,0 +1,24 @@
1commit 3e96a6c41bdd26417265a45ed685138d8eed564e
2Author: Aws Ismail <aws.ismail@windriver.com>
3Date: Fri Sep 14 02:32:53 2012 -0400
4
5 openl2tp: Enable tests
6
7 Build the test direcctory as part
8 of the overall build
9
10 Signed-off-by: Aws Ismail <aws.ismail@windriver.com>
11
12diff --git a/Makefile b/Makefile
13index 412cf4d..adf4f44 100644
14--- a/Makefile
15+++ b/Makefile
16@@ -16,7 +16,7 @@ L2TP_FEATURE_LOCAL_CONF_FILE= y
17
18 # Define to include test code. This must be defined to run the
19 # regression tests
20-# L2TP_TEST= y
21+L2TP_TEST=y
22
23 # Define to compile in debug code. Also makes default trace flags
24 # enable all messages
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest b/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest
new file mode 100644
index 000000000..01c9c7b44
--- /dev/null
+++ b/meta-networking/recipes-protocols/openl2tp/openl2tp/run-ptest
@@ -0,0 +1,97 @@
1#!/bin/sh
2
3TMP_DIR=`mktemp -d /tmp/std.26.tmp.XXXXXX`
4
5# restore the file if exist
6restore_file()
7{
8 filelist="test_procs.tcl tunnel.test session.test"
9 for file in ${filelist}
10 do
11 if [ -f ${TMP_DIR}/${file} ]; then
12 mv ${TMP_DIR}/${file} ${OPENL2TP_DIR}
13 fi
14 done
15}
16
17exit_cus()
18{
19 restore_file
20 echo $1
21 exit $2
22}
23
24if [ -d /usr/lib64/openl2tp/ptest ]; then
25 OPENL2TP_DIR="/usr/lib64/openl2tp"
26elif [ -d /usr/lib/openl2tp/ptest ]; then
27 OPENL2TP_DIR="/usr/lib/openl2tp"
28else
29 exit_cus "The openl2tp ptest directory not installed, skip the test" 1
30fi
31
32#read -p "Please input the network interface you use to test(such as eth0, em1 etc):" ETH_TEST
33echo "Please input the network interface you use to test(such as eth0, em1 etc):"
34read ETH_TEST > /dev/null
35
36if [ x"$ETH_TEST" = x ]; then
37 exit_cus "The network interface cannot be null" 1
38fi
39ifconfig | grep $ETH_TEST > /dev/null || exit_cus "The network interface you provide is invalid" 1
40
41# check openl2tp related kernel config
42zcat /proc/config.gz | grep CONFIG_L2TP=y > /dev/null || exit_cus "Failed to check CONFIG_L2TP=y, skip the tests." 1
43zcat /proc/config.gz | grep CONFIG_PPPOL2TP=m > /dev/null || exit_cus "Failed to check CONFIG_PPPOL2TP=m, skip the tests." 1
44
45SYSV_INIT="/etc/init.d/rpcbind"
46if [ -e ${SYSV_INIT} ]; then
47 ${SYSV_INIT} status > /dev/null || ${SYSV_INIT} start > /dev/null
48else
49 systemctl status rpcbind > /dev/null || systemctl start rpcbind > /dev/null
50fi
51
52which systemctl > /dev/null && systemctl status rpcbind > /dev/null || service rpcbind status > /dev/null
53[ $? -ne 0 ] && exit_cus "Failed to start rpcbind service, skip the tests." 1
54
55# backup the below files
56cp ${OPENL2TP_DIR}/ptest/test_procs.tcl $TMP_DIR
57cp ${OPENL2TP_DIR}/ptest/tunnel.test $TMP_DIR
58cp ${OPENL2TP_DIR}/ptest/session.test $TMP_DIR
59
60# customise the config
61if [ x"$ETH_TEST" = x ]; then
62 exit_cus "Please set ETH_TEST which used to test first, skip the tests." 1
63fi
64
65sed -i 's/eth2/'\"$ETH_TEST\"'/g' ${OPENL2TP_DIR}/ptest/test_procs.tcl
66test_ip="`ifconfig $ETH_TEST | grep 'inet ' | sed 's/^.*inet addr://g' | \
67 sed 's/ *Mask.*$//g'|sed 's/ *Bcast.*$//g'`"
68sed -i 's/192.168.0.1/'"$test_ip"'/g' ${OPENL2TP_DIR}/ptest/tunnel.test
69
70# load module l2tp_ppp
71modprobe l2tp_ppp > /dev/null
72lsmod | grep l2tp_ppp > /dev/null || exit_cus "FAIL: Load module l2tp_ppp" 2
73
74# start openl2tpd
75ps aux | grep openl2tpd | grep -v grep > /dev/null && killall openl2tpd > /dev/null
76ppp_path=`rpm -ql openl2tp | grep ppp_null.so`
77echo "test it here"
78/usr/sbin/openl2tpd -d all -D -f -p ${ppp_path} & > /dev/null
79
80# prepare the test env
81rm -rf $OPENL2TP_DIR/results
82mkdir -p $OPENL2TP_DIR/results || exit_cus "FAIL: mkdir $OPENL2TP_DIR/results" 2
83cp /usr/bin/l2tpconfig ${OPENL2TP_DIR} || exit_cus "FAIL: copy /usr/bin/l2tpconfig to ${OPENL2TP_DIR}" 2
84
85# start the test
86cd ${OPENL2TP_DIR}/ptest && tclsh all.tcl -preservecore 3 -verbose bps -tmpdir $OPENL2TP_DIR/results -outfile test-l2tpd.result -constraints "l2tpdRunning peerProfile tunnelProfile sessionProfile pppProfile system" -match "peer_profile-1.1 tunnel_profile-1.1 session_profile-1.1 ppp_profile-1.1 system-1.1"
87
88# check the result
89PASSNUM=`grep PASS $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
90FAILNUM=`grep FAIL $OPENL2TP_DIR/results/test-l2tpd.result | wc -l`
91if [ $PASSNUM -ne 0 ] && [ $FAILNUM -eq 0 ]; then
92 echo "PASS: openl2tp"
93else
94 echo "FAIL: openl2tp"
95fi
96
97restore_file
diff --git a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb
index bbde8a337..bf6850b17 100644
--- a/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb
+++ b/meta-networking/recipes-protocols/openl2tp/openl2tp_1.8.bb
@@ -31,6 +31,8 @@ SRC_URI = "ftp://ftp.openl2tp.org/releases/${BP}/${BP}.tar.gz \
31 file://openl2tpd-initscript-fix-sysconfig.patch \ 31 file://openl2tpd-initscript-fix-sysconfig.patch \
32 file://openl2tpd-initscript-fix-warning.patch \ 32 file://openl2tpd-initscript-fix-warning.patch \
33 file://openl2tpd.service \ 33 file://openl2tpd.service \
34 file://openl2tpd-enable-tests.patch \
35 file://run-ptest \
34 " 36 "
35 37
36SRC_URI_append_libc-musl = "\ 38SRC_URI_append_libc-musl = "\
@@ -41,7 +43,7 @@ SRC_URI_append_libc-musl = "\
41SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0" 43SRC_URI[md5sum] = "e3d08dedfb9e6a9a1e24f6766f6dadd0"
42SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f" 44SRC_URI[sha256sum] = "1c97704d4b963a87fbc0e741668d4530933991515ae9ab0dffd11b5444f4860f"
43 45
44inherit autotools-brokensep pkgconfig systemd 46inherit autotools-brokensep pkgconfig systemd ptest
45 47
46SYSTEMD_SERVICE_${PN} = "openl2tpd.service" 48SYSTEMD_SERVICE_${PN} = "openl2tpd.service"
47SYSTEMD_AUTO_ENABLE = "disable" 49SYSTEMD_AUTO_ENABLE = "disable"
@@ -85,4 +87,12 @@ do_install_append () {
85 fi 87 fi
86} 88}
87 89
90do_install_ptest () {
91 for i in all.tcl configfile.test peer_profile.test ppp_profile.test \
92 session_profile.test session.test system.test test_procs.tcl \
93 thirdparty_lns.test tunnel_profile.test tunnel.test; do
94 install -m 0755 ${S}/test/$i ${D}${PTEST_PATH}
95 done
96}
97
88RDEPENDS_${PN} = "ppp ppp-l2tp bash" 98RDEPENDS_${PN} = "ppp ppp-l2tp bash"