[dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
Ma, LihongX
lihongx.ma at intel.com
Mon Oct 14 07:04:06 CEST 2019
Hi, yufeng
The path of os.getcwd() is dts, not the dts/tests, so the path is dts/dep
-----Original Message-----
From: Mo, YufengX
Sent: Saturday, October 12, 2019 9:26 AM
To: Ma, LihongX <lihongx.ma at intel.com>; dts at dpdk.org
Cc: Ma, LihongX <lihongx.ma at intel.com>
Subject: RE: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from current dep
Hi,ma lihong
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
It will be '/xxx/dts/tests/dep'. Are you sure?
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of lihong
> Sent: Friday, October 11, 2019 8:25 AM
> To: dts at dpdk.org
> Cc: Ma, LihongX <lihongx.ma at intel.com>
> Subject: [dts] [PATCH V1 3/3][nsh] tests/uni_pkt: import nsh from
> current dep
>
> Signed-off-by: lihong <lihongx.ma at intel.com>
> ---
> tests/TestSuite_uni_pkt.py | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
> index 9a75061..cdc5849 100644
> --- a/tests/TestSuite_uni_pkt.py
> +++ b/tests/TestSuite_uni_pkt.py
> @@ -47,6 +47,7 @@ import utils
> from test_case import TestCase
> from exception import VerifyFailure
> from packet import Packet
> +import os
> import time
>
>
> @@ -442,10 +443,12 @@ class TestUniPacket(TestCase):
> "ether+nsh+ipv6+udp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_UDP", \
> "ether+nsh+ipv6+sctp": "L2_ETHER_NSH L3_IPV6_EXT_UNKNOWN L4_SCTP"
> }
> -
> + cwd = os.getcwd()
> + dir_module = cwd + r"/" + "dep"
> for packet in nsh_packets:
> self.tester.scapy_foreground()
> - self.tester.scapy_append("from scapy.contrib.nsh import *")
> + self.tester.scapy_append("sys.path.append('%s')" % dir_module)
> + self.tester.scapy_append("from nsh import NSH")
> self.tester.scapy_append("sendp([%s],iface='%s')" % (nsh_packets[packet], self.tester_iface))
> self.tester.scapy_execute()
> out = self.dut.get_session_output(timeout=2)
> --
> 2.7.4
More information about the dts
mailing list