[dts] [PATCH 2/2] framework: make option -d to absolute path
Liu, Yong
yong.liu at intel.com
Sun Feb 15 09:03:14 CET 2015
Michael, please see my comments below.
> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Michael Qiu
> Sent: Sunday, February 15, 2015 2:43 PM
> To: dts at dpdk.org
> Subject: [dts] [PATCH 2/2] framework: make option -d to absolute path
>
> Option -d is used for dpdk directory name, which is not suitable.
>
> Meanwhile, dts need make dpdk location in DUT more flexable.
>
> Specify the absolute path with -d option to solve the issue.
>
> Signed-off-by: Michael Qiu <michael.qiu at intel.com>
> ---
> framework/main.py | 2 +-
> framework/project_dpdk.py | 25 ++++++++++++++++++++-----
> framework/ssh_connection.py | 2 +-
> 3 files changed, 22 insertions(+), 7 deletions(-)
>
> diff --git a/framework/main.py b/framework/main.py
> index 0223f57..fe456ea 100755
> --- a/framework/main.py
> +++ b/framework/main.py
> @@ -110,7 +110,7 @@ parser.add_argument('-t', '--test-cases',
> help='executes only the followings test cases')
>
> parser.add_argument('-d', '--dir',
> - default='dpdk',
> + default='dep/dpdk',
> help='Output directory where dpdk package is
> extracted')
>
This parameter mean the directory of exacted dpdk package. Supposed to use "~/dpdk" as default value.
Suggest change dpdk update function, dpdk git folder changed to dep/dpdk .
> parser.add_argument('-v', '--verbose',
> diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
> index 8448a61..1044cbe 100644
> --- a/framework/project_dpdk.py
> +++ b/framework/project_dpdk.py
> @@ -198,10 +198,17 @@ class DPDKdut(Dut):
> if not self.skip_setup:
> assert (os.path.isfile(pkgName) is True), "Invalid package"
>
> - self.session.copy_file_to(pkgName)
> + p_dir, _ = os.path.split(self.base_dir)
> + # ToDo: make this configurable
> + patch_dir = p_dir + '/patches/'
> + self.send_expect("mkdir -p %s && mkdir -p %s && cd %s" %
> + (p_dir, patch_dir, p_dir), "#")
Suppose DTS should not create folder in DUT, we can transfer files to tmp folder.
> + self.session.copy_file_to(pkgName, p_dir)
> +
> + # put patches to p_dir/patches/
> if (patch is not None):
> for p in patch:
> - self.session.copy_file_to('../' + p)
> + self.session.copy_file_to('dep/' + p, patch_dir)
>
> self.kill_all()
>
> @@ -216,13 +223,21 @@ class DPDKdut(Dut):
> self.send_expect("rm -rf %s" % self.base_dir, "#")
>
> # unpack dpdk
> - out = self.send_expect("tar zxf " + pkgName.split('/')[-1],
> "# ", 20)
> + out = self.send_expect("tar zxf %s -C %s" %
> + (pkgName.split('/')[-1], p_dir), "# ",
> 20)
Can we use send_expect(verify=True) here to make sure DPDK package is fine.
This step is very important for later validation.
> assert "Error" not in out
>
> + # check dpdk dir name is expect
> + out = self.send_expect("ls %s" % self.base_dir,
> + "# ", 20, verify = True)
> + if out == -1:
> + raise ValueError("dpdk dir %s mismatch, please check
> params -d"
> + % self.base_dir)
> +
> if (patch is not None):
> for p in patch:
> - out = self.send_expect("patch -d %s -p1 < ../%s" %
> - (self.base_dir, p), "# ")
> + out = self.send_expect("patch -d %s -p1 < %s" %
> + (self.base_dir, patch_dir + p),
> "# ")
> assert "****" not in out
>
> self.dut_prerequisites()
> diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
> index f3debc1..d1075b5 100644
> --- a/framework/ssh_connection.py
> +++ b/framework/ssh_connection.py
> @@ -51,7 +51,7 @@ class SSHConnection(object):
>
> def send_expect(self, cmds, expected, timeout=15, verify=False):
> self.logger.info(cmds)
> - out = self.session.send_expect(cmds, expected, timeout,
> verify=False)
> + out = self.session.send_expect(cmds, expected, timeout, verify)
> self.logger.debug(out)
> return out
>
> --
> 1.9.3
More information about the dts
mailing list