[Fuego] [PATCH 11/12] skip cases when LHOST_IFACES not defined

qiutt qiutt at cn.fujitsu.com
Wed Jul 8 10:26:24 UTC 2020


for m3ulcb, skip in6_02 in net.ipv6lib, code modification refer to
latest ltp
 https://github.com/linux-test-project/ltp/commit/95c40a1cdfb35b4de69761599db37a14ea91af1d

Signed-off-by: qiutt <qiutt at cn.fujitsu.com>
---
 tests/Functional.LTP/fuego_test.sh    |  1 +
 tests/Functional.LTP/ltp-in6_02.patch | 51 +++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 tests/Functional.LTP/ltp-in6_02.patch

diff --git a/tests/Functional.LTP/fuego_test.sh b/tests/Functional.LTP/fuego_test.sh
index b097d22..25af0f5 100755
--- a/tests/Functional.LTP/fuego_test.sh
+++ b/tests/Functional.LTP/fuego_test.sh
@@ -372,6 +372,7 @@ function test_build {
                 patch -p0 < ${TEST_HOME}/ltp_network_smack_set_load.patch
                 patch -p0 < ${TEST_HOME}/ltp_network_smack_set_netlabel.patch
                 patch -p0 < ${TEST_HOME}/ltp_network_smack_set_onlycap.patch
+                patch -p0 < ${TEST_HOME}/ltp-in6_02.patch
             fi
 
         make autotools
diff --git a/tests/Functional.LTP/ltp-in6_02.patch b/tests/Functional.LTP/ltp-in6_02.patch
new file mode 100644
index 0000000..c9311a6
--- /dev/null
+++ b/tests/Functional.LTP/ltp-in6_02.patch
@@ -0,0 +1,51 @@
+--- testcases/network/lib6/in6_02.c-bak	2020-04-26 16:04:59.105983746 +0800
++++ testcases/network/lib6/in6_02.c	2020-06-28 15:58:09.700717063 +0800
+@@ -34,7 +34,7 @@
+ 	int nonzero;
+ } n2i[] = {
+ 	{ "lo", 1 },
+-	{ "eth0", 1 },
++	{ NULL, 1 },
+ 	{ "hoser75", 0 },
+ 	{ "6", 0 },
+ };
+@@ -80,6 +80,11 @@
+ 	char ifname[IF_NAMESIZE], *pifn;
+ 
+ 	for (i = 0; i < N2I_COUNT; ++i) {
++		if (n2i[i].name == NULL) {
++			tst_resm(TCONF, "LHOST_IFACES not defined or invalid, skip testing it");
++			return;
++		}
++
+ 		TEST(if_nametoindex(n2i[i].name));
+ 		if (!TEST_RETURN != !n2i[i].nonzero) {
+ 			tst_resm(TFAIL, "if_nametoindex(\"%s\") %ld "
+@@ -256,22 +261,18 @@
+ {
+ 	TEST_PAUSE;
+ 
+-	tst_resm(TINFO, "get interface name from LHOST_IFACES var");
+-
+ 	char *ifnames = getenv("LHOST_IFACES");
+ 
+-	if (!ifnames) {
+-		tst_resm(TWARN, "LHOST_IFACES not defined, default to eth0");
++	if (!ifnames)
+ 		return;
+-	}
+ 
+ 	static char name[256];
++        int ret;
+ 
+-	sscanf(ifnames, "%255s", name);
+-
+-	if (!strcmp(name, n2i[1].name))
++	ret = sscanf(ifnames, "%255s", name);
++	if (ret == -1)
+ 		return;
+ 
+-	tst_resm(TINFO, "change default 'eth0' name to '%s'", name);
++	tst_resm(TINFO, "get interface name from LHOST_IFACES: '%s'", name);
+ 	n2i[1].name = name;
+ }
-- 
2.11.0





More information about the Fuego mailing list